Class: STSPlatform::STSPlatformResponse

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#codeObject

Returns the value of attribute code.



11
12
13
# File 'lib/stsplatform/stsplatformresponse.rb', line 11

def code
  @code
end

#dataObject

Returns the value of attribute data.



11
12
13
# File 'lib/stsplatform/stsplatformresponse.rb', line 11

def data
  @data
end