Class: STSPlatform::STSPlatformResponse
- Inherits:
-
Object
- Object
- STSPlatform::STSPlatformResponse
- Defined in:
- lib/stsplatform/stsplatformresponse.rb
Overview
A custom response object from our library Params:
response-
an Net::HTTP error response
Returns:
STSPlatformResponse-
object containing “data” and “code” parameters
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(response) ⇒ STSPlatformResponse
constructor
A new instance of STSPlatformResponse.
Constructor Details
#initialize(response) ⇒ STSPlatformResponse
Returns a new instance of STSPlatformResponse.
12 13 14 15 16 17 18 19 20 |
# File 'lib/stsplatform/stsplatformresponse.rb', line 12 def initialize(response) begin @data = JSON.parse(response.body) rescue @data = nil ensure @code = response.code end end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
11 12 13 |
# File 'lib/stsplatform/stsplatformresponse.rb', line 11 def code @code end |
#data ⇒ Object
Returns the value of attribute data.
11 12 13 |
# File 'lib/stsplatform/stsplatformresponse.rb', line 11 def data @data end |