Class: CyberSourceMergedSpec::BillTo15
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::BillTo15
- Defined in:
- lib/cyber_source_merged_spec/models/bill_to15.rb
Overview
BillTo15 Model.
Instance Attribute Summary collapse
-
#address1 ⇒ String
Payment card billing street address as it appears on the credit card issuer’s records.
-
#address2 ⇒ String
Additional address information.
-
#administrative_area ⇒ String
State or province of the billing address.
-
#company ⇒ String
Name of the customer’s company.
-
#country ⇒ String
Payment card billing country.
-
#email ⇒ String
Customer's email address, including the full domain name.
-
#first_name ⇒ String
Customer’s first name.
-
#last_name ⇒ String
Customer’s last name.
-
#locality ⇒ String
Payment card billing city.
-
#phone_number ⇒ String
Customer’s phone number.
-
#postal_code ⇒ String
Postal code for the billing address.
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(first_name: SKIP, last_name: SKIP, company: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, email: SKIP, phone_number: SKIP, additional_properties: nil) ⇒ BillTo15
constructor
A new instance of BillTo15.
-
#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(first_name: SKIP, last_name: SKIP, company: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, email: SKIP, phone_number: SKIP, additional_properties: nil) ⇒ BillTo15
Returns a new instance of BillTo15.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 108 def initialize(first_name: SKIP, last_name: SKIP, company: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, email: SKIP, phone_number: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @company = company unless company == SKIP @address1 = address1 unless address1 == SKIP @address2 = address2 unless address2 == SKIP @locality = locality unless locality == SKIP @administrative_area = administrative_area unless administrative_area == SKIP @postal_code = postal_code unless postal_code == SKIP @country = country unless country == SKIP @email = email unless email == SKIP @phone_number = phone_number unless phone_number == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#address1 ⇒ String
Payment card billing street address as it appears on the credit card issuer’s records.
27 28 29 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 27 def address1 @address1 end |
#address2 ⇒ String
Additional address information.
31 32 33 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 31 def address2 @address2 end |
#administrative_area ⇒ String
State or province of the billing address. Use the State, Province, and Territory Codes for the United States and Canada.
41 42 43 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 41 def administrative_area @administrative_area end |
#company ⇒ String
Name of the customer’s company.
22 23 24 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 22 def company @company end |
#country ⇒ String
Payment card billing country. Use the two-character ISO Standard Country Codes.
59 60 61 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 59 def country @country end |
#email ⇒ String
Customer's email address, including the full domain name.
63 64 65 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 63 def email @email end |
#first_name ⇒ String
Customer’s first name. This name must be the same as the name on the card.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 14 def first_name @first_name end |
#last_name ⇒ String
Customer’s last name. This name must be the same as the name on the card.
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 18 def last_name @last_name end |
#locality ⇒ String
Payment card billing city.
35 36 37 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 35 def locality @locality end |
#phone_number ⇒ String
Customer’s phone number.
67 68 69 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 67 def phone_number @phone_number end |
#postal_code ⇒ String
Postal code for the billing address. The postal code must consist of 5 to
9 digits.
When the billing country is the U.S., the 9-digit postal code must follow
this format:
[5 digits][dash][4 digits]
Example 12345-6789
When the billing country is Canada, the 6-digit postal code must follow
this format:
[alpha][numeric][alpha][space][numeric][alpha][numeric]
Example A1B 2C3
54 55 56 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 54 def postal_code @postal_code end |
Class Method Details
.from_element(root) ⇒ Object
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 169 def self.from_element(root) first_name = XmlUtilities.from_element(root, 'firstName', String) last_name = XmlUtilities.from_element(root, 'lastName', String) company = XmlUtilities.from_element(root, 'company', String) address1 = XmlUtilities.from_element(root, 'address1', String) address2 = XmlUtilities.from_element(root, 'address2', String) locality = XmlUtilities.from_element(root, 'locality', String) administrative_area = XmlUtilities.from_element(root, 'administrativeArea', String) postal_code = XmlUtilities.from_element(root, 'postalCode', String) country = XmlUtilities.from_element(root, 'country', String) email = XmlUtilities.from_element(root, 'email', String) phone_number = XmlUtilities.from_element(root, 'phoneNumber', String) new(first_name: first_name, last_name: last_name, company: company, address1: address1, address2: address2, locality: locality, administrative_area: administrative_area, postal_code: postal_code, country: country, email: email, phone_number: phone_number, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 130 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. first_name = hash.key?('firstName') ? hash['firstName'] : SKIP last_name = hash.key?('lastName') ? hash['lastName'] : SKIP company = hash.key?('company') ? hash['company'] : SKIP address1 = hash.key?('address1') ? hash['address1'] : SKIP address2 = hash.key?('address2') ? hash['address2'] : SKIP locality = hash.key?('locality') ? hash['locality'] : SKIP administrative_area = hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP email = hash.key?('email') ? hash['email'] : SKIP phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : 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. BillTo15.new(first_name: first_name, last_name: last_name, company: company, address1: address1, address2: address2, locality: locality, administrative_area: administrative_area, postal_code: postal_code, country: country, email: email, phone_number: phone_number, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 70 def self.names @_hash = {} if @_hash.nil? @_hash['first_name'] = 'firstName' @_hash['last_name'] = 'lastName' @_hash['company'] = 'company' @_hash['address1'] = 'address1' @_hash['address2'] = 'address2' @_hash['locality'] = 'locality' @_hash['administrative_area'] = 'administrativeArea' @_hash['postal_code'] = 'postalCode' @_hash['country'] = 'country' @_hash['email'] = 'email' @_hash['phone_number'] = 'phoneNumber' @_hash end |
.nullables ⇒ Object
An array for nullable fields
104 105 106 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 104 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 87 def self.optionals %w[ first_name last_name company address1 address2 locality administrative_area postal_code country email phone_number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
230 231 232 233 234 235 236 237 238 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 230 def inspect class_name = self.class.name.split('::').last "<#{class_name} first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\ " company: #{@company.inspect}, address1: #{@address1.inspect}, address2:"\ " #{@address2.inspect}, locality: #{@locality.inspect}, administrative_area:"\ " #{@administrative_area.inspect}, postal_code: #{@postal_code.inspect}, country:"\ " #{@country.inspect}, email: #{@email.inspect}, phone_number: #{@phone_number.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
220 221 222 223 224 225 226 227 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 220 def to_s class_name = self.class.name.split('::').last "<#{class_name} first_name: #{@first_name}, last_name: #{@last_name}, company: #{@company},"\ " address1: #{@address1}, address2: #{@address2}, locality: #{@locality},"\ " administrative_area: #{@administrative_area}, postal_code: #{@postal_code}, country:"\ " #{@country}, email: #{@email}, phone_number: #{@phone_number}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/cyber_source_merged_spec/models/bill_to15.rb', line 198 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'firstName', first_name) XmlUtilities.add_as_subelement(doc, root, 'lastName', last_name) XmlUtilities.add_as_subelement(doc, root, 'company', company) XmlUtilities.add_as_subelement(doc, root, 'address1', address1) XmlUtilities.add_as_subelement(doc, root, 'address2', address2) XmlUtilities.add_as_subelement(doc, root, 'locality', locality) XmlUtilities.add_as_subelement(doc, root, 'administrativeArea', administrative_area) XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code) XmlUtilities.add_as_subelement(doc, root, 'country', country) XmlUtilities.add_as_subelement(doc, root, 'email', email) XmlUtilities.add_as_subelement(doc, root, 'phoneNumber', phone_number) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |