Class: Txter::Gateway4info::Response
- Inherits:
-
Txter::Gateway::Response
- Object
- Txter::Gateway::Response
- Txter::Gateway4info::Response
- Defined in:
- lib/gateway_4info.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.
45 46 47 48 49 50 |
# File 'lib/gateway_4info.rb', line 45 def initialize(xml) gem 'hpricot' require 'hpricot' @xml = xml @body = Hpricot.parse(xml) end |
Instance Method Details
#[](name) ⇒ Object
56 57 58 59 |
# File 'lib/gateway_4info.rb', line 56 def [](name) nodes = (@body/name) 1 == nodes.size ? nodes.first : nodes end |
#confirmation_code ⇒ Object
65 66 67 |
# File 'lib/gateway_4info.rb', line 65 def confirmation_code self[:confcode].inner_text end |
#inspect ⇒ Object
52 53 54 |
# File 'lib/gateway_4info.rb', line 52 def inspect @xml.to_s end |
#success? ⇒ Boolean
61 62 63 |
# File 'lib/gateway_4info.rb', line 61 def success? 'Success' == self['message'].inner_text end |