Class: OnlinePayments::SDK::Domain::PaymentsReportResponse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#paginationOnlinePayments::SDK::Domain::CursorPaginationInfo

Returns the current value of pagination.

Returns:



13
14
15
# File 'lib/onlinepayments/sdk/domain/payments_report_response.rb', line 13

def pagination
  @pagination
end

#paymentsArray<OnlinePayments::SDK::Domain::PaymentSummary>

Returns the current value of payments.

Returns:



13
14
15
# File 'lib/onlinepayments/sdk/domain/payments_report_response.rb', line 13

def payments
  @payments
end

Instance Method Details

#from_hash(hash) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/onlinepayments/sdk/domain/payments_report_response.rb', line 27

def from_hash(hash)
  super
  if hash.has_key? 'pagination'
    raise TypeError, "value '%s' is not a Hash" % [hash['pagination']] unless hash['pagination'].is_a? Hash
    @pagination = OnlinePayments::SDK::Domain::CursorPaginationInfo.new_from_hash(hash['pagination'])
  end
  if hash.has_key? 'payments'
    raise TypeError, "value '%s' is not an Array" % [hash['payments']] unless hash['payments'].is_a? Array
    @payments = []
    hash['payments'].each do |e|
      @payments << OnlinePayments::SDK::Domain::PaymentSummary.new_from_hash(e)
    end
  end
end

#to_hHash

Returns:

  • (Hash)


20
21
22
23
24
25
# File 'lib/onlinepayments/sdk/domain/payments_report_response.rb', line 20

def to_h
  hash = super
  hash['pagination'] = @pagination.to_h unless @pagination.nil?
  hash['payments'] = @payments.collect{|val| val.to_h} unless @payments.nil?
  hash
end