Class: Pdfthat

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/pdfthat-client.rb

Class Attribute Summary collapse

Class Method Summary collapse

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_uriObject



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

Yields:

  • (_self)

Yield Parameters:

  • _self (Pdfthat)

    the object that the method was called on



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(options)
  return false unless @token
  results = post(api_uri + "/documents.json", :query => options.merge(:token => @token))
  return results
end

.default_optionsObject



16
17
18
19
20
# File 'lib/pdfthat-client.rb', line 16

def default_options
  @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(options)
  return false unless @token
  results = get(api_uri + "/documents/#{options[:id]}.json", :query => options.merge(:token => @token))
  return results
end