Class: ConnectWise::GLExportCustomer

Inherits:
Object
  • Object
show all
Defined in:
lib/connect_wise/models/gl_export_customer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GLExportCustomer

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Raises:

  • (ArgumentError)


109
110
111
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
# File 'lib/connect_wise/models/gl_export_customer.rb', line 109

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::GLExportCustomer` initialize method' unless attributes.is_a?(Hash)

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    raise ArgumentError, "`#{k}` is not a valid attribute in `ConnectWise::GLExportCustomer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)

    h[k.to_sym] = v
  end

  self.company = attributes[:company] if attributes.key?(:company)

  self.company_type = attributes[:company_type] if attributes.key?(:company_type)

  self.contact = attributes[:contact] if attributes.key?(:contact)

  self.site = attributes[:site] if attributes.key?(:site)

  self. = attributes[:account_number] if attributes.key?(:account_number)

  self.billing_terms = attributes[:billing_terms] if attributes.key?(:billing_terms)

  self.billing_terms_xref = attributes[:billing_terms_xref] if attributes.key?(:billing_terms_xref)

  self.due_days = attributes[:due_days] if attributes.key?(:due_days)

  self.taxable = attributes[:taxable] if attributes.key?(:taxable)

  self.tax_code = attributes[:tax_code] if attributes.key?(:tax_code)

  self.currency = attributes[:currency] if attributes.key?(:currency)

  self.state_tax_xref = attributes[:state_tax_xref] if attributes.key?(:state_tax_xref)

  self.county_tax_xref = attributes[:county_tax_xref] if attributes.key?(:county_tax_xref)

  self.city_tax_xref = attributes[:city_tax_xref] if attributes.key?(:city_tax_xref)

  self.country_tax_xref = attributes[:country_tax_xref] if attributes.key?(:country_tax_xref)

  self.composite_tax_xref = attributes[:composite_tax_xref] if attributes.key?(:composite_tax_xref)

  self.state_tax_rate = attributes[:state_tax_rate] if attributes.key?(:state_tax_rate)

  self.county_tax_rate = attributes[:county_tax_rate] if attributes.key?(:county_tax_rate)

  self.city_tax_rate = attributes[:city_tax_rate] if attributes.key?(:city_tax_rate)

  self.country_tax_rate = attributes[:country_tax_rate] if attributes.key?(:country_tax_rate)

  self.composite_tax_rate = attributes[:composite_tax_rate] if attributes.key?(:composite_tax_rate)

  self.tax_group_rate = attributes[:tax_group_rate] if attributes.key?(:tax_group_rate)

  self.tax_agency_xref = attributes[:tax_agency_xref] if attributes.key?(:tax_agency_xref)

  self.state_tax_agency_xref = attributes[:state_tax_agency_xref] if attributes.key?(:state_tax_agency_xref)

  self.county_tax_agency_xref = attributes[:county_tax_agency_xref] if attributes.key?(:county_tax_agency_xref)

  self.city_tax_agency_xref = attributes[:city_tax_agency_xref] if attributes.key?(:city_tax_agency_xref)

  self.country_tax_agency_xref = attributes[:country_tax_agency_xref] if attributes.key?(:country_tax_agency_xref)

  self.composite_tax_agency_xref = attributes[:composite_tax_agency_xref] if attributes.key?(:composite_tax_agency_xref)

  return unless attributes.key?(:tax_levels)
  return unless (value = attributes[:tax_levels]).is_a?(Array)

  self.tax_levels = value
end

Instance Attribute Details

#account_numberObject

Returns the value of attribute account_number.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def 
  @account_number
end

#billing_termsObject

Returns the value of attribute billing_terms.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def billing_terms
  @billing_terms
end

#billing_terms_xrefObject

Returns the value of attribute billing_terms_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def billing_terms_xref
  @billing_terms_xref
end

#city_tax_agency_xrefObject

Returns the value of attribute city_tax_agency_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def city_tax_agency_xref
  @city_tax_agency_xref
end

#city_tax_rateObject

Returns the value of attribute city_tax_rate.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def city_tax_rate
  @city_tax_rate
end

#city_tax_xrefObject

Returns the value of attribute city_tax_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def city_tax_xref
  @city_tax_xref
end

#companyObject

Returns the value of attribute company.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def company
  @company
end

#company_typeObject

Returns the value of attribute company_type.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def company_type
  @company_type
