Class: ConnectWise::AccountingPackageSetup

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AccountingPackageSetup

Initializes the object

Raises:

  • (ArgumentError)


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

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::AccountingPackageSetup` 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::AccountingPackageSetup`. 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.id = attributes[:id] if attributes.key?(:id)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return unless attributes.key?(:include_cogs_drop_ship_flag)

  self.include_cogs_drop_ship_flag = attributes[:include_cogs_drop_ship_flag]
end

Instance Attribute Details

#accounting_packageObject

Returns the value of attribute accounting_package.



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

def accounting_package
  @accounting_package
end

#direct_transfer_flagObject

Returns the value of attribute direct_transfer_flag.



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

def direct_transfer_flag
  @direct_transfer_flag
end

#enable_tax_groups_flagObject

Returns the value of attribute enable_tax_groups_flag.



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

def enable_tax_groups_flag
  @enable_tax_groups_flag
end

#expense_formatObject

Returns the value of attribute expense_format.



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

def expense_format
  @expense_format
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#include_cogs_drop_ship_flagObject

Returns the value of attribute include_cogs_drop_ship_flag.



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

def include_cogs_drop_ship_flag
  @include_cogs_drop_ship_flag
end

#include_cogs_entries_flagObject

Returns the value of attribute include_cogs_entries_flag.



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

def include_cogs_entries_flag
  @include_cogs_entries_flag
end

#include_expenses_flagObject

Returns the value of attribute include_expenses_flag.



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

def include_expenses_flag
  @include_expenses_flag
end

#include_invoices_flagObject

Returns the value of attribute include_invoices_flag.



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

def include_invoices_flag
  @include_invoices_flag
end

#include_items_flagObject

Returns the value of attribute include_items_flag.



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

def include_items_flag
  @include_items_flag
end

#include_sales_tax_flagObject

Returns the value of attribute include_sales_tax_flag.



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

def include_sales_tax_flag
  @include_sales_tax_flag
end

#inventory_soh_flagObject

Returns the value of attribute inventory_soh_flag.



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

def inventory_soh_flag
  @inventory_soh_flag
end

#invoice_formatObject

Returns the value of attribute invoice_format.



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

def invoice_format
  @invoice_format
end

#send_component_amount_flagObject

Returns the value of attribute send_component_amount_flag.



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

def send_component_amount_flag
  @send_component_amount_flag
end

#send_uom_flagObject

Returns the value of attribute send_uom_flag.



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

def send_uom_flag
  @send_uom_flag
end

#suppress_memo_flagObject

Returns the value of attribute suppress_memo_flag.



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

def suppress_memo_flag
  @suppress_memo_flag
end

#sync_payment_info_flagObject

Returns the value of attribute sync_payment_info_flag.



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

def sync_payment_info_flag
  @sync_payment_info_flag
end

#transfer_expenses_as_bill_flagObject

Returns the value of attribute transfer_expenses_as_bill_flag.



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

def transfer_expenses_as_bill_flag
  @transfer_expenses_as_bill_flag
end

#zero_dollar_tax_amounts_flagObject

Returns the value of attribute zero_dollar_tax_amounts_flag.



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

def zero_dollar_tax_amounts_flag
  @zero_dollar_tax_amounts_flag
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



65
66
67
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 65

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 40

def self.attribute_map
  {
    id: :id,
    accounting_package: :accountingPackage,
    direct_transfer_flag: :directTransferFlag,
    include_invoices_flag: :includeInvoicesFlag,
    invoice_format: :invoiceFormat,
    include_expenses_flag: :includeExpensesFlag,
    transfer_expenses_as_bill_flag: :transferExpensesAsBillFlag,
    expense_format: :expenseFormat,
    suppress_memo_flag: :suppressMemoFlag,
    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,
    include_cogs_drop_ship_flag: :includeCogsDropShipFlag
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash



248
249
250
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 248

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

.openapi_nullableObject

List of attributes with nullable: true



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 95

def self.openapi_nullable
  Set.new(i[
            direct_transfer_flag
            include_invoices_flag
            invoice_format
            include_expenses_flag
            transfer_expenses_as_bill_flag
            expense_format
            suppress_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
            include_cogs_drop_ship_flag
          ])
end

.openapi_typesObject

Attribute type mapping.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 70

def self.openapi_types
  {
    id: :Integer,
    accounting_package: :AccountingPackageReference,
    direct_transfer_flag: :Boolean,
    include_invoices_flag: :Boolean,
    invoice_format: :String,
    include_expenses_flag: :Boolean,
    transfer_expenses_as_bill_flag: :Boolean,
    expense_format: :String,
    suppress_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,
    include_cogs_drop_ship_flag: :Boolean
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 208

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

  self.class == other.class &&
    id == other.id &&
    accounting_package == other.accounting_package &&
    direct_transfer_flag == other.direct_transfer_flag &&
    include_invoices_flag == other.include_invoices_flag &&
    invoice_format == other.invoice_format &&
    include_expenses_flag == other.include_expenses_flag &&
    transfer_expenses_as_bill_flag == other.transfer_expenses_as_bill_flag &&
    expense_format == other.expense_format &&
    suppress_memo_flag == other.suppress_memo_flag &&
    sync_payment_info_flag == other.sync_payment_info_flag &&
    include_sales_tax_flag == other.include_sales_tax_flag &&
    enable_tax_groups_flag == other.enable_tax_groups_flag &&
    zero_dollar_tax_amounts_flag == other.zero_dollar_tax_amounts_flag &&
    include_items_flag == other.include_items_flag &&
    inventory_soh_flag == other.inventory_soh_flag &&
    send_component_amount_flag == other.send_component_amount_flag &&
    send_uom_flag == other.send_uom_flag &&
    include_cogs_entries_flag == other.include_cogs_entries_flag &&
    include_cogs_drop_ship_flag == other.include_cogs_drop_ship_flag
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type



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

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



349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 349

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



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 255

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

See Also:

  • `==` method


235
236
237
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 235

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.



241
242
243
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 241

def hash
  [id, accounting_package, direct_transfer_flag, include_invoices_flag, invoice_format, include_expenses_flag, transfer_expenses_as_bill_flag, expense_format, suppress_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, include_cogs_drop_ship_flag].hash
end

#list_invalid_propertiesObject

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



172
173
174
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 172

def list_invalid_properties
  []
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



325
326
327
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 325

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 331

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



319
320
321
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 319

def to_s
  to_hash.to_s
end

#valid?Boolean

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



178
179
180
181
182
183
184
185
186
# File 'lib/connect_wise/models/accounting_package_setup.rb', line 178

def valid?
  invoice_format_validator = EnumAttributeValidator.new('String', %w[Default Condensed Detailed])
  return false unless invoice_format_validator.valid?(@invoice_format)

  expense_format_validator = EnumAttributeValidator.new('String', %w[Default Condensed])
  return false unless expense_format_validator.valid?(@expense_format)

  true
end