Class: VisaAcceptanceMergedSpec::ShipTo1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::ShipTo1
- Defined in:
- lib/visa_acceptance_merged_spec/models/ship_to1.rb
Overview
ShipTo1 Model.
Instance Attribute Summary collapse
-
#address1 ⇒ String
First line of the shipping address.
-
#address2 ⇒ String
Second line of the shipping address.
-
#administrative_area ⇒ String
State or province of shipping address.
-
#country ⇒ String
Country of shipping address.
-
#firstname ⇒ String
First name of the recipient.
-
#lastname ⇒ String
Last name of the recipient.
-
#locality ⇒ String
City of the shipping address.
-
#phone_number ⇒ String
Phone number of the recipient.
-
#postal_code ⇒ String
Postal code of the shipping address.
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(firstname: SKIP, lastname: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, phone_number: SKIP, additional_properties: nil) ⇒ ShipTo1
constructor
A new instance of ShipTo1.
-
#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(firstname: SKIP, lastname: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, phone_number: SKIP, additional_properties: nil) ⇒ ShipTo1
Returns a new instance of ShipTo1.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 85 def initialize(firstname: SKIP, lastname: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, phone_number: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @firstname = firstname unless firstname == SKIP @lastname = lastname unless lastname == 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 @phone_number = phone_number unless phone_number == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#address1 ⇒ String
First line of the shipping address.
22 23 24 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 22 def address1 @address1 end |
#address2 ⇒ String
Second line of the shipping address.
26 27 28 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 26 def address2 @address2 end |
#administrative_area ⇒ String
State or province of shipping address. This is a State, Province, and Territory Codes for the United States and Canada.
35 36 37 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 35 def administrative_area @administrative_area end |
#country ⇒ String
Country of shipping address. This is a two-character ISO Standard Country Codes.
44 45 46 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 44 def country @country end |
#firstname ⇒ String
First name of the recipient.
14 15 16 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 14 def firstname @firstname end |
#lastname ⇒ String
Last name of the recipient.
18 19 20 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 18 def lastname @lastname end |
#locality ⇒ String
City of the shipping address.
30 31 32 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 30 def locality @locality end |
#phone_number ⇒ String
Phone number of the recipient.
48 49 50 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 48 def phone_number @phone_number end |
#postal_code ⇒ String
Postal code of the shipping address. Consists of 5 to 9 digits.
39 40 41 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 39 def postal_code @postal_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 105 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. firstname = hash.key?('firstname') ? hash['firstname'] : SKIP lastname = hash.key?('lastname') ? hash['lastname'] : 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 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. ShipTo1.new(firstname: firstname, lastname: lastname, address1: address1, address2: address2, locality: locality, administrative_area: administrative_area, postal_code: postal_code, country: country, phone_number: phone_number, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['firstname'] = 'firstname' @_hash['lastname'] = 'lastname' @_hash['address1'] = 'address1' @_hash['address2'] = 'address2' @_hash['locality'] = 'locality' @_hash['administrative_area'] = 'administrativeArea' @_hash['postal_code'] = 'postalCode' @_hash['country'] = 'country' @_hash['phone_number'] = 'phoneNumber' @_hash end |
.nullables ⇒ Object
An array for nullable fields
81 82 83 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 81 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 66 def self.optionals %w[ firstname lastname address1 address2 locality administrative_area postal_code country phone_number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
150 151 152 153 154 155 156 157 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 150 def inspect class_name = self.class.name.split('::').last "<#{class_name} firstname: #{@firstname.inspect}, lastname: #{@lastname.inspect}, address1:"\ " #{@address1.inspect}, address2: #{@address2.inspect}, locality: #{@locality.inspect},"\ " administrative_area: #{@administrative_area.inspect}, postal_code:"\ " #{@postal_code.inspect}, country: #{@country.inspect}, phone_number:"\ " #{@phone_number.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
141 142 143 144 145 146 147 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to1.rb', line 141 def to_s class_name = self.class.name.split('::').last "<#{class_name} firstname: #{@firstname}, lastname: #{@lastname}, address1: #{@address1},"\ " address2: #{@address2}, locality: #{@locality}, administrative_area:"\ " #{@administrative_area}, postal_code: #{@postal_code}, country: #{@country}, phone_number:"\ " #{@phone_number}, additional_properties: #{@additional_properties}>" end |