Class: VisaAcceptanceMergedSpec::Card14
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::Card14
- Defined in:
- lib/visa_acceptance_merged_spec/models/card14.rb
Overview
Card object used to create a network token
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).
-
#suffix ⇒ String
The customer’s latest payment card number suffix.
-
#type ⇒ String
The type of card (Card Network).
Class Method Summary collapse
-
.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, suffix: SKIP, additional_properties: nil) ⇒ Card14
constructor
A new instance of Card14.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the 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, suffix: SKIP, additional_properties: nil) ⇒ Card14
Returns a new instance of Card14.
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 65 def initialize(number: SKIP, expiration_month: SKIP, expiration_year: SKIP, type: SKIP, suffix: 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 @suffix = suffix unless suffix == 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.
21 22 23 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 21 def expiration_month @expiration_month end |
#expiration_year ⇒ String
Four-digit year in which the credit card expires.
Format: YYYY.
26 27 28 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 26 def expiration_year @expiration_year end |
#number ⇒ String
The customer’s payment card number, also known as the Primary Account Number (PAN).
15 16 17 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 15 def number @number end |
#suffix ⇒ String
The customer’s latest payment card number suffix.
36 37 38 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 36 def suffix @suffix end |
#type ⇒ String
The type of card (Card Network). Possible Values:
- 001: visa
32 33 34 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 32 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 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 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 79 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 suffix = hash.key?('suffix') ? hash['suffix'] : 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. Card14.new(number: number, expiration_month: expiration_month, expiration_year: expiration_year, type: type, suffix: suffix, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['number'] = 'number' @_hash['expiration_month'] = 'expirationMonth' @_hash['expiration_year'] = 'expirationYear' @_hash['type'] = 'type' @_hash['suffix'] = 'suffix' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 50 def self.optionals %w[ number expiration_month expiration_year type suffix ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
116 117 118 119 120 121 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 116 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}, suffix:"\ " #{@suffix.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
108 109 110 111 112 113 |
# File 'lib/visa_acceptance_merged_spec/models/card14.rb', line 108 def to_s class_name = self.class.name.split('::').last "<#{class_name} number: #{@number}, expiration_month: #{@expiration_month},"\ " expiration_year: #{@expiration_year}, type: #{@type}, suffix: #{@suffix},"\ " additional_properties: #{@additional_properties}>" end |