Class: NewStoreApi::RequestRecipientAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::RequestRecipientAddress
- Defined in:
- lib/new_store_api/models/request_recipient_address.rb
Overview
RequestRecipientAddress 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.
-
#company ⇒ String
TODO: Write general description for this method.
-
#country_code ⇒ String
TODO: Write general description for this method.
-
#email ⇒ String
TODO: Write general description for this method.
-
#first_name ⇒ String
TODO: Write general description for this method.
-
#last_name ⇒ String
TODO: Write general description for this method.
-
#phone ⇒ String
TODO: Write general description for this method.
-
#state ⇒ String
TODO: Write general description for this method.
-
#zip_code ⇒ String
TODO: Write general description for this method.
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(address_line_1 = nil, city = nil, country_code = nil, address_line_2 = SKIP, company = SKIP, email = SKIP, first_name = SKIP, last_name = SKIP, phone = SKIP, state = SKIP, zip_code = SKIP) ⇒ RequestRecipientAddress
constructor
A new instance of RequestRecipientAddress.
-
#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, city = nil, country_code = nil, address_line_2 = SKIP, company = SKIP, email = SKIP, first_name = SKIP, last_name = SKIP, phone = SKIP, state = SKIP, zip_code = SKIP) ⇒ RequestRecipientAddress
Returns a new instance of RequestRecipientAddress.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 98 def initialize(address_line_1 = nil, city = nil, country_code = nil, address_line_2 = SKIP, company = SKIP, email = SKIP, first_name = SKIP, last_name = SKIP, phone = SKIP, state = SKIP, zip_code = SKIP) @address_line_1 = address_line_1 @address_line_2 = address_line_2 unless address_line_2 == SKIP @city = city @company = company unless company == SKIP @country_code = country_code @email = email unless email == SKIP @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @phone = phone unless phone == SKIP @state = state unless state == 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/request_recipient_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/request_recipient_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/request_recipient_address.rb', line 22 def city @city end |
#company ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 26 def company @company end |
#country_code ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 30 def country_code @country_code end |
#email ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 34 def email @email end |
#first_name ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 38 def first_name @first_name end |
#last_name ⇒ String
TODO: Write general description for this method
42 43 44 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 42 def last_name @last_name end |
#phone ⇒ String
TODO: Write general description for this method
46 47 48 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 46 def phone @phone end |
#state ⇒ String
TODO: Write general description for this method
50 51 52 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 50 def state @state end |
#zip_code ⇒ String
TODO: Write general description for this method
54 55 56 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 54 def zip_code @zip_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
116 117 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 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 116 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 city = hash.key?('city') ? hash['city'] : nil country_code = hash.key?('country_code') ? hash['country_code'] : nil address_line_2 = hash.key?('address_line_2') ? hash['address_line_2'] : SKIP company = hash.key?('company') ? hash['company'] : SKIP email = hash.key?('email') ? hash['email'] : 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 state = hash.key?('state') ? hash['state'] : SKIP zip_code = hash.key?('zip_code') ? hash['zip_code'] : SKIP # Create object from extracted values. RequestRecipientAddress.new(address_line_1, city, country_code, address_line_2, company, email, first_name, last_name, phone, state, zip_code) end |
.names ⇒ Object
A mapping from model property names to API property names.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 57 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['company'] = 'company' @_hash['country_code'] = 'country_code' @_hash['email'] = 'email' @_hash['first_name'] = 'first_name' @_hash['last_name'] = 'last_name' @_hash['phone'] = 'phone' @_hash['state'] = 'state' @_hash['zip_code'] = 'zip_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
88 89 90 91 92 93 94 95 96 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 88 def self.nullables %w[ address_line_2 company email state zip_code ] end |
.optionals ⇒ Object
An array for optional fields
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 74 def self.optionals %w[ address_line_2 company email first_name last_name phone state zip_code ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
158 159 160 161 162 163 164 165 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 158 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}, company: #{@company.inspect},"\ " country_code: #{@country_code.inspect}, email: #{@email.inspect}, first_name:"\ " #{@first_name.inspect}, last_name: #{@last_name.inspect}, phone: #{@phone.inspect}, state:"\ " #{@state.inspect}, zip_code: #{@zip_code.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
149 150 151 152 153 154 155 |
# File 'lib/new_store_api/models/request_recipient_address.rb', line 149 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}, company: #{@company}, country_code: #{@country_code}, email: #{@email},"\ " first_name: #{@first_name}, last_name: #{@last_name}, phone: #{@phone}, state: #{@state},"\ " zip_code: #{@zip_code}>" end |