Class: OnlinePayments::SDK::Domain::PayoutErrorResponse

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/payout_error_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#error_idString

Returns the current value of error_id.

Returns:

  • (String)

    the current value of error_id



14
15
16
# File 'lib/onlinepayments/sdk/domain/payout_error_response.rb', line 14

def error_id
  @error_id
end

#errorsArray<OnlinePayments::SDK::Domain::APIError>

Returns the current value of errors.

Returns:



14
15
16
# File 'lib/onlinepayments/sdk/domain/payout_error_response.rb', line 14

def errors
  @errors
end

#payout_resultOnlinePayments::SDK::Domain::PayoutResult

Returns the current value of payout_result.

Returns:



14
15
16
# File 'lib/onlinepayments/sdk/domain/payout_error_response.rb', line 14

def payout_result
  @payout_result
end

Instance Method Details

#from_hash(hash) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/onlinepayments/sdk/domain/payout_error_response.rb', line 31

def from_hash(hash)
  super
  if hash.has_key? 'errorId'
    @error_id = hash['errorId']
  end
  if hash.has_key? 'errors'
    raise TypeError, "value '%s' is not an Array" % [hash['errors']] unless hash['errors'].is_a? Array
    @errors = []
    hash['errors'].each do |e|
      @errors << OnlinePayments::SDK::Domain::APIError.new_from_hash(e)
    end
  end
  if hash.has_key? 'payoutResult'
    raise TypeError, "value '%s' is not a Hash" % [hash['payoutResult']] unless hash['payoutResult'].is_a? Hash
    @payout_result = OnlinePayments::SDK::Domain::PayoutResult.new_from_hash(hash['payoutResult'])
  end
end

#to_hHash

Returns:

  • (Hash)


23
24
25
26
27
28
29
# File 'lib/onlinepayments/sdk/domain/payout_error_response.rb', line 23

def to_h
  hash = super
  hash['errorId'] = @error_id unless @error_id.nil?
  hash['errors'] = @errors.collect{|val| val.to_h} unless @errors.nil?
  hash['payoutResult'] = @payout_result.to_h unless @payout_result.nil?
  hash
end