end

#composite_tax_agency_xrefObject

Returns the value of attribute composite_tax_agency_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def composite_tax_agency_xref
  @composite_tax_agency_xref
end

#composite_tax_rateObject

Returns the value of attribute composite_tax_rate.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def composite_tax_rate
  @composite_tax_rate
end

#composite_tax_xrefObject

Returns the value of attribute composite_tax_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def composite_tax_xref
  @composite_tax_xref
end

#contactObject

Returns the value of attribute contact.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def contact
  @contact
end

#country_tax_agency_xrefObject

Returns the value of attribute country_tax_agency_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def country_tax_agency_xref
  @country_tax_agency_xref
end

#country_tax_rateObject

Returns the value of attribute country_tax_rate.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def country_tax_rate
  @country_tax_rate
end

#country_tax_xrefObject

Returns the value of attribute country_tax_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def country_tax_xref
  @country_tax_xref
end

#county_tax_agency_xrefObject

Returns the value of attribute county_tax_agency_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def county_tax_agency_xref
  @county_tax_agency_xref
end

#county_tax_rateObject

Returns the value of attribute county_tax_rate.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def county_tax_rate
  @county_tax_rate
end

#county_tax_xrefObject

Returns the value of attribute county_tax_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def county_tax_xref
  @county_tax_xref
end

#currencyObject

Returns the value of attribute currency.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def currency
  @currency
end

#due_daysObject

Returns the value of attribute due_days.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def due_days
  @due_days
end

#siteObject

Returns the value of attribute site.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def site
  @site
end

#state_tax_agency_xrefObject

Returns the value of attribute state_tax_agency_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def state_tax_agency_xref
  @state_tax_agency_xref
end

#state_tax_rateObject

Returns the value of attribute state_tax_rate.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def state_tax_rate
  @state_tax_rate
end

#state_tax_xrefObject

Returns the value of attribute state_tax_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def state_tax_xref
  @state_tax_xref
end

#tax_agency_xrefObject

Returns the value of attribute tax_agency_xref.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def tax_agency_xref
  @tax_agency_xref
end

#tax_codeObject

Returns the value of attribute tax_code.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def tax_code
  @tax_code
end

#tax_group_rateObject

Returns the value of attribute tax_group_rate.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def tax_group_rate
  @tax_group_rate
end

#tax_levelsObject

Returns the value of attribute tax_levels.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def tax_levels
  @tax_levels
end

#taxableObject

Returns the value of attribute taxable.



16
17
18
# File 'lib/connect_wise/models/gl_export_customer.rb', line 16

def taxable
  @taxable
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



54
55
56
# File 'lib/connect_wise/models/gl_export_customer.rb', line 54

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/connect_wise/models/gl_export_customer.rb', line 19

def self.attribute_map
  {
    company: :company,
    company_type: :companyType,
    contact: :contact,
    site: :site,
    account_number: :accountNumber,
    billing_terms: :billingTerms,
    billing_terms_xref: :billingTermsXref,
    due_days: :dueDays,
    taxable: :taxable,
    tax_code: :taxCode,
    currency: :currency,
    state_tax_xref: :stateTaxXref,
    county_tax_xref: :countyTaxXref,
    city_tax_xref: :cityTaxXref,
    country_tax_xref: :countryTaxXref,
    composite_tax_xref: :compositeTaxXref,
    state_tax_rate: :stateTaxRate,
    county_tax_rate: :countyTaxRate,
    city_tax_rate: :cityTaxRate,
    country_tax_rate: :countryTaxRate,
    composite_tax_rate: :compositeTaxRate,
    tax_group_rate: :taxGroupRate,
    tax_agency_xref: :taxAgencyXref,
    state_tax_agency_xref: :stateTaxAgencyXref,
    county_tax_agency_xref: :countyTaxAgencyXref,
    city_tax_agency_xref: :cityTaxAgencyXref,
    country_tax_agency_xref: :countryTaxAgencyXref,
    composite_tax_agency_xref: :compositeTaxAgencyXref,
    tax_levels: :taxLevels
  }
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



245
246
247
# File 'lib/connect_wise/models/gl_export_customer.rb', line 245

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/connect_wise/models/gl_export_customer.rb', line 94

def self.openapi_nullable
  Set.new(%i[
            due_days
            taxable
            state_tax_rate
            county_tax_rate
            city_tax_rate
            country_tax_rate
            composite_tax_rate
            tax_group_rate
          ])
