Class: DearInventoryRuby::Customer
- Inherits:
-
Object
- Object
- DearInventoryRuby::Customer
- Defined in:
- lib/dear-inventory-ruby/models/customer.rb
Instance Attribute Summary collapse
-
#account_receivable ⇒ Object
Account receivable code of Customer.
-
#additional_attribute1 ⇒ Object
Additional attribute 1 value.
-
#additional_attribute10 ⇒ Object
Additional attribute 10 value.
-
#additional_attribute2 ⇒ Object
Additional attribute 2 value.
-
#additional_attribute3 ⇒ Object
Additional attribute 3 value.
-
#additional_attribute4 ⇒ Object
Additional attribute 4 value.
-
#additional_attribute5 ⇒ Object
Additional attribute 5 value.
-
#additional_attribute6 ⇒ Object
Additional attribute 6 value.
-
#additional_attribute7 ⇒ Object
Additional attribute 7 value.
-
#additional_attribute8 ⇒ Object
Additional attribute 8 value.
-
#additional_attribute9 ⇒ Object
Additional attribute 9 value.
-
#addresses ⇒ Object
List of addresses.
-
#attribute_set ⇒ Object
AttributeSet name.
-
#carrier ⇒ Object
Carrier name.
-
#comments ⇒ Object
Comments.
-
#contacts ⇒ Object
List of contacts.
-
#credit_limit ⇒ Object
Credit limit.
-
#currency ⇒ Object
Currency code of Customer.
-
#discount ⇒ Object
Discount must be between 0% and 100%.
-
#id ⇒ Object
Unique Customer ID.
-
#is_on_credit_hold ⇒ Object
boolean to indicate if a customer is on credit hold.
-
#last_modified_on ⇒ Object
Date of last modification.
-
#location ⇒ Object
Location.
-
#name ⇒ Object
Name of Customer.
-
#payment_term ⇒ Object
Payment term.
-
#price_tier ⇒ Object
Price tier.
-
#revenue_account ⇒ Object
Sale account code of Customer.
-
#sales_representative ⇒ Object
Sales representative.
-
#status ⇒ Object
Points that Customer is Active.
-
#tags ⇒ Object
Tags string.
-
#tax_number ⇒ Object
Tax number.
-
#tax_rule ⇒ Object
Tax rule name.
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 = {}) ⇒ Customer
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 = {}) ⇒ Customer
Initializes the object
197 198 199 200 201 202 203 204 205 206 207 208 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 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 340 341 342 343 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 197 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::Customer` 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 `DearInventoryRuby::Customer`. 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?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'currency') self.currency = attributes[:'currency'] end if attributes.key?(:'payment_term') self.payment_term = attributes[:'payment_term'] end if attributes.key?(:'account_receivable') self.account_receivable = attributes[:'account_receivable'] end if attributes.key?(:'revenue_account') self.revenue_account = attributes[:'revenue_account'] end if attributes.key?(:'tax_rule') self.tax_rule = attributes[:'tax_rule'] end if attributes.key?(:'price_tier') self.price_tier = attributes[:'price_tier'] end if attributes.key?(:'carrier') self.carrier = attributes[:'carrier'] end if attributes.key?(:'sales_representative') self.sales_representative = attributes[:'sales_representative'] end if attributes.key?(:'location') self.location = attributes[:'location'] end if attributes.key?(:'discount') self.discount = attributes[:'discount'] end if attributes.key?(:'comments') self.comments = attributes[:'comments'] end if attributes.key?(:'tax_number') self.tax_number = attributes[:'tax_number'] end if attributes.key?(:'credit_limit') self.credit_limit = attributes[:'credit_limit'] end if attributes.key?(:'is_on_credit_hold') self.is_on_credit_hold = attributes[:'is_on_credit_hold'] else self.is_on_credit_hold = false end if attributes.key?(:'tags') self. = attributes[:'tags'] end if attributes.key?(:'attribute_set') self.attribute_set = attributes[:'attribute_set'] end if attributes.key?(:'additional_attribute1') self.additional_attribute1 = attributes[:'additional_attribute1'] end if attributes.key?(:'additional_attribute2') self.additional_attribute2 = attributes[:'additional_attribute2'] end if attributes.key?(:'additional_attribute3') self.additional_attribute3 = attributes[:'additional_attribute3'] end if attributes.key?(:'additional_attribute4') self.additional_attribute4 = attributes[:'additional_attribute4'] end if attributes.key?(:'additional_attribute5') self.additional_attribute5 = attributes[:'additional_attribute5'] end if attributes.key?(:'additional_attribute6') self.additional_attribute6 = attributes[:'additional_attribute6'] end if attributes.key?(:'additional_attribute7') self.additional_attribute7 = attributes[:'additional_attribute7'] end if attributes.key?(:'additional_attribute8') self.additional_attribute8 = attributes[:'additional_attribute8'] end if attributes.key?(:'additional_attribute9') self.additional_attribute9 = attributes[:'additional_attribute9'] end if attributes.key?(:'additional_attribute10') self.additional_attribute10 = attributes[:'additional_attribute10'] end if attributes.key?(:'last_modified_on') self.last_modified_on = attributes[:'last_modified_on'] end if attributes.key?(:'addresses') if (value = attributes[:'addresses']).is_a?(Array) self.addresses = value end end if attributes.key?(:'contacts') if (value = attributes[:'contacts']).is_a?(Array) self.contacts = value end end end |
Instance Attribute Details
#account_receivable ⇒ Object
Account receivable code of Customer
33 34 35 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 33 def account_receivable @account_receivable end |
#additional_attribute1 ⇒ Object
Additional attribute 1 value
75 76 77 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 75 def additional_attribute1 @additional_attribute1 end |
#additional_attribute10 ⇒ Object
Additional attribute 10 value
102 103 104 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 102 def additional_attribute10 @additional_attribute10 end |
#additional_attribute2 ⇒ Object
Additional attribute 2 value
78 79 80 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 78 def additional_attribute2 @additional_attribute2 end |
#additional_attribute3 ⇒ Object
Additional attribute 3 value
81 82 83 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 81 def additional_attribute3 @additional_attribute3 end |
#additional_attribute4 ⇒ Object
Additional attribute 4 value
84 85 86 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 84 def additional_attribute4 @additional_attribute4 end |
#additional_attribute5 ⇒ Object
Additional attribute 5 value
87 88 89 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 87 def additional_attribute5 @additional_attribute5 end |
#additional_attribute6 ⇒ Object
Additional attribute 6 value
90 91 92 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 90 def additional_attribute6 @additional_attribute6 end |
#additional_attribute7 ⇒ Object
Additional attribute 7 value
93 94 95 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 93 def additional_attribute7 @additional_attribute7 end |
#additional_attribute8 ⇒ Object
Additional attribute 8 value
96 97 98 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 96 def additional_attribute8 @additional_attribute8 end |
#additional_attribute9 ⇒ Object
Additional attribute 9 value
99 100 101 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 99 def additional_attribute9 @additional_attribute9 end |
#addresses ⇒ Object
List of addresses
108 109 110 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 108 def addresses @addresses end |
#attribute_set ⇒ Object
AttributeSet name
72 73 74 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 72 def attribute_set @attribute_set end |
#carrier ⇒ Object
Carrier name
45 46 47 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 45 def carrier @carrier end |
#comments ⇒ Object
Comments
57 58 59 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 57 def comments @comments end |
#contacts ⇒ Object
List of contacts
111 112 113 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 111 def contacts @contacts end |
#credit_limit ⇒ Object
Credit limit
63 64 65 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 63 def credit_limit @credit_limit end |
#currency ⇒ Object
Currency code of Customer
27 28 29 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 27 def currency @currency end |
#discount ⇒ Object
Discount must be between 0% and 100%
54 55 56 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 54 def discount @discount end |
#id ⇒ Object
Unique Customer ID
18 19 20 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 18 def id @id end |
#is_on_credit_hold ⇒ Object
boolean to indicate if a customer is on credit hold
66 67 68 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 66 def is_on_credit_hold @is_on_credit_hold end |
#last_modified_on ⇒ Object
Date of last modification
105 106 107 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 105 def last_modified_on @last_modified_on end |
#location ⇒ Object
Location
51 52 53 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 51 def location @location end |
#name ⇒ Object
Name of Customer
21 22 23 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 21 def name @name end |
#payment_term ⇒ Object
Payment term
30 31 32 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 30 def payment_term @payment_term end |
#price_tier ⇒ Object
Price tier
42 43 44 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 42 def price_tier @price_tier end |
#revenue_account ⇒ Object
Sale account code of Customer
36 37 38 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 36 def revenue_account @revenue_account end |
#sales_representative ⇒ Object
Sales representative
48 49 50 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 48 def sales_representative @sales_representative end |
#status ⇒ Object
Points that Customer is Active. Available values are Active and Deprecated. Required for POST
24 25 26 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 24 def status @status end |
#tags ⇒ Object
Tags string
69 70 71 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 69 def @tags end |
#tax_number ⇒ Object
Tax number
60 61 62 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 60 def tax_number @tax_number end |
#tax_rule ⇒ Object
Tax rule name
39 40 41 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 39 def tax_rule @tax_rule end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
114 115 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 147 148 149 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 114 def self.attribute_map { :'id' => :'ID', :'name' => :'Name', :'status' => :'Status', :'currency' => :'Currency', :'payment_term' => :'PaymentTerm', :'account_receivable' => :'AccountReceivable', :'revenue_account' => :'RevenueAccount', :'tax_rule' => :'TaxRule', :'price_tier' => :'PriceTier', :'carrier' => :'Carrier', :'sales_representative' => :'SalesRepresentative', :'location' => :'Location', :'discount' => :'Discount', :'comments' => :'Comments', :'tax_number' => :'TaxNumber', :'credit_limit' => :'CreditLimit', :'is_on_credit_hold' => :'IsOnCreditHold', :'tags' => :'Tags', :'attribute_set' => :'AttributeSet', :'additional_attribute1' => :'AdditionalAttribute1', :'additional_attribute2' => :'AdditionalAttribute2', :'additional_attribute3' => :'AdditionalAttribute3', :'additional_attribute4' => :'AdditionalAttribute4', :'additional_attribute5' => :'AdditionalAttribute5', :'additional_attribute6' => :'AdditionalAttribute6', :'additional_attribute7' => :'AdditionalAttribute7', :'additional_attribute8' => :'AdditionalAttribute8', :'additional_attribute9' => :'AdditionalAttribute9', :'additional_attribute10' => :'AdditionalAttribute10', :'last_modified_on' => :'LastModifiedOn', :'addresses' => :'Addresses', :'contacts' => :'Contacts' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
447 448 449 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 447 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
190 191 192 193 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 190 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 152 def self.openapi_types { :'id' => :'String', :'name' => :'String', :'status' => :'String', :'currency' => :'String', :'payment_term' => :'String', :'account_receivable' => :'String', :'revenue_account' => :'String', :'tax_rule' => :'String', :'price_tier' => :'String', :'carrier' => :'String', :'sales_representative' => :'String', :'location' => :'String', :'discount' => :'Float', :'comments' => :'String', :'tax_number' => :'String', :'credit_limit' => :'Float', :'is_on_credit_hold' => :'Boolean', :'tags' => :'String', :'attribute_set' => :'String', :'additional_attribute1' => :'String', :'additional_attribute2' => :'String', :'additional_attribute3' => :'String', :'additional_attribute4' => :'String', :'additional_attribute5' => :'String', :'additional_attribute6' => :'String', :'additional_attribute7' => :'String', :'additional_attribute8' => :'String', :'additional_attribute9' => :'String', :'additional_attribute10' => :'String', :'last_modified_on' => :'String', :'addresses' => :'Array<SupplierCustomerAddress>', :'contacts' => :'Array<Contact>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 395 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && status == o.status && currency == o.currency && payment_term == o.payment_term && account_receivable == o.account_receivable && revenue_account == o.revenue_account && tax_rule == o.tax_rule && price_tier == o.price_tier && carrier == o.carrier && sales_representative == o.sales_representative && location == o.location && discount == o.discount && comments == o.comments && tax_number == o.tax_number && credit_limit == o.credit_limit && is_on_credit_hold == o.is_on_credit_hold && == o. && attribute_set == o.attribute_set && additional_attribute1 == o.additional_attribute1 && additional_attribute2 == o.additional_attribute2 && additional_attribute3 == o.additional_attribute3 && additional_attribute4 == o.additional_attribute4 && additional_attribute5 == o.additional_attribute5 && additional_attribute6 == o.additional_attribute6 && additional_attribute7 == o.additional_attribute7 && additional_attribute8 == o.additional_attribute8 && additional_attribute9 == o.additional_attribute9 && additional_attribute10 == o.additional_attribute10 && last_modified_on == o.last_modified_on && addresses == o.addresses && contacts == o.contacts end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 475 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 DearInventoryRuby.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
544 545 546 547 548 549 550 551 552 553 554 555 556 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 544 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
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 454 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
434 435 436 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 434 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
440 441 442 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 440 def hash [id, name, status, currency, payment_term, account_receivable, revenue_account, tax_rule, price_tier, carrier, sales_representative, location, discount, comments, tax_number, credit_limit, is_on_credit_hold, , attribute_set, additional_attribute1, additional_attribute2, additional_attribute3, additional_attribute4, additional_attribute5, additional_attribute6, additional_attribute7, additional_attribute8, additional_attribute9, additional_attribute10, last_modified_on, addresses, contacts].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 376 377 378 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 347 def list_invalid_properties invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end if @payment_term.nil? invalid_properties.push('invalid value for "payment_term", payment_term cannot be nil.') end if @account_receivable.nil? invalid_properties.push('invalid value for "account_receivable", account_receivable cannot be nil.') end if @revenue_account.nil? invalid_properties.push('invalid value for "revenue_account", revenue_account cannot be nil.') end if @tax_rule.nil? invalid_properties.push('invalid value for "tax_rule", tax_rule cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
520 521 522 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 520 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
526 527 528 529 530 531 532 533 534 535 536 537 538 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 526 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
514 515 516 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 514 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
382 383 384 385 386 387 388 389 390 391 |
# File 'lib/dear-inventory-ruby/models/customer.rb', line 382 def valid? return false if @name.nil? return false if @status.nil? return false if @currency.nil? return false if @payment_term.nil? return false if @account_receivable.nil? return false if @revenue_account.nil? return false if @tax_rule.nil? true end |