Class: FourInfo::Response
- Inherits:
-
Object
- Object
- FourInfo::Response
- Defined in:
- lib/response.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #confirmation_code ⇒ Object
-
#initialize(xml) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(xml) ⇒ Response
Returns a new instance of Response.
3 4 5 6 7 8 |
# File 'lib/response.rb', line 3 def initialize(xml) gem 'hpricot' require 'hpricot' @xml = xml @body = Hpricot.parse(xml) end |
Instance Method Details
#[](name) ⇒ Object
14 15 16 17 |
# File 'lib/response.rb', line 14 def [](name) nodes = (@body/name) 1 == nodes.size ? nodes.first : nodes end |
#confirmation_code ⇒ Object
23 24 25 |
# File 'lib/response.rb', line 23 def confirmation_code self[:confcode].inner_text end |
#inspect ⇒ Object
10 11 12 |
# File 'lib/response.rb', line 10 def inspect @xml.to_s end |
#success? ⇒ Boolean
19 20 21 |
# File 'lib/response.rb', line 19 def success? 'Success' == self['message'].inner_text end |