Class: OpenapiClient::ConnectUpsRequestBody
- Inherits:
-
Object
- Object
- OpenapiClient::ConnectUpsRequestBody
- Defined in:
- lib/openapi_client/models/connect_ups_request_body.rb
Overview
A UPS account information request body
Instance Attribute Summary collapse
-
#account_country_code ⇒ Object
Account country code.
-
#account_number ⇒ Object
Account number.
-
#account_postal_code ⇒ Object
Account postal code.
-
#address1 ⇒ Object
Address Line 1.
-
#address2 ⇒ Object
Address Line 2.
-
#agree_to_technology_agreement ⇒ Object
The Agreement to the [UPS Technology Agreement](www.ups.com/assets/resources/media/UTA_with_EUR.pdf).
-
#city ⇒ Object
City.
-
#company ⇒ Object
Company.
-
#country_code ⇒ Object
Country code.
-
#email ⇒ Object
The email address.
-
#first_name ⇒ Object
First name.
-
#invoice ⇒ Object
The UPS invoice.
-
#last_name ⇒ Object
Last name.
-
#nickname ⇒ Object
Nickname.
-
#phone ⇒ Object
Phone.
-
#postal_code ⇒ Object
Postal code.
-
#state ⇒ Object
State.
-
#title ⇒ Object
Title.
Class Method Summary collapse
-
.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.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ConnectUpsRequestBody
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ConnectUpsRequestBody
Initializes the object
128 129 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 212 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 128 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ConnectUpsRequestBody` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::ConnectUpsRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'nickname') self.nickname = attributes[:'nickname'] end if attributes.key?(:'account_number') self.account_number = attributes[:'account_number'] end if attributes.key?(:'account_country_code') self.account_country_code = attributes[:'account_country_code'] end if attributes.key?(:'account_postal_code') self.account_postal_code = attributes[:'account_postal_code'] end if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.key?(:'company') self.company = attributes[:'company'] end if attributes.key?(:'address1') self.address1 = attributes[:'address1'] end if attributes.key?(:'address2') self.address2 = attributes[:'address2'] end if attributes.key?(:'city') self.city = attributes[:'city'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'postal_code') self.postal_code = attributes[:'postal_code'] end if attributes.key?(:'country_code') self.country_code = attributes[:'country_code'] end if attributes.key?(:'email') self.email = attributes[:'email'] end if attributes.key?(:'phone') self.phone = attributes[:'phone'] end if attributes.key?(:'invoice') self.invoice = attributes[:'invoice'] end if attributes.key?(:'agree_to_technology_agreement') self.agree_to_technology_agreement = attributes[:'agree_to_technology_agreement'] end end |
Instance Attribute Details
#account_country_code ⇒ Object
Account country code
25 26 27 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 25 def account_country_code @account_country_code end |
#account_number ⇒ Object
Account number
22 23 24 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 22 def account_number @account_number end |
#account_postal_code ⇒ Object
Account postal code
28 29 30 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 28 def account_postal_code @account_postal_code end |
#address1 ⇒ Object
Address Line 1
43 44 45 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 43 def address1 @address1 end |
#address2 ⇒ Object
Address Line 2
46 47 48 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 46 def address2 @address2 end |
#agree_to_technology_agreement ⇒ Object
The Agreement to the [UPS Technology Agreement](www.ups.com/assets/resources/media/UTA_with_EUR.pdf)
70 71 72 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 70 def agree_to_technology_agreement @agree_to_technology_agreement end |
#city ⇒ Object
City
49 50 51 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 49 def city @city end |
#company ⇒ Object
Company
40 41 42 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 40 def company @company end |
#country_code ⇒ Object
Country code
58 59 60 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 58 def country_code @country_code end |
#email ⇒ Object
The email address
61 62 63 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 61 def email @email end |
#first_name ⇒ Object
First name
34 35 36 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 34 def first_name @first_name end |
#invoice ⇒ Object
The UPS invoice
67 68 69 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 67 def invoice @invoice end |
#last_name ⇒ Object
Last name
37 38 39 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 37 def last_name @last_name end |
#nickname ⇒ Object
Nickname
19 20 21 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 19 def nickname @nickname end |
#phone ⇒ Object
Phone
64 65 66 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 64 def phone @phone end |
#postal_code ⇒ Object
Postal code
55 56 57 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 55 def postal_code @postal_code end |
#state ⇒ Object
State
52 53 54 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 52 def state @state end |
#title ⇒ Object
Title
31 32 33 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 31 def title @title end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 73 def self.attribute_map { :'nickname' => :'nickname', :'account_number' => :'account_number', :'account_country_code' => :'account_country_code', :'account_postal_code' => :'account_postal_code', :'title' => :'title', :'first_name' => :'first_name', :'last_name' => :'last_name', :'company' => :'company', :'address1' => :'address1', :'address2' => :'address2', :'city' => :'city', :'state' => :'state', :'postal_code' => :'postal_code', :'country_code' => :'country_code', :'email' => :'email', :'phone' => :'phone', :'invoice' => :'invoice', :'agree_to_technology_agreement' => :'agree_to_technology_agreement' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
619 620 621 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 619 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
121 122 123 124 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 121 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 97 def self.openapi_types { :'nickname' => :'String', :'account_number' => :'String', :'account_country_code' => :'String', :'account_postal_code' => :'String', :'title' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'company' => :'String', :'address1' => :'String', :'address2' => :'String', :'city' => :'String', :'state' => :'String', :'postal_code' => :'String', :'country_code' => :'String', :'email' => :'String', :'phone' => :'String', :'invoice' => :'UpsInvoice', :'agree_to_technology_agreement' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 581 def ==(o) return true if self.equal?(o) self.class == o.class && nickname == o.nickname && account_number == o.account_number && account_country_code == o.account_country_code && account_postal_code == o.account_postal_code && title == o.title && first_name == o.first_name && last_name == o.last_name && company == o.company && address1 == o.address1 && address2 == o.address2 && city == o.city && state == o.state && postal_code == o.postal_code && country_code == o.country_code && email == o.email && phone == o.phone && invoice == o.invoice && agree_to_technology_agreement == o.agree_to_technology_agreement end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 647 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model OpenapiClient.const_get(type).build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
716 717 718 719 720 721 722 723 724 725 726 727 728 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 716 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 626 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if 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[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
606 607 608 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 606 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
612 613 614 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 612 def hash [nickname, account_number, account_country_code, account_postal_code, title, first_name, last_name, company, address1, address2, city, state, postal_code, country_code, email, phone, invoice, agree_to_technology_agreement].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 216 def list_invalid_properties invalid_properties = Array.new if @nickname.nil? invalid_properties.push('invalid value for "nickname", nickname cannot be nil.') end if @nickname.to_s.length < 1 invalid_properties.push('invalid value for "nickname", the character length must be great than or equal to 1.') end if @account_number.nil? invalid_properties.push('invalid value for "account_number", account_number cannot be nil.') end if @account_number.to_s.length < 1 invalid_properties.push('invalid value for "account_number", the character length must be great than or equal to 1.') end if @account_country_code.nil? invalid_properties.push('invalid value for "account_country_code", account_country_code cannot be nil.') end if @account_country_code.to_s.length < 1 invalid_properties.push('invalid value for "account_country_code", the character length must be great than or equal to 1.') end if @account_postal_code.nil? invalid_properties.push('invalid value for "account_postal_code", account_postal_code cannot be nil.') end if @account_postal_code.to_s.length < 1 invalid_properties.push('invalid value for "account_postal_code", the character length must be great than or equal to 1.') end if !@title.nil? && @title.to_s.length < 1 invalid_properties.push('invalid value for "title", the character length must be great than or equal to 1.') end if @first_name.nil? invalid_properties.push('invalid value for "first_name", first_name cannot be nil.') end if @first_name.to_s.length < 1 invalid_properties.push('invalid value for "first_name", the character length must be great than or equal to 1.') end if @last_name.nil? invalid_properties.push('invalid value for "last_name", last_name cannot be nil.') end if @last_name.to_s.length < 1 invalid_properties.push('invalid value for "last_name", the character length must be great than or equal to 1.') end if @company.nil? invalid_properties.push('invalid value for "company", company cannot be nil.') end if @company.to_s.length < 1 invalid_properties.push('invalid value for "company", the character length must be great 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 great than or equal to 1.') end if !@address2.nil? && @address2.to_s.length < 1 invalid_properties.push('invalid value for "address2", the character length must be great 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 great than or equal to 1.') end if @state.nil? invalid_properties.push('invalid value for "state", state cannot be nil.') end if @state.to_s.length < 1 invalid_properties.push('invalid value for "state", the character length must be great than or equal to 1.') end if @postal_code.nil? invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.') end if @postal_code.to_s.length < 1 invalid_properties.push('invalid value for "postal_code", the character length must be great 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 < 1 invalid_properties.push('invalid value for "country_code", the character length must be great than or equal to 1.') end if @email.nil? invalid_properties.push('invalid value for "email", email cannot be nil.') 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 great than or equal to 1.') end if @agree_to_technology_agreement.nil? invalid_properties.push('invalid value for "agree_to_technology_agreement", agree_to_technology_agreement cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
692 693 694 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 692 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
698 699 700 701 702 703 704 705 706 707 708 709 710 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 698 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 |
#to_s ⇒ String
Returns the string representation of the object
686 687 688 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 686 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/openapi_client/models/connect_ups_request_body.rb', line 343 def valid? return false if @nickname.nil? return false if @nickname.to_s.length < 1 return false if @account_number.nil? return false if @account_number.to_s.length < 1 return false if @account_country_code.nil? return false if @account_country_code.to_s.length < 1 return false if @account_postal_code.nil? return false if @account_postal_code.to_s.length < 1 return false if !@title.nil? && @title.to_s.length < 1 return false if @first_name.nil? return false if @first_name.to_s.length < 1 return false if @last_name.nil? return false if @last_name.to_s.length < 1 return false if @company.nil? return false if @company.to_s.length < 1 return false if @address1.nil? return false if @address1.to_s.length < 1 return false if !@address2.nil? && @address2.to_s.length < 1 return false if @city.nil? return false if @city.to_s.length < 1 return false if @state.nil? return false if @state.to_s.length < 1 return false if @postal_code.nil? return false if @postal_code.to_s.length < 1 return false if @country_code.nil? return false if @country_code.to_s.length < 1 return false if @email.nil? return false if @phone.nil? return false if @phone.to_s.length < 1 return false if @agree_to_technology_agreement.nil? true end |