Class: Zippendo::UpdateAddressRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zippendo::UpdateAddressRequest
- Defined in:
- lib/zippendo/models/update_address_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#address1 ⇒ Object
Address line 1.
-
#address2 ⇒ Object
Address line 2.
-
#address_types ⇒ Object
Address types (sender, pickup, return).
-
#att_contact ⇒ Object
Attention contact person.
-
#brand_id ⇒ Object
Brand this record is assigned to; null (or omitted outside a brand session) keeps it organization-wide.
-
#city ⇒ Object
City.
-
#country_code ⇒ Object
ISO country code.
-
#customs ⇒ Object
Customs identifiers.
-
#email ⇒ Object
Email address.
-
#name ⇒ Object
Name of the address.
-
#phone ⇒ Object
Phone number.
-
#state ⇒ Object
State/Province.
-
#zipcode ⇒ Object
Postal/ZIP code.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ UpdateAddressRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ UpdateAddressRequest
Initializes the object
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 168 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 197 198 199 200 201 202 203 204 205 |
# File 'lib/zippendo/models/update_address_request.rb', line 136 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::UpdateAddressRequest` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::UpdateAddressRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'att_contact') self.att_contact = attributes[:'att_contact'] end if attributes.key?(:'address1') self.address1 = attributes[:'address1'] end if attributes.key?(:'address2') self.address2 = attributes[:'address2'] end if attributes.key?(:'zipcode') self.zipcode = attributes[:'zipcode'] end if attributes.key?(:'city') self.city = attributes[:'city'] end if attributes.key?(:'phone') self.phone = attributes[:'phone'] end if attributes.key?(:'country_code') self.country_code = attributes[:'country_code'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'email') self.email = attributes[:'email'] end if attributes.key?(:'customs') if (value = attributes[:'customs']).is_a?(Hash) self.customs = value end end if attributes.key?(:'address_types') if (value = attributes[:'address_types']).is_a?(Array) self.address_types = value end end if attributes.key?(:'brand_id') self.brand_id = attributes[:'brand_id'] end end |
Instance Attribute Details
#address1 ⇒ Object
Address line 1
25 26 27 |
# File 'lib/zippendo/models/update_address_request.rb', line 25 def address1 @address1 end |
#address2 ⇒ Object
Address line 2
28 29 30 |
# File 'lib/zippendo/models/update_address_request.rb', line 28 def address2 @address2 end |
#address_types ⇒ Object
Address types (sender, pickup, return)
52 53 54 |
# File 'lib/zippendo/models/update_address_request.rb', line 52 def address_types @address_types end |
#att_contact ⇒ Object
Attention contact person
22 23 24 |
# File 'lib/zippendo/models/update_address_request.rb', line 22 def att_contact @att_contact end |
#brand_id ⇒ Object
Brand this record is assigned to; null (or omitted outside a brand session) keeps it organization-wide
55 56 57 |
# File 'lib/zippendo/models/update_address_request.rb', line 55 def brand_id @brand_id end |
#city ⇒ Object
City
34 35 36 |
# File 'lib/zippendo/models/update_address_request.rb', line 34 def city @city end |
#country_code ⇒ Object
ISO country code
40 41 42 |
# File 'lib/zippendo/models/update_address_request.rb', line 40 def country_code @country_code end |
#customs ⇒ Object
Customs identifiers
49 50 51 |
# File 'lib/zippendo/models/update_address_request.rb', line 49 def customs @customs end |
#email ⇒ Object
Email address
46 47 48 |
# File 'lib/zippendo/models/update_address_request.rb', line 46 def email @email end |
#name ⇒ Object
Name of the address
19 20 21 |
# File 'lib/zippendo/models/update_address_request.rb', line 19 def name @name end |
#phone ⇒ Object
Phone number
37 38 39 |
# File 'lib/zippendo/models/update_address_request.rb', line 37 def phone @phone end |
#state ⇒ Object
State/Province
43 44 45 |
# File 'lib/zippendo/models/update_address_request.rb', line 43 def state @state end |
#zipcode ⇒ Object
Postal/ZIP code
31 32 33 |
# File 'lib/zippendo/models/update_address_request.rb', line 31 def zipcode @zipcode end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
99 100 101 |
# File 'lib/zippendo/models/update_address_request.rb', line 99 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
104 105 106 |
# File 'lib/zippendo/models/update_address_request.rb', line 104 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/zippendo/models/update_address_request.rb', line 80 def self.attribute_map { :'name' => :'name', :'att_contact' => :'attContact', :'address1' => :'address1', :'address2' => :'address2', :'zipcode' => :'zipcode', :'city' => :'city', :'phone' => :'phone', :'country_code' => :'countryCode', :'state' => :'state', :'email' => :'email', :'customs' => :'customs', :'address_types' => :'addressTypes', :'brand_id' => :'brandId' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
# File 'lib/zippendo/models/update_address_request.rb', line 459 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
128 129 130 131 132 |
# File 'lib/zippendo/models/update_address_request.rb', line 128 def self.openapi_nullable Set.new([ :'brand_id' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/zippendo/models/update_address_request.rb', line 109 def self.openapi_types { :'name' => :'String', :'att_contact' => :'String', :'address1' => :'String', :'address2' => :'String', :'zipcode' => :'String', :'city' => :'String', :'phone' => :'String', :'country_code' => :'String', :'state' => :'String', :'email' => :'String', :'customs' => :'Hash<String, String>', :'address_types' => :'Array<String>', :'brand_id' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/zippendo/models/update_address_request.rb', line 426 def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && att_contact == o.att_contact && address1 == o.address1 && address2 == o.address2 && zipcode == o.zipcode && city == o.city && phone == o.phone && country_code == o.country_code && state == o.state && email == o.email && customs == o.customs && address_types == o.address_types && brand_id == o.brand_id end |
#eql?(o) ⇒ Boolean
446 447 448 |
# File 'lib/zippendo/models/update_address_request.rb', line 446 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
452 453 454 |
# File 'lib/zippendo/models/update_address_request.rb', line 452 def hash [name, att_contact, address1, address2, zipcode, city, phone, country_code, state, email, customs, address_types, brand_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/zippendo/models/update_address_request.rb', line 209 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@name.nil? && @name.to_s.length < 1 invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end if !@att_contact.nil? && @att_contact.to_s.length < 1 invalid_properties.push('invalid value for "att_contact", the character length must be greater than or equal to 1.') end if !@address1.nil? && @address1.to_s.length < 1 invalid_properties.push('invalid value for "address1", the character length must be greater than or equal to 1.') end if !@zipcode.nil? && @zipcode.to_s.length < 1 invalid_properties.push('invalid value for "zipcode", the character length must be greater than or equal to 1.') end if !@city.nil? && @city.to_s.length < 1 invalid_properties.push('invalid value for "city", the character length must be greater than or equal to 1.') end if !@phone.nil? && @phone.to_s.length < 1 invalid_properties.push('invalid value for "phone", the character length must be greater than or equal to 1.') end if !@country_code.nil? && @country_code.to_s.length > 3 invalid_properties.push('invalid value for "country_code", the character length must be smaller than or equal to 3.') end if !@country_code.nil? && @country_code.to_s.length < 2 invalid_properties.push('invalid value for "country_code", the character length must be greater than or equal to 2.') end if !@state.nil? && @state.to_s.length < 1 invalid_properties.push('invalid value for "state", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/) if !@email.nil? && @email !~ pattern invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.") end if !@address_types.nil? && @address_types.length < 1 invalid_properties.push('invalid value for "address_types", number of items must be greater than or equal to 1.') end if !@brand_id.nil? && @brand_id.to_s.length < 1 invalid_properties.push('invalid value for "brand_id", the character length must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/zippendo/models/update_address_request.rb', line 481 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/zippendo/models/update_address_request.rb', line 266 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@name.nil? && @name.to_s.length < 1 return false if !@att_contact.nil? && @att_contact.to_s.length < 1 return false if !@address1.nil? && @address1.to_s.length < 1 return false if !@zipcode.nil? && @zipcode.to_s.length < 1 return false if !@city.nil? && @city.to_s.length < 1 return false if !@phone.nil? && @phone.to_s.length < 1 return false if !@country_code.nil? && @country_code.to_s.length > 3 return false if !@country_code.nil? && @country_code.to_s.length < 2 return false if !@state.nil? && @state.to_s.length < 1 return false if !@email.nil? && @email !~ Regexp.new(/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/) return false if !@address_types.nil? && @address_types.length < 1 return false if !@brand_id.nil? && @brand_id.to_s.length < 1 true end |