Class: FreshBooks::Response
- Inherits:
-
Object
- Object
- FreshBooks::Response
- Defined in:
- lib/freshbooks.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
Instance Method Summary collapse
- #elements ⇒ Object
- #error_msg ⇒ Object
- #fail? ⇒ Boolean
-
#initialize(xml_raw) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(xml_raw) ⇒ Response
Returns a new instance of Response.
109 110 111 |
# File 'lib/freshbooks.rb', line 109 def initialize(xml_raw) @doc = Document.new xml_raw end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
108 109 110 |
# File 'lib/freshbooks.rb', line 108 def doc @doc end |
Instance Method Details
#elements ⇒ Object
113 114 115 |
# File 'lib/freshbooks.rb', line 113 def elements @doc.root.elements end |
#error_msg ⇒ Object
125 126 127 |
# File 'lib/freshbooks.rb', line 125 def error_msg return @doc.root.elements['error'].text end |
#fail? ⇒ Boolean
121 122 123 |
# File 'lib/freshbooks.rb', line 121 def fail? !success? end |
#success? ⇒ Boolean
117 118 119 |
# File 'lib/freshbooks.rb', line 117 def success? @doc.root.attributes['status'] == 'ok' end |