Class: Nuncium::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



5
6
7
# File 'lib/nuncium/response.rb', line 5

def initialize(response)
  @response = Hash.from_xml(response.body)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/nuncium/response.rb', line 3

def body
  @body
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/nuncium/response.rb', line 3

def status
  @status
end

Instance Method Details

#parsed_bodyObject



9
10
11
12
# File 'lib/nuncium/response.rb', line 9

def parsed_body
  raise HtmlResponseReceived, @response.inspect unless @response['Envelope'].present?
  @response['Envelope']['Body'][result_key]
end

#result_keyObject



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

def result_key
  @response['Envelope']['Body'].first[0]
end