Class: FreshBooks::Response

Inherits:
Hash
  • Object
show all
Defined in:
lib/freshbooks.rb

Overview

provides a Hash-like response object with structure isomorphic to actual xml response, slightly tidied.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Response

Returns a new instance of Response.



14
15
16
17
18
19
20
# File 'lib/freshbooks.rb', line 14

def initialize(data)
  super nil
  response = data["response"]
  response.delete "xmlns"
  @status = response.delete "status"
  update response
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/freshbooks.rb', line 12

def status
  @status
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/freshbooks.rb', line 22

def success?
  status == "ok"
end