end

.openapi_typesObject

Attribute type mapping.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/connect_wise/models/gl_export_customer.rb', line 59

def self.openapi_types
  {
    company: :CompanyReference,
    company_type: :CompanyTypeReference,
    contact: :ContactReference,
    site: :SiteReference,
    account_number: :String,
    billing_terms: :BillingTermsReference,
    billing_terms_xref: :String,
    due_days: :Integer,
    taxable: :Boolean,
    tax_code: :TaxCodeReference,
    currency: :CurrencyReference,
    state_tax_xref: :String,
    county_tax_xref: :String,
    city_tax_xref: :String,
    country_tax_xref: :String,
    composite_tax_xref: :String,
    state_tax_rate: :Float,
    county_tax_rate: :Float,
    city_tax_rate: :Float,
    country_tax_rate: :Float,
    composite_tax_rate: :Float,
    tax_group_rate: :Float,
    tax_agency_xref: :String,
    state_tax_agency_xref: :String,
    county_tax_agency_xref: :String,
    city_tax_agency_xref: :String,
    country_tax_agency_xref: :String,
    composite_tax_agency_xref: :String,
    tax_levels: :'Array<GLExportCustomerTaxLevel>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/connect_wise/models/gl_export_customer.rb', line 195

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    company == other.company &&
    company_type == other.company_type &&
    contact == other.contact &&
    site == other.site &&
     == other. &&
    billing_terms == other.billing_terms &&
    billing_terms_xref == other.billing_terms_xref &&
    due_days == other.due_days &&
    taxable == other.taxable &&
    tax_code == other.tax_code &&
    currency == other.currency &&
    state_tax_xref == other.state_tax_xref &&
    county_tax_xref == other.county_tax_xref &&
    city_tax_xref == other.city_tax_xref &&
    country_tax_xref == other.country_tax_xref &&
    composite_tax_xref == other.composite_tax_xref &&
    state_tax_rate == other.state_tax_rate &&
    county_tax_rate == other.county_tax_rate &&
    city_tax_rate == other.city_tax_rate &&
    country_tax_rate == other.country_tax_rate &&
    composite_tax_rate == other.composite_tax_rate &&
    tax_group_rate == other.tax_group_rate &&
    tax_agency_xref == other.tax_agency_xref &&
    state_tax_agency_xref == other.state_tax_agency_xref &&
    county_tax_agency_xref == other.county_tax_agency_xref &&
    city_tax_agency_xref == other.city_tax_agency_xref &&
    country_tax_agency_xref == other.country_tax_agency_xref &&
    composite_tax_agency_xref == other.composite_tax_agency_xref &&
    tax_levels == other.tax_levels
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



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
# File 'lib/connect_wise/models/gl_export_customer.rb', line 275

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = ConnectWise.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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



346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/connect_wise/models/gl_export_customer.rb', line 346

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



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/connect_wise/models/gl_export_customer.rb', line 252

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      send("#{key}=", nil)
    elsif 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
      send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }) if attributes[self.class.attribute_map[key]].is_a?(Array)
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


232
233
234
# File 'lib/connect_wise/models/gl_export_customer.rb', line 232

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



238
239
240
# File 'lib/connect_wise/models/gl_export_customer.rb', line 238

def hash
  [company, company_type, contact, site, , billing_terms, billing_terms_xref, due_days, taxable, tax_code, currency, state_tax_xref, county_tax_xref, city_tax_xref, country_tax_xref, composite_tax_xref, state_tax_rate, county_tax_rate, city_tax_rate, country_tax_rate, composite_tax_rate, tax_group_rate, tax_agency_xref, state_tax_agency_xref, county_tax_agency_xref, city_tax_agency_xref, country_tax_agency_xref, composite_tax_agency_xref, tax_levels].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



183
184
185
# File 'lib/connect_wise/models/gl_export_customer.rb', line 183

def list_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



322
323
324
# File 'lib/connect_wise/models/gl_export_customer.rb', line 322

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



328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/connect_wise/models/gl_export_customer.rb', line 328

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = 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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



316
317
318
# File 'lib/connect_wise/models/gl_export_customer.rb', line 316

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



189
190
191
# File 'lib/connect_wise/models/gl_export_customer.rb', line 189

def valid?
  true
end