Class: PayoneerApiClient::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(res) ⇒ Response

Returns a new instance of Response.



6
7
8
9
10
11
# File 'lib/payoneer_api_client/response.rb', line 6

def initialize(res)
  @code = res[RESP_FIELD[:code]]
  @description = res[RESP_FIELD[:desc]]
  @other = res.delete_if { |v| RESP_FIELD.values.include?(v) }
  errors unless @code.zero?
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/payoneer_api_client/response.rb', line 4

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/payoneer_api_client/response.rb', line 4

def description
  @description
end

#otherObject (readonly)

Returns the value of attribute other.



4
5
6
# File 'lib/payoneer_api_client/response.rb', line 4

def other
  @other
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
# File 'lib/payoneer_api_client/response.rb', line 17

def ==(other)
  code == other.code && description == other.description
end

#ok?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/payoneer_api_client/response.rb', line 13

def ok?
  code.zero?
end