Class: ConnectWise::Addition
- Inherits:
-
Object
- Object
- ConnectWise::Addition
- Defined in:
- lib/connectwise-ruby-sdk/models/addition.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_info ⇒ Object
Metadata of the entity.
-
#agreement_id ⇒ Object
Returns the value of attribute agreement_id.
-
#bill_customer ⇒ Object
Returns the value of attribute bill_customer.
-
#billed_quantity ⇒ Object
Returns the value of attribute billed_quantity.
-
#cancelled_date ⇒ Object
Returns the value of attribute cancelled_date.
-
#description ⇒ Object
Returns the value of attribute description.
-
#effective_date ⇒ Object
Returns the value of attribute effective_date.
-
#ext_cost ⇒ Object
Returns the value of attribute ext_cost.
-
#ext_price ⇒ Object
Returns the value of attribute ext_price.
-
#extended_prorate_cost ⇒ Object
Returns the value of attribute extended_prorate_cost.
-
#extended_prorate_price ⇒ Object
Returns the value of attribute extended_prorate_price.
-
#id ⇒ Object
Returns the value of attribute id.
-
#invoice_description ⇒ Object
Returns the value of attribute invoice_description.
-
#less_included ⇒ Object
Returns the value of attribute less_included.
-
#margin ⇒ Object
Returns the value of attribute margin.
-
#product ⇒ Object
Returns the value of attribute product.
-
#prorate_cost ⇒ Object
Returns the value of attribute prorate_cost.
-
#prorate_current_period_flag ⇒ Object
Returns the value of attribute prorate_current_period_flag.
-
#prorate_price ⇒ Object
Returns the value of attribute prorate_price.
-
#purchase_item_flag ⇒ Object
Returns the value of attribute purchase_item_flag.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#sequence_number ⇒ Object
Returns the value of attribute sequence_number.
-
#serial_number ⇒ Object
Returns the value of attribute serial_number.
-
#special_order_flag ⇒ Object
Returns the value of attribute special_order_flag.
-
#taxable_flag ⇒ Object
Returns the value of attribute taxable_flag.
-
#unit_cost ⇒ Object
Returns the value of attribute unit_cost.
-
#unit_price ⇒ Object
Returns the value of attribute unit_price.
-
#uom ⇒ Object
Returns the value of attribute uom.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_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 ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Addition
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 = {}) ⇒ Addition
Initializes the object
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 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 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 156 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'product') self.product = attributes[:'product'] end if attributes.has_key?(:'quantity') self.quantity = attributes[:'quantity'] end if attributes.has_key?(:'lessIncluded') self.less_included = attributes[:'lessIncluded'] end if attributes.has_key?(:'unitPrice') self.unit_price = attributes[:'unitPrice'] end if attributes.has_key?(:'unitCost') self.unit_cost = attributes[:'unitCost'] end if attributes.has_key?(:'billCustomer') self.bill_customer = attributes[:'billCustomer'] end if attributes.has_key?(:'effectiveDate') self.effective_date = attributes[:'effectiveDate'] end if attributes.has_key?(:'cancelledDate') self.cancelled_date = attributes[:'cancelledDate'] end if attributes.has_key?(:'taxableFlag') self.taxable_flag = attributes[:'taxableFlag'] end if attributes.has_key?(:'serialNumber') self.serial_number = attributes[:'serialNumber'] end if attributes.has_key?(:'invoiceDescription') self.invoice_description = attributes[:'invoiceDescription'] end if attributes.has_key?(:'purchaseItemFlag') self.purchase_item_flag = attributes[:'purchaseItemFlag'] end if attributes.has_key?(:'specialOrderFlag') self.special_order_flag = attributes[:'specialOrderFlag'] end if attributes.has_key?(:'agreementId') self.agreement_id = attributes[:'agreementId'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'billedQuantity') self.billed_quantity = attributes[:'billedQuantity'] end if attributes.has_key?(:'uom') self.uom = attributes[:'uom'] end if attributes.has_key?(:'extPrice') self.ext_price = attributes[:'extPrice'] end if attributes.has_key?(:'extCost') self.ext_cost = attributes[:'extCost'] end if attributes.has_key?(:'sequenceNumber') self.sequence_number = attributes[:'sequenceNumber'] end if attributes.has_key?(:'margin') self.margin = attributes[:'margin'] end if attributes.has_key?(:'prorateCost') self.prorate_cost = attributes[:'prorateCost'] end if attributes.has_key?(:'proratePrice') self.prorate_price = attributes[:'proratePrice'] end if attributes.has_key?(:'extendedProrateCost') self.extended_prorate_cost = attributes[:'extendedProrateCost'] end if attributes.has_key?(:'extendedProratePrice') self.extended_prorate_price = attributes[:'extendedProratePrice'] end if attributes.has_key?(:'prorateCurrentPeriodFlag') self.prorate_current_period_flag = attributes[:'prorateCurrentPeriodFlag'] end if attributes.has_key?(:'_info') self._info = attributes[:'_info'] end end |
Instance Attribute Details
#_info ⇒ Object
Metadata of the entity
62 63 64 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 62 def _info @_info end |
#agreement_id ⇒ Object
Returns the value of attribute agreement_id.
35 36 37 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 35 def agreement_id @agreement_id end |
#bill_customer ⇒ Object
Returns the value of attribute bill_customer.
19 20 21 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 19 def bill_customer @bill_customer end |
#billed_quantity ⇒ Object
Returns the value of attribute billed_quantity.
39 40 41 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 39 def billed_quantity @billed_quantity end |
#cancelled_date ⇒ Object
Returns the value of attribute cancelled_date.
23 24 25 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 23 def cancelled_date @cancelled_date end |
#description ⇒ Object
Returns the value of attribute description.
37 38 39 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 37 def description @description end |
#effective_date ⇒ Object
Returns the value of attribute effective_date.
21 22 23 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 21 def effective_date @effective_date end |
#ext_cost ⇒ Object
Returns the value of attribute ext_cost.
45 46 47 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 45 def ext_cost @ext_cost end |
#ext_price ⇒ Object
Returns the value of attribute ext_price.
43 44 45 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 43 def ext_price @ext_price end |
#extended_prorate_cost ⇒ Object
Returns the value of attribute extended_prorate_cost.
55 56 57 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 55 def extended_prorate_cost @extended_prorate_cost end |
#extended_prorate_price ⇒ Object
Returns the value of attribute extended_prorate_price.
57 58 59 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 57 def extended_prorate_price @extended_prorate_price end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 7 def id @id end |
#invoice_description ⇒ Object
Returns the value of attribute invoice_description.
29 30 31 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 29 def invoice_description @invoice_description end |
#less_included ⇒ Object
Returns the value of attribute less_included.
13 14 15 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 13 def less_included @less_included end |
#margin ⇒ Object
Returns the value of attribute margin.
49 50 51 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 49 def margin @margin end |
#product ⇒ Object
Returns the value of attribute product.
9 10 11 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 9 def product @product end |
#prorate_cost ⇒ Object
Returns the value of attribute prorate_cost.
51 52 53 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 51 def prorate_cost @prorate_cost end |
#prorate_current_period_flag ⇒ Object
Returns the value of attribute prorate_current_period_flag.
59 60 61 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 59 def prorate_current_period_flag @prorate_current_period_flag end |
#prorate_price ⇒ Object
Returns the value of attribute prorate_price.
53 54 55 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 53 def prorate_price @prorate_price end |
#purchase_item_flag ⇒ Object
Returns the value of attribute purchase_item_flag.
31 32 33 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 31 def purchase_item_flag @purchase_item_flag end |
#quantity ⇒ Object
Returns the value of attribute quantity.
11 12 13 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 11 def quantity @quantity end |
#sequence_number ⇒ Object
Returns the value of attribute sequence_number.
47 48 49 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 47 def sequence_number @sequence_number end |
#serial_number ⇒ Object
Returns the value of attribute serial_number.
27 28 29 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 27 def serial_number @serial_number end |
#special_order_flag ⇒ Object
Returns the value of attribute special_order_flag.
33 34 35 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 33 def special_order_flag @special_order_flag end |
#taxable_flag ⇒ Object
Returns the value of attribute taxable_flag.
25 26 27 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 25 def taxable_flag @taxable_flag end |
#unit_cost ⇒ Object
Returns the value of attribute unit_cost.
17 18 19 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 17 def unit_cost @unit_cost end |
#unit_price ⇒ Object
Returns the value of attribute unit_price.
15 16 17 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 15 def unit_price @unit_price end |
#uom ⇒ Object
Returns the value of attribute uom.
41 42 43 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 41 def uom @uom end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 87 def self.attribute_map { :'id' => :'id', :'product' => :'product', :'quantity' => :'quantity', :'less_included' => :'lessIncluded', :'unit_price' => :'unitPrice', :'unit_cost' => :'unitCost', :'bill_customer' => :'billCustomer', :'effective_date' => :'effectiveDate', :'cancelled_date' => :'cancelledDate', :'taxable_flag' => :'taxableFlag', :'serial_number' => :'serialNumber', :'invoice_description' => :'invoiceDescription', :'purchase_item_flag' => :'purchaseItemFlag', :'special_order_flag' => :'specialOrderFlag', :'agreement_id' => :'agreementId', :'description' => :'description', :'billed_quantity' => :'billedQuantity', :'uom' => :'uom', :'ext_price' => :'extPrice', :'ext_cost' => :'extCost', :'sequence_number' => :'sequenceNumber', :'margin' => :'margin', :'prorate_cost' => :'prorateCost', :'prorate_price' => :'proratePrice', :'extended_prorate_cost' => :'extendedProrateCost', :'extended_prorate_price' => :'extendedProratePrice', :'prorate_current_period_flag' => :'prorateCurrentPeriodFlag', :'_info' => :'_info' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 150 151 152 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 121 def self.swagger_types { :'id' => :'Integer', :'product' => :'IvItemReference', :'quantity' => :'Float', :'less_included' => :'Float', :'unit_price' => :'Float', :'unit_cost' => :'Float', :'bill_customer' => :'String', :'effective_date' => :'DateTime', :'cancelled_date' => :'DateTime', :'taxable_flag' => :'BOOLEAN', :'serial_number' => :'String', :'invoice_description' => :'String', :'purchase_item_flag' => :'BOOLEAN', :'special_order_flag' => :'BOOLEAN', :'agreement_id' => :'Integer', :'description' => :'String', :'billed_quantity' => :'Float', :'uom' => :'String', :'ext_price' => :'Float', :'ext_cost' => :'Float', :'sequence_number' => :'Float', :'margin' => :'Float', :'prorate_cost' => :'Float', :'prorate_price' => :'Float', :'extended_prorate_cost' => :'Float', :'extended_prorate_price' => :'Float', :'prorate_current_period_flag' => :'BOOLEAN', :'_info' => :'Metadata' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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 376 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 345 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && product == o.product && quantity == o.quantity && less_included == o.less_included && unit_price == o.unit_price && unit_cost == o.unit_cost && bill_customer == o.bill_customer && effective_date == o.effective_date && cancelled_date == o.cancelled_date && taxable_flag == o.taxable_flag && serial_number == o.serial_number && invoice_description == o.invoice_description && purchase_item_flag == o.purchase_item_flag && special_order_flag == o.special_order_flag && agreement_id == o.agreement_id && description == o.description && billed_quantity == o.billed_quantity && uom == o.uom && ext_price == o.ext_price && ext_cost == o.ext_cost && sequence_number == o.sequence_number && margin == o.margin && prorate_cost == o.prorate_cost && prorate_price == o.prorate_price && extended_prorate_cost == o.extended_prorate_cost && extended_prorate_price == o.extended_prorate_price && prorate_current_period_flag == o.prorate_current_period_flag && _info == o._info end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 414 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 temp_model = ConnectWise.const_get(type).new temp_model.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
480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 480 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
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 393 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the 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
380 381 382 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 380 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
386 387 388 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 386 def hash [id, product, quantity, less_included, unit_price, unit_cost, bill_customer, effective_date, cancelled_date, taxable_flag, serial_number, invoice_description, purchase_item_flag, special_order_flag, agreement_id, description, billed_quantity, uom, ext_price, ext_cost, sequence_number, margin, prorate_cost, prorate_price, extended_prorate_cost, extended_prorate_price, prorate_current_period_flag, _info].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 278 def list_invalid_properties invalid_properties = Array.new if @product.nil? invalid_properties.push("invalid value for 'product', product cannot be nil.") end if @bill_customer.nil? invalid_properties.push("invalid value for 'bill_customer', bill_customer cannot be nil.") end if !@serial_number.nil? && @serial_number.to_s.length > 50 invalid_properties.push("invalid value for 'serial_number', the character length must be smaller than or equal to 50.") end if !@invoice_description.nil? && @invoice_description.to_s.length > 6000 invalid_properties.push("invalid value for 'invoice_description', the character length must be smaller than or equal to 6000.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
460 461 462 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 460 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
466 467 468 469 470 471 472 473 474 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 466 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
454 455 456 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 454 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
301 302 303 304 305 306 307 308 309 |
# File 'lib/connectwise-ruby-sdk/models/addition.rb', line 301 def valid? return false if @product.nil? return false if @bill_customer.nil? bill_customer_validator = EnumAttributeValidator.new('String', ["Billable", "DoNotBill", "NoCharge"]) return false unless bill_customer_validator.valid?(@bill_customer) return false if !@serial_number.nil? && @serial_number.to_s.length > 50 return false if !@invoice_description.nil? && @invoice_description.to_s.length > 6000 return true end |