Class: ConnectWise::TaxIntegration

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TaxIntegration

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#_infoObject

Metadata of the entity



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

def _info
  @_info
end

#account_numberObject

Returns the value of attribute account_number.



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

def 
  @account_number
end

#accounting_integration_flagObject

Returns the value of attribute accounting_integration_flag.



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

def accounting_integration_flag
  @accounting_integration_flag
end

#commit_transactions_flagObject

Returns the value of attribute commit_transactions_flag.



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

def commit_transactions_flag
  @commit_transactions_flag
end

#company_codeObject

Returns the value of attribute company_code.



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

def company_code
  @company_code
end

#enabled_flagObject

Returns the value of attribute enabled_flag.



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

def enabled_flag
  @enabled_flag
end

#expense_tax_codeObject

Returns the value of attribute expense_tax_code.



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

def expense_tax_code
  @expense_tax_code
end

#freight_tax_codeObject

Returns the value of attribute freight_tax_code.



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

def freight_tax_code
  @freight_tax_code
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#invoice_amount_tax_codeObject

Returns the value of attribute invoice_amount_tax_code.



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

def invoice_amount_tax_code
  @invoice_amount_tax_code
end

#license_keyObject

Returns the value of attribute license_key.



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

def license_key
  @license_key
end

#product_tax_codeObject

Returns the value of attribute product_tax_code.



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

def product_tax_code
  @product_tax_code
end

#sales_invoice_flagObject

Returns the value of attribute sales_invoice_flag.



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

def sales_invoice_flag
  @sales_invoice_flag
end

#service_urlObject

Returns the value of attribute service_url.



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

def service_url
  @service_url
end

#tax_integration_typeObject

Returns the value of attribute tax_integration_type.



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

def tax_integration_type
  @tax_integration_type
end

#tax_line_flagObject

Returns the value of attribute tax_line_flag.



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

def tax_line_flag
  @tax_line_flag
end

#time_tax_codeObject

Returns the value of attribute time_tax_code.



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

def time_tax_code
  @time_tax_code
end

Class Method Details

.attribute_mapObject

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



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 65

def self.attribute_map
  {
    :'tax_integration_type' => :'taxIntegrationType',
    :'id' => :'id',
    :'account_number' => :'accountNumber',
    :'license_key' => :'licenseKey',
    :'service_url' => :'serviceUrl',
    :'company_code' => :'companyCode',
    :'time_tax_code' => :'timeTaxCode',
    :'expense_tax_code' => :'expenseTaxCode',
    :'product_tax_code' => :'productTaxCode',
    :'invoice_amount_tax_code' => :'invoiceAmountTaxCode',
    :'enabled_flag' => :'enabledFlag',
    :'commit_transactions_flag' => :'commitTransactionsFlag',
    :'sales_invoice_flag' => :'salesInvoiceFlag',
    :'freight_tax_code' => :'freightTaxCode',
    :'accounting_integration_flag' => :'accountingIntegrationFlag',
    :'tax_line_flag' => :'taxLineFlag',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 88

def self.swagger_types
  {
    :'tax_integration_type' => :'String',
    :'id' => :'Integer',
    :'account_number' => :'String',
    :'license_key' => :'String',
    :'service_url' => :'String',
    :'company_code' => :'String',
    :'time_tax_code' => :'String',
    :'expense_tax_code' => :'String',
    :'product_tax_code' => :'String',
    :'invoice_amount_tax_code' => :'String',
    :'enabled_flag' => :'BOOLEAN',
    :'commit_transactions_flag' => :'BOOLEAN',
    :'sales_invoice_flag' => :'BOOLEAN',
    :'freight_tax_code' => :'String',
    :'accounting_integration_flag' => :'BOOLEAN',
    :'tax_line_flag' => :'BOOLEAN',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 359

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      tax_integration_type == o.tax_integration_type &&
      id == o.id &&
       == o. &&
      license_key == o.license_key &&
      service_url == o.service_url &&
      company_code == o.company_code &&
      time_tax_code == o.time_tax_code &&
      expense_tax_code == o.expense_tax_code &&
      product_tax_code == o.product_tax_code &&
      invoice_amount_tax_code == o.invoice_amount_tax_code &&
      enabled_flag == o.enabled_flag &&
      commit_transactions_flag == o.commit_transactions_flag &&
      sales_invoice_flag == o.sales_invoice_flag &&
      freight_tax_code == o.freight_tax_code &&
      accounting_integration_flag == o.accounting_integration_flag &&
      tax_line_flag == o.tax_line_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



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
451
452
453
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 417

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



483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 483

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



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 396

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


383
384
385
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 383

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



389
390
391
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 389

def hash
  [tax_integration_type, id, , license_key, service_url, company_code, time_tax_code, expense_tax_code, product_tax_code, invoice_amount_tax_code, enabled_flag, commit_transactions_flag, sales_invoice_flag, freight_tax_code, accounting_integration_flag, tax_line_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



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

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

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

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

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

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

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

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

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

  if !@freight_tax_code.nil? && @freight_tax_code.to_s.length > 50
    invalid_properties.push("invalid value for 'freight_tax_code', the character length must be smaller than or equal to 50.")
  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



463
464
465
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 463

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



469
470
471
472
473
474
475
476
477
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 469

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



457
458
459
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 457

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



233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/connectwise-ruby-sdk/models/tax_integration.rb', line 233

def valid?
  tax_integration_type_validator = EnumAttributeValidator.new('String', ["Avalara"])
  return false unless tax_integration_type_validator.valid?(@tax_integration_type)
  return false if !@account_number.nil? && @account_number.to_s.length > 50
  return false if !@license_key.nil? && @license_key.to_s.length > 50
  return false if !@service_url.nil? && @service_url.to_s.length > 250
  return false if !@company_code.nil? && @company_code.to_s.length > 50
  return false if !@time_tax_code.nil? && @time_tax_code.to_s.length > 50
  return false if !@expense_tax_code.nil? && @expense_tax_code.to_s.length > 50
  return false if !@product_tax_code.nil? && @product_tax_code.to_s.length > 50
  return false if !@invoice_amount_tax_code.nil? && @invoice_amount_tax_code.to_s.length > 50
  return false if !@freight_tax_code.nil? && @freight_tax_code.to_s.length > 50
  return true
end