Class: ConnectWise::AccountingPackage

Inherits:
Object
  • Object
show all
Defined in:
lib/connectwise-ruby-sdk/models/accounting_package.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AccountingPackage

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 132

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?(:'identifier')
    self.identifier = attributes[:'identifier']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'directTransferFlag')
    self.direct_transfer_flag = attributes[:'directTransferFlag']
  end

  if attributes.has_key?(:'includeInvoicesFlag')
    self.include_invoices_flag = attributes[:'includeInvoicesFlag']
  end

  if attributes.has_key?(:'invoiceFormat')
    self.invoice_format = attributes[:'invoiceFormat']
  end

  if attributes.has_key?(:'includeExpenseFlag')
    self.include_expense_flag = attributes[:'includeExpenseFlag']
  end

  if attributes.has_key?(:'transferExpenseAsBillFlag')
    self.transfer_expense_as_bill_flag = attributes[:'transferExpenseAsBillFlag']
  end

  if attributes.has_key?(:'expenseFormat')
    self.expense_format = attributes[:'expenseFormat']
  end

  if attributes.has_key?(:'supressMemoFlag')
    self.supress_memo_flag = attributes[:'supressMemoFlag']
  end

  if attributes.has_key?(:'syncPaymentInfoFlag')
    self.sync_payment_info_flag = attributes[:'syncPaymentInfoFlag']
  end

  if attributes.has_key?(:'includeSalesTaxFlag')
    self.include_sales_tax_flag = attributes[:'includeSalesTaxFlag']
  end

  if attributes.has_key?(:'enableTaxGroupsFlag')
    self.enable_tax_groups_flag = attributes[:'enableTaxGroupsFlag']
  end

  if attributes.has_key?(:'zeroDollarTaxAmountsFlag')
    self.zero_dollar_tax_amounts_flag = attributes[:'zeroDollarTaxAmountsFlag']
  end

  if attributes.has_key?(:'includeItemsFlag')
    self.include_items_flag = attributes[:'includeItemsFlag']
  end

  if attributes.has_key?(:'inventorySOHFlag')
    self.inventory_soh_flag = attributes[:'inventorySOHFlag']
  end

  if attributes.has_key?(:'sendComponentAmountFlag')
    self.send_component_amount_flag = attributes[:'sendComponentAmountFlag']
  end

  if attributes.has_key?(:'sendUomFlag')
    self.send_uom_flag = attributes[:'sendUomFlag']
  end

  if attributes.has_key?(:'includeCogsEntriesFlag')
    self.include_cogs_entries_flag = attributes[:'includeCogsEntriesFlag']
  end

  if attributes.has_key?(:'includgeCogsDropShipFlag')
    self.includge_cogs_drop_ship_flag = attributes[:'includgeCogsDropShipFlag']
  end

  if attributes.has_key?(:'activeFlag')
    self.active_flag = attributes[:'activeFlag']
  end

  if attributes.has_key?(:'_info')
    self._info = attributes[:'_info']
  end

end

Instance Attribute Details

#_infoObject

Metadata of the entity



50
51
52
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 50

def _info
  @_info
end

#active_flagObject

Returns the value of attribute active_flag.



47
48
49
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 47

def active_flag
  @active_flag
end

#direct_transfer_flagObject

Returns the value of attribute direct_transfer_flag.



13
14
15
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 13

def direct_transfer_flag
  @direct_transfer_flag
end

#enable_tax_groups_flagObject

Returns the value of attribute enable_tax_groups_flag.



31
32
33
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 31

def enable_tax_groups_flag
  @enable_tax_groups_flag
end

#expense_formatObject

Returns the value of attribute expense_format.



23
24
25
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 23

def expense_format
  @expense_format
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 7

def id
  @id
end

#identifierObject

Returns the value of attribute identifier.



9
10
11
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 9

def identifier
  @identifier
end

#include_cogs_entries_flagObject

Returns the value of attribute include_cogs_entries_flag.



43
44
45
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 43

