Class: FreshBooks::Response
- Inherits:
-
Object
- Object
- FreshBooks::Response
- Defined in:
- lib/freshbooks/response.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.
5 6 7 |
# File 'lib/freshbooks/response.rb', line 5 def initialize(xml_raw) @doc = REXML::Document.new(xml_raw) end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
3 4 5 |
# File 'lib/freshbooks/response.rb', line 3 def doc @doc end |
Instance Method Details
#elements ⇒ Object
9 10 11 |
# File 'lib/freshbooks/response.rb', line 9 def elements @doc.root.elements end |
#error_msg ⇒ Object
21 22 23 |
# File 'lib/freshbooks/response.rb', line 21 def error_msg return @doc.root.elements['error'].text end |
#fail? ⇒ Boolean
17 18 19 |
# File 'lib/freshbooks/response.rb', line 17 def fail? !success? end |
#success? ⇒ Boolean
13 14 15 |
# File 'lib/freshbooks/response.rb', line 13 def success? @doc.root.attributes['status'] == 'ok' end |