Class: CyberSourceMergedSpec::Card127
- Defined in:
- lib/cyber_source_merged_spec/models/card127.rb
Overview
Card127 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 payment card expires.
-
#number ⇒ String
The customer’s payment card number, also known as the Primary Account Number (PAN).
-
#security_code ⇒ String
3-digit value that indicates the cardCvv2Value.
-
#type ⇒ String
Three-digit 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(type: SKIP, security_code: SKIP, number: SKIP, expiration_month: SKIP, expiration_year: SKIP, additional_properties: nil) ⇒ Card127
constructor
A new instance of Card127.
-
#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(type: SKIP, security_code: SKIP, number: SKIP, expiration_month: SKIP, expiration_year: SKIP, additional_properties: nil) ⇒ Card127
Returns a new instance of Card127.
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 75 def initialize(type: SKIP, security_code: SKIP, number: SKIP, expiration_month: SKIP, expiration_year: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @type = type unless type == SKIP @security_code = security_code unless security_code == SKIP @number = number unless number == SKIP @expiration_month = expiration_month unless expiration_month == SKIP @expiration_year = expiration_year unless expiration_year == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#expiration_month ⇒ String
Two-digit month in which the payment card expires.
Format: MM.
Valid values: 01 through 12. Leading 0 is required.
Conditional: this field is required if using neither a Customer nor
Payment Instrument token.
39 40 41 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 39 def expiration_month @expiration_month end |
#expiration_year ⇒ String
Four-digit year in which the payment card expires.
Format: YYYY.
Conditional: this field is required if using neither a Customer nor
Payment Instrument token.
46 47 48 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 46 def expiration_year @expiration_year end |
#number ⇒ String
The customer’s payment card number, also known as the Primary Account Number (PAN). Conditional: this field is required if not using tokens.
31 32 33 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 31 def number @number end |
#security_code ⇒ String
3-digit value that indicates the cardCvv2Value. Values can be 0-9.
25 26 27 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 25 def security_code @security_code end |
#type ⇒ String
Three-digit value that indicates the card type. Mandatory if not present in a token. Possible values:
001: Visa002: Mastercard, Eurocard, which is a European regional brand of Mastercard.033: Visa Electron024: Maestro
21 22 23 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 21 def type @type end |
Class Method Details
.from_element(root) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 118 def self.from_element(root) type = XmlUtilities.from_element(root, 'type', String) security_code = XmlUtilities.from_element(root, 'securityCode', String) number = XmlUtilities.from_element(root, 'number', String) expiration_month = XmlUtilities.from_element(root, 'expirationMonth', String) expiration_year = XmlUtilities.from_element(root, 'expirationYear', String) new(type: type, security_code: security_code, number: number, expiration_month: expiration_month, expiration_year: expiration_year, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 90 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. type = hash.key?('type') ? hash['type'] : SKIP security_code = hash.key?('securityCode') ? hash['securityCode'] : SKIP number = hash.key?('number') ? hash['number'] : SKIP expiration_month = hash.key?('expirationMonth') ? hash['expirationMonth'] : SKIP expiration_year = hash.key?('expirationYear') ? hash['expirationYear'] : 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. Card127.new(type: type, security_code: security_code, number: number, expiration_month: expiration_month, expiration_year: expiration_year, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['type'] = 'type' @_hash['security_code'] = 'securityCode' @_hash['number'] = 'number' @_hash['expiration_month'] = 'expirationMonth' @_hash['expiration_year'] = 'expirationYear' @_hash end |
.nullables ⇒ Object
An array for nullable fields
71 72 73 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 71 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 60 def self.optionals %w[ type security_code number expiration_month expiration_year ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
160 161 162 163 164 165 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 160 def inspect class_name = self.class.name.split('::').last "<#{class_name} type: #{@type.inspect}, security_code: #{@security_code.inspect}, number:"\ " #{@number.inspect}, expiration_month: #{@expiration_month.inspect}, expiration_year:"\ " #{@expiration_year.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
152 153 154 155 156 157 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 152 def to_s class_name = self.class.name.split('::').last "<#{class_name} type: #{@type}, security_code: #{@security_code}, number: #{@number},"\ " expiration_month: #{@expiration_month}, expiration_year: #{@expiration_year},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/cyber_source_merged_spec/models/card127.rb', line 135 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'type', type) XmlUtilities.add_as_subelement(doc, root, 'securityCode', security_code) 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, 'additional_properties', additional_properties) root end |