def include_cogs_entries_flag
  @include_cogs_entries_flag
end

#include_expense_flagObject

Returns the value of attribute include_expense_flag.



19
20
21
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 19

def include_expense_flag
  @include_expense_flag
end

#include_invoices_flagObject

Returns the value of attribute include_invoices_flag.



15
16
17
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 15

def include_invoices_flag
  @include_invoices_flag
end

#include_items_flagObject

Returns the value of attribute include_items_flag.



35
36
37
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 35

def include_items_flag
  @include_items_flag
end

#include_sales_tax_flagObject

Returns the value of attribute include_sales_tax_flag.



29
30
31
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 29

def include_sales_tax_flag
  @include_sales_tax_flag
end

#includge_cogs_drop_ship_flagObject

Returns the value of attribute includge_cogs_drop_ship_flag.



45
46
47
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 45

def includge_cogs_drop_ship_flag
  @includge_cogs_drop_ship_flag
end

#inventory_soh_flagObject

Returns the value of attribute inventory_soh_flag.



37
38
39
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 37

def inventory_soh_flag
  @inventory_soh_flag
end

#invoice_formatObject

Returns the value of attribute invoice_format.



17
18
19
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 17

def invoice_format
  @invoice_format
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 11

def name
  @name
end

#send_component_amount_flagObject

Returns the value of attribute send_component_amount_flag.



39
40
41
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 39

def send_component_amount_flag
  @send_component_amount_flag
end

#send_uom_flagObject

Returns the value of attribute send_uom_flag.



41
42
43
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 41

def send_uom_flag
  @send_uom_flag
end

#supress_memo_flagObject

Returns the value of attribute supress_memo_flag.



25
26
27
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 25

def supress_memo_flag
  @supress_memo_flag
end

#sync_payment_info_flagObject

Returns the value of attribute sync_payment_info_flag.



27
28
29
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 27

def sync_payment_info_flag
  @sync_payment_info_flag
end

#transfer_expense_as_bill_flagObject

Returns the value of attribute transfer_expense_as_bill_flag.



21
22
23
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 21

def transfer_expense_as_bill_flag
  @transfer_expense_as_bill_flag
end

#zero_dollar_tax_amounts_flagObject

Returns the value of attribute zero_dollar_tax_amounts_flag.



33
34
35
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 33

def zero_dollar_tax_amounts_flag
  @zero_dollar_tax_amounts_flag
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 75

