Class: FourInfo::Response

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

Instance Method Summary collapse

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_codeObject



18
19
20
# File 'lib/response.rb', line 18

def confirmation_code
  self[:confcode].inner_text
end

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/response.rb', line 14

def success?
  'Success' == self['message'].inner_text
end