Class: Zippendo::CreateAddressRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zippendo::CreateAddressRequest
- Defined in:
- lib/zippendo/models/create_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.
-
#city ⇒ Object
City.
-
#country_code ⇒ Object
Country code (ISO 2 or 3 letter).
-
#customs ⇒ Object
Customs identifiers (voec, eori, sprn, ioss, fda, duns).
-
#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 = {}) ⇒ CreateAddressRequest
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 = {}) ⇒ CreateAddressRequest
Initializes the object
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 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 206 207 208 209 210 211 |
# File 'lib/zippendo/models/create_address_request.rb', line 130 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateAddressRequest` 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::CreateAddressRequest`. 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'] else self.name = nil end if attributes.key?(:'att_contact') self.att_contact = attributes[:'att_contact'] else self.att_contact = nil end if attributes.key?(:'address1') self.address1 = attributes[:'address1'] else self.address1 = nil end if attributes.key?(:'address2') self.address2 = attributes[:'address2'] end if attributes.key?(:'zipcode') self.zipcode = attributes[:'zipcode'] else self.zipcode = nil end if attributes.key?(:'city') self.city = attributes[:'city'] else self.city = nil end if attributes.key?(:'phone') self.phone = attributes[:'phone'] else self.phone = nil end if attributes.key?(:'country_code') self.country_code = attributes[:'country_code'] else self.country_code = nil end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'email') self.email = attributes[:'email'] else self.email = nil 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 end |
Instance Attribute Details
#address1 ⇒ Object
Address line 1
25 26 27 |
# File 'lib/zippendo/models/create_address_request.rb', line 25 def address1 @address1 end |
#address2 ⇒ Object
Address line 2
28 29 30 |
# File 'lib/zippendo/models/create_address_request.rb', line 28 def address2 @address2 end |
#address_types ⇒ Object
Address types (sender, pickup, return)
52 53 54 |
# File 'lib/zippendo/models/create_address_request.rb', line 52 def address_types @address_types end |
#att_contact ⇒ Object
Attention contact person
22 23 24 |
# File 'lib/zippendo/models/create_address_request.rb', line 22 def att_contact @att_contact end |
#city ⇒ Object
City
34 35 36 |
# File 'lib/zippendo/models/create_address_request.rb', line 34 def city @city end |
#country_code ⇒ Object
Country code (ISO 2 or 3 letter)
40 41 42 |
# File 'lib/zippendo/models/create_address_request.rb', line 40 def country_code @country_code end |
#customs ⇒ Object
Customs identifiers (voec, eori, sprn, ioss, fda, duns)
49 50 51 |
# File 'lib/zippendo/models/create_address_request.rb', line 49 def customs @customs end |
#email ⇒ Object
Email address
46 47 48 |
# File 'lib/zippendo/models/create_address_request.rb', line 46 def email @email end |
#name ⇒ Object
Name of the address
19 20 21 |
# File 'lib/zippendo/models/create_address_request.rb', line 19 def name @name end |
#phone ⇒ Object
Phone number
37 38 39 |
# File 'lib/zippendo/models/create_address_request.rb', line 37 def phone @phone end |
#state ⇒ Object
State/Province
43 44 45 |
# File 'lib/zippendo/models/create_address_request.rb', line 43 def state @state end |
#zipcode ⇒ Object
Postal/ZIP code
31 32 33 |
# File 'lib/zippendo/models/create_address_request.rb', line 31 def zipcode @zipcode end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
95 96 97 |
# File 'lib/zippendo/models/create_address_request.rb', line 95 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
100 101 102 |
# File 'lib/zippendo/models/create_address_request.rb', line 100 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/zippendo/models/create_address_request.rb', line 77 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' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
# File 'lib/zippendo/models/create_address_request.rb', line 470 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
123 124 125 126 |
# File 'lib/zippendo/models/create_address_request.rb', line 123 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/zippendo/models/create_address_request.rb', line 105 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>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/zippendo/models/create_address_request.rb', line 438 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 end |
#eql?(o) ⇒ Boolean
457 458 459 |
# File 'lib/zippendo/models/create_address_request.rb', line 457 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
463 464 465 |
# File 'lib/zippendo/models/create_address_request.rb', line 463 def hash [name, att_contact, address1, address2, zipcode, city, phone, country_code, state, email, customs, address_types].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/zippendo/models/create_address_request.rb', line 215 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @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? invalid_properties.push('invalid value for "att_contact", att_contact cannot be nil.') end if @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? invalid_properties.push('invalid value for "address1", address1 cannot be nil.') end if @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? invalid_properties.push('invalid value for "zipcode", zipcode cannot be nil.') end if @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? invalid_properties.push('invalid value for "city", city cannot be nil.') end if @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? invalid_properties.push('invalid value for "phone", phone cannot be nil.') end if @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? invalid_properties.push('invalid value for "country_code", country_code cannot be nil.') end if @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.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 @email.nil? invalid_properties.push('invalid value for "email", email cannot be nil.') 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 !~ 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 invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/zippendo/models/create_address_request.rb', line 492 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
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/zippendo/models/create_address_request.rb', line 296 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? return false if @name.to_s.length < 1 return false if @att_contact.nil? return false if @att_contact.to_s.length < 1 return false if @address1.nil? return false if @address1.to_s.length < 1 return false if @zipcode.nil? return false if @zipcode.to_s.length < 1 return false if @city.nil? return false if @city.to_s.length < 1 return false if @phone.nil? return false if @phone.to_s.length < 1 return false if @country_code.nil? return false if @country_code.to_s.length > 3 return false if @country_code.to_s.length < 2 return false if @email.nil? return false if @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 true end |