Class: CyberSourceMergedSpec::Card28
- Defined in:
- lib/cyber_source_merged_spec/models/card28.rb
Overview
Card28 Model.
Instance Attribute Summary collapse
-
#expiration_month ⇒ String
Two-digit month in which the payment card expires.
-
#expiration_year ⇒ String
Four-digit year in which the credit card expires.
-
#number ⇒ String
The customer’s payment card number, also known as the Primary Account Number (PAN).
-
#type ⇒ String
Value that indicates the card type.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(number: SKIP, expiration_month: SKIP, expiration_year: SKIP, type: SKIP, additional_properties: nil) ⇒ Card28
constructor
A new instance of Card28.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
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, expiration_month: SKIP, expiration_year: SKIP, type: SKIP, additional_properties: nil) ⇒ Card28
Returns a new instance of Card28.
114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 114 def initialize(number: SKIP, expiration_month: SKIP, expiration_year: SKIP, type: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @number = number unless number == SKIP @expiration_month = expiration_month unless expiration_month == SKIP @expiration_year = expiration_year unless expiration_year == SKIP @type = type unless type == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#expiration_month ⇒ String
Two-digit month in which the payment card expires.
Format: MM.
Possible Values: 01 through 12.
22 23 24 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 22 def expiration_month @expiration_month end |
#expiration_year ⇒ String
Four-digit year in which the credit card expires.
Format: YYYY.
27 28 29 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 27 def expiration_year @expiration_year end |
#number ⇒ String
The customer’s payment card number, also known as the Primary Account Number (PAN). You can also use this field for encoded account numbers.
16 17 18 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 16 def number @number end |
#type ⇒ String
Value that indicates the card type. Possible Values v2 : v1:
* 001 : visa
* 002 : mastercard - Eurocard—European regional brand of Mastercard
* 003 : american express
* 004 : discover
* 005 : diners club
* 006 : carte blanche
* 007 : jcb
* 008 : optima
* 011 : twinpay credit
* 012 : twinpay debit
* 013 : walmart
* 014 : enRoute
* 015 : lowes consumer
* 016 : home depot consumer
* 017 : mbna
* 018 : dicks sportswear
* 019 : casual corner
* 020 : sears
* 021 : jal
* 023 : disney
* 024 : maestro uk domestic
* 025 : sams club consumer
* 026 : sams club business
* 028 : bill me later
* 029 : bebe
* 030 : restoration hardware
* 031 : delta online — use this value only for Ingenico ePayments. For
other processors, use 001 for all Visa card types.
- 032 : solo
- 033 : visa electron
- 034 : dankort
- 035 : laser
- 036 : carte bleue — formerly Cartes Bancaires
- 037 : carta si
- 038 : pinless debit
- 039 : encoded account
- 040 : uatp
- 041 : household
- 042 : maestro international
- 043 : ge money uk
- 044 : korean cards
- 045 : style
- 046 : jcrew
- 047 : payease china processing ewallet
- 048 : payease china processing bank transfer
- 049 : meijer private label
- 050 : hipercard — supported only by the Comercio Latino processor.
- 051 : aura — supported only by the Comercio Latino processor.
- 052 : redecard
- 054 : elo — supported only by the Comercio Latino processor.
- 055 : capital one private label
- 056 : synchrony private label
- 057 : costco private label
- 060 : mada
- 062 : china union pay
- 063 : falabella private label
87 88 89 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 87 def type @type end |
Class Method Details
.from_element(root) ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 153 def self.from_element(root) number = XmlUtilities.from_element(root, 'number', String) expiration_month = XmlUtilities.from_element(root, 'expirationMonth', String) expiration_year = XmlUtilities.from_element(root, 'expirationYear', String) type = XmlUtilities.from_element(root, 'type', String) new(number: number, expiration_month: expiration_month, expiration_year: expiration_year, type: type, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 127 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. number = hash.key?('number') ? hash['number'] : SKIP expiration_month = hash.key?('expirationMonth') ? hash['expirationMonth'] : SKIP expiration_year = hash.key?('expirationYear') ? hash['expirationYear'] : 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. Card28.new(number: number, expiration_month: expiration_month, expiration_year: expiration_year, type: type, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
90 91 92 93 94 95 96 97 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 90 def self.names @_hash = {} if @_hash.nil? @_hash['number'] = 'number' @_hash['expiration_month'] = 'expirationMonth' @_hash['expiration_year'] = 'expirationYear' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
110 111 112 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 110 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
100 101 102 103 104 105 106 107 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 100 def self.optionals %w[ number expiration_month expiration_year type ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
192 193 194 195 196 197 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 192 def inspect class_name = self.class.name.split('::').last "<#{class_name} number: #{@number.inspect}, expiration_month: #{@expiration_month.inspect},"\ " expiration_year: #{@expiration_year.inspect}, type: #{@type.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
184 185 186 187 188 189 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 184 def to_s class_name = self.class.name.split('::').last "<#{class_name} number: #{@number}, expiration_month: #{@expiration_month},"\ " expiration_year: #{@expiration_year}, type: #{@type}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/cyber_source_merged_spec/models/card28.rb', line 168 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, 'expirationMonth', expiration_month) XmlUtilities.add_as_subelement(doc, root, 'expirationYear', expiration_year) XmlUtilities.add_as_subelement(doc, root, 'type', type) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |