Class: CyberSourceMergedSpec::Card129

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

Overview

Card129 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(number: SKIP, additional_properties: nil) ⇒ Card129

Returns a new instance of Card129.



51
52
53
54
55
56
57
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 51

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

  @number = number unless number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#numberString

The customer’s payment card number, also known as the Primary Account Number (PAN). You can also use this field for encoded account numbers.

FDMS Nashville

Required. String (19)

GPX

Required if pointOfSaleInformation.entryMode=keyed. However, this field is optional if your account is configured for relaxed requirements for address data and expiration date. Important It is your responsibility to determine whether a field is required for the transaction you are requesting.

All other processors

Required if pointOfSaleInformation.entryMode=keyed. However, this field is optional if your account is configured for relaxed requirements for address data and expiration date. Important It is your responsibility to determine whether a field is required for the transaction you are requesting.

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 30

def number
  @number
end

Class Method Details

.from_element(root) ⇒ Object



78
79
80
81
82
83
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 78

def self.from_element(root)
  number = XmlUtilities.from_element(root, 'number', String)

  new(number: number,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 60

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  number = hash.key?('number') ? hash['number'] : SKIP

  # 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.
  Card129.new(number: number,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['number'] = 'number'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 40

def self.optionals
  %w[
    number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



102
103
104
105
106
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 102

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

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 96

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

#to_xml_element(doc, root_name) ⇒ Object



85
86
87
88
89
90
91
92
93
# File 'lib/cyber_source_merged_spec/models/card129.rb', line 85

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

  XmlUtilities.add_as_subelement(doc, root, 'number', number)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end