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.
- #success? ⇒ Boolean
Constructor Details
#initialize(xml) ⇒ Response
Returns a new instance of Response.
3 4 5 6 7 |
# File 'lib/response.rb', line 3 def initialize(xml) gem 'hpricot' require 'hpricot' @body = Hpricot.parse(xml) end |
Instance Method Details
#[](name) ⇒ Object
9 10 11 12 |
# File 'lib/response.rb', line 9 def [](name) nodes = (@body/name) 1 == nodes.size ? nodes.first : nodes end |
#confirmation_code ⇒ Object
18 19 20 |
# File 'lib/response.rb', line 18 def confirmation_code self[:confcode].inner_text end |
#success? ⇒ Boolean
14 15 16 |
# File 'lib/response.rb', line 14 def success? 'Success' == self['message'].inner_text end |