Last active
August 29, 2015 14:09
-
-
Save ivarvong/8086065c515c920857ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Document < ActiveRecord::Base | |
include HTTParty | |
format :json | |
base_uri "https://www.documentcloud.org" | |
debug_output $stdout # optional | |
def update_published_url | |
self.class.put("/api/documents/#{self.dc_id}.json", | |
basic_auth: { | |
username: ENV['DOCUMENTCLOUD_USERNAME'], | |
password: ENV['DOCUMENTCLOUD_PASSWORD'] | |
}, | |
body: { | |
"published_url" => "#{ENV['DOCUMENT_URL_BASE']}/#{self.dc_id}" | |
} | |
) | |
end | |
# other stuff | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment