Class: FdxV660Api::PaymentsEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/payments_entity.rb

Overview

A list of payments

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(payments:, page: SKIP, updates: SKIP, links: SKIP, additional_properties: nil) ⇒ PaymentsEntity

Returns a new instance of PaymentsEntity.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 52

def initialize(payments:, page: SKIP, updates: SKIP, links: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @page = page unless page == SKIP
  @updates = updates unless updates == SKIP
  @links = links unless links == SKIP
  @payments = payments
  @additional_properties = additional_properties
end

Instance Attribute Details

Resource URLs for navigating result sets



22
23
24
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 22

def links
  @links
end

#pagePageMetadata

Page keys for navigating result sets

Returns:



14
15
16
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 14

def page
  @page
end

#paymentsArray[PaymentEntity]

Payments retrieved by the operation

Returns:



26
27
28
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 26

def payments
  @payments
end

#updatesUpdatesMetadataEntity2

Update IDs for retrieving updates since query



18
19
20
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 18

def updates
  @updates
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  payments = nil
  unless hash['payments'].nil?
    payments = []
    hash['payments'].each do |structure|
      payments << (PaymentEntity.from_hash(structure) if structure)
    end
  end

  payments = nil unless hash.key?('payments')
  page = PageMetadata.from_hash(hash['page']) if hash['page']
  updates = UpdatesMetadataEntity2.from_hash(hash['updates']) if hash['updates']
  links = SynchronizableArrayLinksEntity2.from_hash(hash['links']) if hash['links']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  PaymentsEntity.new(payments: payments,
                     page: page,
                     updates: updates,
                     links: links,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['page'] = 'page'
  @_hash['updates'] = 'updates'
  @_hash['links'] = 'links'
  @_hash['payments'] = 'payments'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 39

def self.optionals
  %w[
    page
    updates
    links
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



106
107
108
109
110
111
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 106

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} page: #{@page.inspect}, updates: #{@updates.inspect}, links:"\
  " #{@links.inspect}, payments: #{@payments.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



99
100
101
102
103
# File 'lib/fdx_v660_api/models/payments_entity.rb', line 99

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} page: #{@page}, updates: #{@updates}, links: #{@links}, payments:"\
  " #{@payments}, additional_properties: #{@additional_properties}>"
end