def self.attribute_map
  {
    :'id' => :'id',
    :'identifier' => :'identifier',
    :'name' => :'name',
    :'direct_transfer_flag' => :'directTransferFlag',
    :'include_invoices_flag' => :'includeInvoicesFlag',
    :'invoice_format' => :'invoiceFormat',
    :'include_expense_flag' => :'includeExpenseFlag',
    :'transfer_expense_as_bill_flag' => :'transferExpenseAsBillFlag',
    :'expense_format' => :'expenseFormat',
    :'supress_memo_flag' => :'supressMemoFlag',
    :'sync_payment_info_flag' => :'syncPaymentInfoFlag',
    :'include_sales_tax_flag' => :'includeSalesTaxFlag',
    :'enable_tax_groups_flag' => :'enableTaxGroupsFlag',
    :'zero_dollar_tax_amounts_flag' => :'zeroDollarTaxAmountsFlag',
    :'include_items_flag' => :'includeItemsFlag',
    :'inventory_soh_flag' => :'inventorySOHFlag',
    :'send_component_amount_flag' => :'sendComponentAmountFlag',
    :'send_uom_flag' => :'sendUomFlag',
    :'include_cogs_entries_flag' => :'includeCogsEntriesFlag',
    :'includge_cogs_drop_ship_flag' => :'includgeCogsDropShipFlag',
    :'active_flag' => :'activeFlag',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 103

def self.swagger_types
  {
    :'id' => :'Integer',
    :'identifier' => :'String',
    :'name' => :'String',
    :'direct_transfer_flag' => :'BOOLEAN',
    :'include_invoices_flag' => :'BOOLEAN',
    :'invoice_format' => :'String',
    :'include_expense_flag' => :'BOOLEAN',
    :'transfer_expense_as_bill_flag' => :'BOOLEAN',
    :'expense_format' => :'String',
    :'supress_memo_flag' => :'BOOLEAN',
    :'sync_payment_info_flag' => :'BOOLEAN',
    :'include_sales_tax_flag' => :'BOOLEAN',
    :'enable_tax_groups_flag' => :'BOOLEAN',
    :'zero_dollar_tax_amounts_flag' => :'BOOLEAN',
    :'include_items_flag' => :'BOOLEAN',
    :'inventory_soh_flag' => :'BOOLEAN',
    :'send_component_amount_flag' => :'BOOLEAN',
    :'send_uom_flag' => :'BOOLEAN',
    :'include_cogs_entries_flag' => :'BOOLEAN',
    :'includge_cogs_drop_ship_flag' => :'BOOLEAN',
    :'active_flag' => :'BOOLEAN',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 299

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      identifier == o.identifier &&
      name == o.name &&
      direct_transfer_flag == o.direct_transfer_flag &&
      include_invoices_flag == o.include_invoices_flag &&
      invoice_format == o.invoice_format &&
      include_expense_flag == o.include_expense_flag &&
      transfer_expense_as_bill_flag == o.transfer_expense_as_bill_flag &&
      expense_format == o.expense_format &&
      supress_memo_flag == o.supress_memo_flag &&
      sync_payment_info_flag == o.sync_payment_info_flag &&
      include_sales_tax_flag == o.include_sales_tax_flag &&
      enable_tax_groups_flag == o.enable_tax_groups_flag &&
      zero_dollar_tax_amounts_flag == o.zero_dollar_tax_amounts_flag &&
      include_items_flag == o.include_items_flag &&
      inventory_soh_flag == o.inventory_soh_flag &&
      send_component_amount_flag == o.send_component_amount_flag &&
      send_uom_flag == o.send_uom_flag &&
      include_cogs_entries_flag == o.include_cogs_entries_flag &&
      includge_cogs_drop_ship_flag == o.includge_cogs_drop_ship_flag &&
      active_flag == o.active_flag &&
      _info == o._info
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 362

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 428

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 341

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


328
329
330
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 328

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



334
335
336
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 334

def hash
  [id, identifier, name, direct_transfer_flag, include_invoices_flag, invoice_format, include_expense_flag, transfer_expense_as_bill_flag, expense_format, supress_memo_flag, sync_payment_info_flag, include_sales_tax_flag, enable_tax_groups_flag, zero_dollar_tax_amounts_flag, include_items_flag, inventory_soh_flag, send_component_amount_flag, send_uom_flag, include_cogs_entries_flag, includge_cogs_drop_ship_flag, active_flag, _info].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 230

def list_invalid_properties
  invalid_properties = Array.new
  if !@identifier.nil? && @identifier.to_s.length > 10
    invalid_properties.push("invalid value for 'identifier', the character length must be smaller than or equal to 10.")
  end

  if !@name.nil? && @name.to_s.length > 30
    invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 30.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



408
409
410
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 408

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



414
415
416
417
418
419
420
421
422
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 414

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



402
403
404
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 402

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



245
246
247
248
249
250
251
252
253
# File 'lib/connectwise-ruby-sdk/models/accounting_package.rb', line 245

def valid?
  return false if !@identifier.nil? && @identifier.to_s.length > 10
  return false if !@name.nil? && @name.to_s.length > 30
  invoice_format_validator = EnumAttributeValidator.new('String', ["Default", "Condensed", "Detailed"])
  return false unless invoice_format_validator.valid?(@invoice_format)
  expense_format_validator = EnumAttributeValidator.new('String', ["Default", "Condensed", "Detailed"])
  return false unless expense_format_validator.valid?(@expense_format)
  return true
end