Class: Pdfthat
Class Attribute Summary collapse
-
.production(d) ⇒ Object
Returns the value of attribute production.
-
.token(t) ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
- .api_uri ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .create_document(options) ⇒ Object
- .default_options ⇒ Object
- .get_document(options) ⇒ Object
Class Attribute Details
.production(d) ⇒ Object
Returns the value of attribute production.
6 7 8 |
# File 'lib/pdfthat-client.rb', line 6 def production @production end |
.token(t) ⇒ Object
Returns the value of attribute token.
5 6 7 |
# File 'lib/pdfthat-client.rb', line 5 def token @token end |
Class Method Details
.api_uri ⇒ Object
26 27 28 29 |
# File 'lib/pdfthat-client.rb', line 26 def api_uri dev_uri = @production == true ? "" : "/development" "/api/v1#{dev_uri}" end |
.configure {|_self| ... } ⇒ Object
22 23 24 |
# File 'lib/pdfthat-client.rb', line 22 def configure yield self end |
.create_document(options) ⇒ Object
31 32 33 34 35 |
# File 'lib/pdfthat-client.rb', line 31 def create_document() return false unless @token results = post(api_uri + "/documents.json", :query => .merge(:token => @token)) return results end |
.default_options ⇒ Object
16 17 18 19 20 |
# File 'lib/pdfthat-client.rb', line 16 def @default_options[:timeout] ||= 10000 @default_options[:base_uri] ||= "http://pdfth.at" super end |
.get_document(options) ⇒ Object
36 37 38 39 40 |
# File 'lib/pdfthat-client.rb', line 36 def get_document() return false unless @token results = get(api_uri + "/documents/#{[:id]}.json", :query => .merge(:token => @token)) return results end |