class Payoneer::Response

Constants

OK_STATUS_CODE

Public Class Methods

new(name, hash) click to toggle source
Calls superclass method
# File lib/payoneer/response.rb, line 5
def initialize(name, hash)
  super(convert_hash_keys(hash))
  self.response_name = name
end

Public Instance Methods

convert_hash_keys(value) click to toggle source
# File lib/payoneer/response.rb, line 10
def convert_hash_keys(value)
  case value
    when Array
      value.map { |v| convert_hash_keys(v) }
    when Hash
      Hash[value.map { |k, v| [k.underscore, convert_hash_keys(v)] }]
    else
      value
   end
end
ok?() click to toggle source
# File lib/payoneer/response.rb, line 21
def ok?
  if self.response_name == 'GetPaymentStatus'
    self.result == OK_STATUS_CODE
  else
    self.status == OK_STATUS_CODE
  end
end