Class: Payoneer::Response

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

Direct Known Subclasses

Payout::Status

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response = {}) ⇒ Response

Returns a new instance of Response.



18
19
20
21
22
23
# File 'lib/payoneer/responses/response.rb', line 18

def initialize(response = {})
  @body = {}.with_indifferent_access

  add_methods(response.keys)
  update_attributes(response)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

Class Method Details

.convert(response) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/payoneer/responses/response.rb', line 7

def self.convert(response)
  case response
  when Array
    response.map { |i| convert(i) }
  when Hash
    new(response)
  else
    response
  end
end