Class: VisaAcceptanceMergedSpec::Card2
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::Card2
- Defined in:
- lib/visa_acceptance_merged_spec/models/card2.rb
Overview
Card2 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).
-
#security_code ⇒ String
Card Verification Code.
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, security_code: SKIP, additional_properties: nil) ⇒ Card2
constructor
A new instance of Card2.
-
#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, security_code: SKIP, additional_properties: nil) ⇒ Card2
Returns a new instance of Card2.
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/visa_acceptance_merged_spec/models/card2.rb', line 61 def initialize(number: SKIP, expiration_month: SKIP, expiration_year: SKIP, security_code: 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 @security_code = security_code unless security_code == 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/visa_acceptance_merged_spec/models/card2.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/visa_acceptance_merged_spec/models/card2.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/visa_acceptance_merged_spec/models/card2.rb', line 16 def number @number end |
#security_code ⇒ String
Card Verification Code. This value is sent to the issuer to support the approval of a network token provision. It is not persisted against the Instrument Identifier.
34 35 36 |
# File 'lib/visa_acceptance_merged_spec/models/card2.rb', line 34 def security_code @security_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/visa_acceptance_merged_spec/models/card2.rb', line 74 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 security_code = hash.key?('securityCode') ? hash['securityCode'] : 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. Card2.new(number: number, expiration_month: expiration_month, expiration_year: expiration_year, security_code: security_code, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 |
# File 'lib/visa_acceptance_merged_spec/models/card2.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['number'] = 'number' @_hash['expiration_month'] = 'expirationMonth' @_hash['expiration_year'] = 'expirationYear' @_hash['security_code'] = 'securityCode' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 |
# File 'lib/visa_acceptance_merged_spec/models/card2.rb', line 57 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 50 51 52 53 54 |
# File 'lib/visa_acceptance_merged_spec/models/card2.rb', line 47 def self.optionals %w[ number expiration_month expiration_year security_code ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
109 110 111 112 113 114 |
# File 'lib/visa_acceptance_merged_spec/models/card2.rb', line 109 def inspect class_name = self.class.name.split('::').last "<#{class_name} number: #{@number.inspect}, expiration_month: #{@expiration_month.inspect},"\ " expiration_year: #{@expiration_year.inspect}, security_code: #{@security_code.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
101 102 103 104 105 106 |
# File 'lib/visa_acceptance_merged_spec/models/card2.rb', line 101 def to_s class_name = self.class.name.split('::').last "<#{class_name} number: #{@number}, expiration_month: #{@expiration_month},"\ " expiration_year: #{@expiration_year}, security_code: #{@security_code},"\ " additional_properties: #{@additional_properties}>" end |