Class: CyberSourceMergedSpec::TokenizedCard19

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

Overview

TokenizedCard19 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(cryptogram: SKIP, expiration_month: SKIP, expiration_year: SKIP, number: SKIP, security_code: SKIP, type: SKIP, additional_properties: nil) ⇒ TokenizedCard19

Returns a new instance of TokenizedCard19.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 81

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

  @cryptogram = cryptogram unless cryptogram == SKIP
  @expiration_month = expiration_month unless expiration_month == SKIP
  @expiration_year = expiration_year unless expiration_year == SKIP
  @number = number unless number == SKIP
  @security_code = security_code unless security_code == SKIP
  @type = type unless type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#cryptogramString

This field contains token cryptogram information

Returns:

  • (String)


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

def cryptogram
  @cryptogram
end

#expiration_monthString

One of two possible meanings: The two-digit month in which a token expires. The two-digit month in which a card expires. Format: MM Possible values: 01 through 12

Returns:

  • (String)


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

def expiration_month
  @expiration_month
end

#expiration_yearString

One of two possible meanings: The four-digit year in which a token expires. The four-digit year in which a card expires. Format: YYYY Possible values: 1900 through 3000 Data type: Non-negative integer

Returns:

  • (String)


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

def expiration_year
  @expiration_year
end

#numberString

Customer’s payment network token value.

Returns:

  • (String)


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

def number
  @number
end

#security_codeString

Card Verification Number (CVN).

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 39

def security_code
  @security_code
end

#typeString

Three-digit value that indicates the card type. Mandatory if not present in a token. Possible values:

  • 001: Visa
  • 002: Mastercard, Eurocard, which is a European regional brand of Mastercard.
  • 033: Visa Electron
  • 024: Maestro

Returns:

  • (String)


50
51
52
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 50

def type
  @type
end

Class Method Details

.from_element(root) ⇒ Object



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 127

def self.from_element(root)
  cryptogram = XmlUtilities.from_element(root, 'cryptogram', String)
  expiration_month = XmlUtilities.from_element(root, 'expirationMonth',
                                               String)
  expiration_year = XmlUtilities.from_element(root, 'expirationYear',
                                              String)
  number = XmlUtilities.from_element(root, 'number', String)
  security_code = XmlUtilities.from_element(root, 'securityCode', String)
  type = XmlUtilities.from_element(root, 'type', String)

  new(cryptogram: cryptogram,
      expiration_month: expiration_month,
      expiration_year: expiration_year,
      number: number,
      security_code: security_code,
      type: type,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  cryptogram = hash.key?('cryptogram') ? hash['cryptogram'] : SKIP
  expiration_month =
    hash.key?('expirationMonth') ? hash['expirationMonth'] : SKIP
  expiration_year =
    hash.key?('expirationYear') ? hash['expirationYear'] : SKIP
  number = hash.key?('number') ? hash['number'] : SKIP
  security_code = hash.key?('securityCode') ? hash['securityCode'] : SKIP
  type = hash.key?('type') ? hash['type'] : 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.
  TokenizedCard19.new(cryptogram: cryptogram,
                      expiration_month: expiration_month,
                      expiration_year: expiration_year,
                      number: number,
                      security_code: security_code,
                      type: type,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['cryptogram'] = 'cryptogram'
  @_hash['expiration_month'] = 'expirationMonth'
  @_hash['expiration_year'] = 'expirationYear'
  @_hash['number'] = 'number'
  @_hash['security_code'] = 'securityCode'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



77
78
79
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 77

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
68
69
70
71
72
73
74
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 65

def self.optionals
  %w[
    cryptogram
    expiration_month
    expiration_year
    number
    security_code
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



172
173
174
175
176
177
178
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 172

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

#to_sObject

Provides a human-readable string representation of the object.



164
165
166
167
168
169
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 164

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

#to_xml_element(doc, root_name) ⇒ Object



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/cyber_source_merged_spec/models/tokenized_card19.rb', line 146

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

  XmlUtilities.add_as_subelement(doc, root, 'cryptogram', cryptogram)
  XmlUtilities.add_as_subelement(doc, root, 'expirationMonth',
                                 expiration_month)
  XmlUtilities.add_as_subelement(doc, root, 'expirationYear',
                                 expiration_year)
  XmlUtilities.add_as_subelement(doc, root, 'number', number)
  XmlUtilities.add_as_subelement(doc, root, 'securityCode', security_code)
  XmlUtilities.add_as_subelement(doc, root, 'type', type)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end