Class: CyberSourceMergedSpec::PaymentInstrumentList

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/payment_instrument_list.rb

Overview

PaymentInstrumentList Model.

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(links: SKIP, offset: 0, limit: 20, count: SKIP, total: SKIP, embedded: SKIP, additional_properties: nil) ⇒ PaymentInstrumentList

Returns a new instance of PaymentInstrumentList.



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 66

def initialize(links: SKIP, offset: 0, limit: 20, count: SKIP, total: SKIP,
               embedded: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @links = links unless links == SKIP
  @offset = offset unless offset == SKIP
  @limit = limit unless limit == SKIP
  @count = count unless count == SKIP
  @total = total unless total == SKIP
  @embedded = embedded unless embedded == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#countInteger

The number of Payment Instruments returned in the array.

Returns:

  • (Integer)


26
27
28
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 26

def count
  @count
end

#embeddedEmbedded12

Payment Instrument Resources.

Returns:



35
36
37
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 35

def embedded
  @embedded
end

#limitInteger

The limit parameter supplied in the request.

Returns:

  • (Integer)


22
23
24
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 22

def limit
  @limit
end

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 14

def links
  @links
end

#offsetInteger

The offset parameter supplied in the request.

Returns:

  • (Integer)


18
19
20
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 18

def offset
  @offset
end

#totalInteger

The total number of Payment Instruments associated with the Customer or Instrument Identifier.

Returns:

  • (Integer)


31
32
33
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 31

def total
  @total
end

Class Method Details

.from_element(root) ⇒ Object



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 109

def self.from_element(root)
  links = XmlUtilities.from_element(root, 'Links85', Links85)
  offset = XmlUtilities.from_element(root, 'offset', Integer)
  limit = XmlUtilities.from_element(root, 'limit', Integer)
  count = XmlUtilities.from_element(root, 'count', Integer)
  total = XmlUtilities.from_element(root, 'total', Integer)
  embedded = XmlUtilities.from_element(root, 'Embedded12', Embedded12)

  new(links: links,
      offset: offset,
      limit: limit,
      count: count,
      total: total,
      embedded: embedded,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  links = Links85.from_hash(hash['_links']) if hash['_links']
  offset = hash['offset'] ||= 0
  limit = hash['limit'] ||= 20
  count = hash.key?('count') ? hash['count'] : SKIP
  total = hash.key?('total') ? hash['total'] : SKIP
  embedded = Embedded12.from_hash(hash['_embedded']) if hash['_embedded']

  # 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.
  PaymentInstrumentList.new(links: links,
                            offset: offset,
                            limit: limit,
                            count: count,
                            total: total,
                            embedded: embedded,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['links'] = '_links'
  @_hash['offset'] = 'offset'
  @_hash['limit'] = 'limit'
  @_hash['count'] = 'count'
  @_hash['total'] = 'total'
  @_hash['embedded'] = '_embedded'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
59
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 50

def self.optionals
  %w[
    links
    offset
    limit
    count
    total
    embedded
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



150
151
152
153
154
155
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 150

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} links: #{@links.inspect}, offset: #{@offset.inspect}, limit:"\
  " #{@limit.inspect}, count: #{@count.inspect}, total: #{@total.inspect}, embedded:"\
  " #{@embedded.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



142
143
144
145
146
147
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 142

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} links: #{@links}, offset: #{@offset}, limit: #{@limit}, count: #{@count},"\
  " total: #{@total}, embedded: #{@embedded}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/cyber_source_merged_spec/models/payment_instrument_list.rb', line 126

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'Links85', links)
  XmlUtilities.add_as_subelement(doc, root, 'offset', offset)
  XmlUtilities.add_as_subelement(doc, root, 'limit', limit)
  XmlUtilities.add_as_subelement(doc, root, 'count', count)
  XmlUtilities.add_as_subelement(doc, root, 'total', total)
  XmlUtilities.add_as_subelement(doc, root, 'Embedded12', embedded)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end