Class: Zapi::ZapiResponse
- Inherits:
-
Object
- Object
- Zapi::ZapiResponse
- Defined in:
- lib/zapi_response.rb
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
- #_response ⇒ Object
- #api_version ⇒ Object
- #data ⇒ Object
-
#initialize(raw_response:) ⇒ ZapiResponse
constructor
A new instance of ZapiResponse.
- #method_name ⇒ Object
- #raw_hash ⇒ Object
- #raw_xml ⇒ Object
Constructor Details
#initialize(raw_response:) ⇒ ZapiResponse
Returns a new instance of ZapiResponse.
5 6 7 |
# File 'lib/zapi_response.rb', line 5 def initialize raw_response: @raw_response = raw_response end |
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
3 4 5 |
# File 'lib/zapi_response.rb', line 3 def raw_response @raw_response end |
Instance Method Details
#_response ⇒ Object
29 30 31 |
# File 'lib/zapi_response.rb', line 29 def _response raw_hash.try(:[], 'response') end |
#api_version ⇒ Object
17 18 19 |
# File 'lib/zapi_response.rb', line 17 def api_version _response.try(:[],'zapiVersion') end |
#data ⇒ Object
25 26 27 |
# File 'lib/zapi_response.rb', line 25 def data _response.try(:[],'methodResponse') end |
#method_name ⇒ Object
21 22 23 |
# File 'lib/zapi_response.rb', line 21 def method_name data.try(:[],'methodName') end |
#raw_hash ⇒ Object
13 14 15 |
# File 'lib/zapi_response.rb', line 13 def raw_hash Hash.from_xml(raw_xml).with_indifferent_access end |
#raw_xml ⇒ Object
9 10 11 |
# File 'lib/zapi_response.rb', line 9 def raw_xml raw_response.body end |