Class: ROX::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(ox_response) ⇒ Response

Returns a new instance of Response.



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

def initialize(ox_response)
  @oxresponse = ox_response
end

Instance Method Details

#[](key) ⇒ Object



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

def [](key)
  @oxresponse[key.to_s]
end

#dataObject



20
21
22
# File 'lib/rox/response.rb', line 20

def data
  @oxresponse['data']
end

#errorObject



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

def error
  return nil unless error?
  sprintf(@oxresponse['error'], *@oxresponse['error_params'])
end

#error?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/rox/response.rb', line 7

def error?
  @oxresponse.include?('error')
end

#to_sObject



24
25
26
# File 'lib/rox/response.rb', line 24

def to_s
  @oxresponse.inspect
end