Class: FreshBooks::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#docObject

Returns the value of attribute doc.



108
109
110
# File 'lib/freshbooks.rb', line 108

def doc
  @doc
end

Instance Method Details

#elementsObject



113
114
115
# File 'lib/freshbooks.rb', line 113

def elements
  @doc.root.elements
end

#error_msgObject



125
126
127
# File 'lib/freshbooks.rb', line 125

def error_msg
  return @doc.root.elements['error'].text
end

#fail?Boolean

Returns:

  • (Boolean)


121
122
123
# File 'lib/freshbooks.rb', line 121

def fail?
  !success?
end

#success?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/freshbooks.rb', line 117

def success?
  @doc.root.attributes['status'] == 'ok'
end