Class: Trebbianno::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response, type) ⇒ Response

Returns a new instance of Response.



6
7
8
9
10
# File 'lib/trebbianno/response.rb', line 6

def initialize(raw_response, type)
  @raw_response = raw_response
  @response     = parse_response(raw_response)
  @type         = type
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



4
5
6
# File 'lib/trebbianno/response.rb', line 4

def response
  @response
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/trebbianno/response.rb', line 12

def failure?
  !success?
end

#parse_response(xml_response) ⇒ Object



21
22
23
24
25
# File 'lib/trebbianno/response.rb', line 21

def parse_response(xml_response)
  blank = xml_response.respond_to?(:empty?) ? !!xml_response.empty? : !xml_response
  return nil if blank
  XmlSimple.xml_in(xml_response)
end

#success?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/trebbianno/response.rb', line 16

def success?
  # @response.parsed["#{@type}_response"]["#{@type}_result"][:status] == '0001'
  true
end