Class: NewStoreApi::InjectedOrderAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::InjectedOrderAddress
- Defined in:
- lib/new_store_api/models/injected_order_address.rb
Overview
InjectedOrderAddress Model.
Instance Attribute Summary collapse
-
#address_line_1 ⇒ String
TODO: Write general description for this method.
-
#address_line_2 ⇒ String
TODO: Write general description for this method.
-
#city ⇒ String
TODO: Write general description for this method.
-
#country ⇒ String
The code of the country in the ISO ALPHA-2 format.
-
#first_name ⇒ String
The code of the country in the ISO ALPHA-2 format.
-
#last_name ⇒ String
The code of the country in the ISO ALPHA-2 format.
-
#phone ⇒ String
The code of the country in the ISO ALPHA-2 format.
-
#salutation ⇒ String
The code of the country in the ISO ALPHA-2 format.
-
#state ⇒ String
The code of the country in the ISO ALPHA-2 format.
-
#suffix ⇒ String
The code of the country in the ISO ALPHA-2 format.
-
#title ⇒ String
The code of the country in the ISO ALPHA-2 format.
-
#zip_code ⇒ String
The code of the country in the ISO ALPHA-2 format.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(address_line_1 = nil, country = nil, address_line_2 = SKIP, city = SKIP, first_name = SKIP, last_name = SKIP, phone = SKIP, salutation = SKIP, state = SKIP, suffix = SKIP, title = SKIP, zip_code = SKIP) ⇒ InjectedOrderAddress
constructor
A new instance of InjectedOrderAddress.
-
#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(address_line_1 = nil, country = nil, address_line_2 = SKIP, city = SKIP, first_name = SKIP, last_name = SKIP, phone = SKIP, salutation = SKIP, state = SKIP, suffix = SKIP, title = SKIP, zip_code = SKIP) ⇒ InjectedOrderAddress
Returns a new instance of InjectedOrderAddress.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 99 def initialize(address_line_1 = nil, country = nil, address_line_2 = SKIP, city = SKIP, first_name = SKIP, last_name = SKIP, phone = SKIP, salutation = SKIP, state = SKIP, suffix = SKIP, title = SKIP, zip_code = SKIP) @address_line_1 = address_line_1 @address_line_2 = address_line_2 unless address_line_2 == SKIP @city = city unless city == SKIP @country = country @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @phone = phone unless phone == SKIP @salutation = salutation unless salutation == SKIP @state = state unless state == SKIP @suffix = suffix unless suffix == SKIP @title = title unless title == SKIP @zip_code = zip_code unless zip_code == SKIP end |
Instance Attribute Details
#address_line_1 ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 14 def address_line_1 @address_line_1 end |
#address_line_2 ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 18 def address_line_2 @address_line_2 end |
#city ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 22 def city @city end |
#country ⇒ String
The code of the country in the ISO ALPHA-2 format.
26 27 28 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 26 def country @country end |
#first_name ⇒ String
The code of the country in the ISO ALPHA-2 format.
30 31 32 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 30 def first_name @first_name end |
#last_name ⇒ String
The code of the country in the ISO ALPHA-2 format.
34 35 36 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 34 def last_name @last_name end |
#phone ⇒ String
The code of the country in the ISO ALPHA-2 format.
38 39 40 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 38 def phone @phone end |
#salutation ⇒ String
The code of the country in the ISO ALPHA-2 format.
42 43 44 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 42 def salutation @salutation end |
#state ⇒ String
The code of the country in the ISO ALPHA-2 format.
46 47 48 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 46 def state @state end |
#suffix ⇒ String
The code of the country in the ISO ALPHA-2 format.
50 51 52 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 50 def suffix @suffix end |
#title ⇒ String
The code of the country in the ISO ALPHA-2 format.
54 55 56 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 54 def title @title end |
#zip_code ⇒ String
The code of the country in the ISO ALPHA-2 format.
58 59 60 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 58 def zip_code @zip_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 118 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. address_line_1 = hash.key?('address_line_1') ? hash['address_line_1'] : nil country = hash.key?('country') ? hash['country'] : nil address_line_2 = hash.key?('address_line_2') ? hash['address_line_2'] : SKIP city = hash.key?('city') ? hash['city'] : SKIP first_name = hash.key?('first_name') ? hash['first_name'] : SKIP last_name = hash.key?('last_name') ? hash['last_name'] : SKIP phone = hash.key?('phone') ? hash['phone'] : SKIP salutation = hash.key?('salutation') ? hash['salutation'] : SKIP state = hash.key?('state') ? hash['state'] : SKIP suffix = hash.key?('suffix') ? hash['suffix'] : SKIP title = hash.key?('title') ? hash['title'] : SKIP zip_code = hash.key?('zip_code') ? hash['zip_code'] : SKIP # Create object from extracted values. InjectedOrderAddress.new(address_line_1, country, address_line_2, city, first_name, last_name, phone, salutation, state, suffix, title, zip_code) end |
.names ⇒ Object
A mapping from model property names to API property names.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 61 def self.names @_hash = {} if @_hash.nil? @_hash['address_line_1'] = 'address_line_1' @_hash['address_line_2'] = 'address_line_2' @_hash['city'] = 'city' @_hash['country'] = 'country' @_hash['first_name'] = 'first_name' @_hash['last_name'] = 'last_name' @_hash['phone'] = 'phone' @_hash['salutation'] = 'salutation' @_hash['state'] = 'state' @_hash['suffix'] = 'suffix' @_hash['title'] = 'title' @_hash['zip_code'] = 'zip_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
95 96 97 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 95 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 79 def self.optionals %w[ address_line_2 city first_name last_name phone salutation state suffix title zip_code ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 154 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.address_line_1, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.country, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['address_line_1'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['country'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
184 185 186 187 188 189 190 191 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 184 def inspect class_name = self.class.name.split('::').last "<#{class_name} address_line_1: #{@address_line_1.inspect}, address_line_2:"\ " #{@address_line_2.inspect}, city: #{@city.inspect}, country: #{@country.inspect},"\ " first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect}, phone:"\ " #{@phone.inspect}, salutation: #{@salutation.inspect}, state: #{@state.inspect}, suffix:"\ " #{@suffix.inspect}, title: #{@title.inspect}, zip_code: #{@zip_code.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
175 176 177 178 179 180 181 |
# File 'lib/new_store_api/models/injected_order_address.rb', line 175 def to_s class_name = self.class.name.split('::').last "<#{class_name} address_line_1: #{@address_line_1}, address_line_2: #{@address_line_2},"\ " city: #{@city}, country: #{@country}, first_name: #{@first_name}, last_name:"\ " #{@last_name}, phone: #{@phone}, salutation: #{@salutation}, state: #{@state}, suffix:"\ " #{@suffix}, title: #{@title}, zip_code: #{@zip_code}>" end |