Class: Payoneer::Response

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

Constant Summary collapse

OK_STATUS_CODE =
'000'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, body) ⇒ Response

Returns a new instance of Response.



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

def initialize(code, body)
  @code = code
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

Class Method Details

.new_ok_response(body) ⇒ Object



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

def self.new_ok_response(body)
  new(OK_STATUS_CODE, body)
end

Instance Method Details

#==(other) ⇒ Object



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

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

#ok?Boolean

Returns:

  • (Boolean)


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

def ok?
  code == OK_STATUS_CODE
end