Class: Propertyware::SaveVendor

Inherits:
Object
  • Object
show all
Defined in:
lib/propertyware/models/save_vendor.rb

Overview

Vendor for Request

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SaveVendor

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/propertyware/models/save_vendor.rb', line 216

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Propertyware::SaveVendor` initialize method"
  end

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

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

  if attributes.key?(:'address')
    self.address = attributes[:'address']
  end

  if attributes.key?(:'address2')
    self.address2 = attributes[:'address2']
  end

  if attributes.key?(:'alert_email')
    self.alert_email = attributes[:'alert_email']
  end

  if attributes.key?(:'city')
    self.city = attributes[:'city']
  end

  if attributes.key?(:'company_name')
    self.company_name = attributes[:'company_name']
  end

  if attributes.key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.key?(:'credit_limit')
    self.credit_limit = attributes[:'credit_limit']
  end

  if attributes.key?(:'days_to_pay')
    self.days_to_pay = attributes[:'days_to_pay']
  end

  if attributes.key?(:'default_bill_split_account_id')
    self. = attributes[:'default_bill_split_account_id']
  end

  if attributes.key?(:'default_markup_discount_percentage')
    self.default_markup_discount_percentage = attributes[:'default_markup_discount_percentage']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'eligible1099')
    self.eligible1099 = attributes[:'eligible1099']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'fax')
    self.fax = attributes[:'fax']
  end

  if attributes.key?(:'include_company_name_on1099')
    self.include_company_name_on1099 = attributes[:'include_company_name_on1099']
  end

  if attributes.key?(:'markup_account_id')
    self. = attributes[:'markup_account_id']
  end

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

  if attributes.key?(:'name_on_check')
    self.name_on_check = attributes[:'name_on_check']
  end

  if attributes.key?(:'phone')
    self.phone = attributes[:'phone']
  end

  if attributes.key?(:'search_tag')
    self.search_tag = attributes[:'search_tag']
  end

  if attributes.key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.key?(:'sync_to_vmm')
    self.sync_to_vmm = attributes[:'sync_to_vmm']
  end

  if attributes.key?(:'tax_id')
    self.tax_id = attributes[:'tax_id']
  end

  if attributes.key?(:'tax_payer_name')
    self.tax_payer_name = attributes[:'tax_payer_name']
  end

  if attributes.key?(:'terms')
    self.terms = attributes[:'terms']
  end

  if attributes.key?(:'time_tracking')
    self.time_tracking = attributes[:'time_tracking']
  end

  if attributes.key?(:'vendor_type')
    self.vendor_type = attributes[:'vendor_type']
  end

  if attributes.key?(:'website')
    self.website = attributes[:'website']
  end

  if attributes.key?(:'zip')
    self.zip = attributes[:'zip']
  end
end

Instance Attribute Details

#account_numberObject

Account Number



20
21
22
# File 'lib/propertyware/models/save_vendor.rb', line 20

def 
  @account_number
end

#addressObject

Address



23
24
25
# File 'lib/propertyware/models/save_vendor.rb', line 23

def address
  @address
end

#address2Object

Address2



26
27
28
# File 'lib/propertyware/models/save_vendor.rb', line 26

def address2
  @address2
end

#alert_emailObject

Alert Email



29
30
31
# File 'lib/propertyware/models/save_vendor.rb', line 29

def alert_email
  @alert_email
end

#cityObject

City



32
33
34
# File 'lib/propertyware/models/save_vendor.rb', line 32

def city
  @city
end

#company_nameObject

Vendor Company Name



35
36
37
# File 'lib/propertyware/models/save_vendor.rb', line 35

def company_name
  @company_name
end

#countryObject

Country



38
39
40
# File 'lib/propertyware/models/save_vendor.rb', line 38

def country
  @country
end

#credit_limitObject

Credit Limit



41
42
43
# File 'lib/propertyware/models/save_vendor.rb', line 41

def credit_limit
  @credit_limit
end

#days_to_payObject

Payment Terms days to pay.



44
45
46
# File 'lib/propertyware/models/save_vendor.rb', line 44

def days_to_pay
  @days_to_pay
end

#default_bill_split_account_idObject

Default bill split id



47
48
49
# File 'lib/propertyware/models/save_vendor.rb', line 47

def 
  @default_bill_split_account_id
end

#default_markup_discount_percentageObject

Default markup discount



50
51
52
# File 'lib/propertyware/models/save_vendor.rb', line 50

def default_markup_discount_percentage
  @default_markup_discount_percentage
end

#descriptionObject

Description



53
54
55
# File 'lib/propertyware/models/save_vendor.rb', line 53

def description
  @description
end

#eligible1099Object

Eligible For 1099



56
57
58
# File 'lib/propertyware/models/save_vendor.rb', line 56

def eligible1099
  @eligible1099
end

#emailObject

EMail



59
60
61
# File 'lib/propertyware/models/save_vendor.rb', line 59

def email
  @email
end

#faxObject

Fax



62
63
64
# File 'lib/propertyware/models/save_vendor.rb', line 62

def fax
  @fax
end

#include_company_name_on1099Object

Include company name on 1099



65
66
67
# File 'lib/propertyware/models/save_vendor.rb', line 65

def include_company_name_on1099
  @include_company_name_on1099
end

#markup_account_idObject

Markup account id



68
69
70
# File 'lib/propertyware/models/save_vendor.rb', line 68

def 
  @markup_account_id
end

#nameObject

Vendor Name



71
72
73
# File 'lib/propertyware/models/save_vendor.rb', line 71

def name
  @name
end

#name_on_checkObject

Vendor Name On Check



74
75
76
# File 'lib/propertyware/models/save_vendor.rb', line 74

def name_on_check
  @name_on_check
end

#phoneObject

Phone



77
78
79
# File 'lib/propertyware/models/save_vendor.rb', line 77

def phone
  @phone
end

#search_tagObject

Search Tag



80
81
82
# File 'lib/propertyware/models/save_vendor.rb', line 80

def search_tag
  @search_tag
end

#stateObject

State



83
84
85
# File 'lib/propertyware/models/save_vendor.rb', line 83

def state
  @state
end

#sync_to_vmmObject

Sync to maintenance



86
87
88
# File 'lib/propertyware/models/save_vendor.rb', line 86

def sync_to_vmm
  @sync_to_vmm
end

#tax_idObject

Tax ID



89
90
91
# File 'lib/propertyware/models/save_vendor.rb', line 89

def tax_id
  @tax_id
end

#tax_payer_nameObject

Tax Payer Name



92
93
94
# File 'lib/propertyware/models/save_vendor.rb', line 92

def tax_payer_name
  @tax_payer_name
end

#termsObject

Payment Terms Description, default value(‘NET 30’)



95
96
97
# File 'lib/propertyware/models/save_vendor.rb', line 95

def terms
  @terms
end

#time_trackingObject

Time Tracking, is enabled or disabled



98
99
100
# File 'lib/propertyware/models/save_vendor.rb', line 98

def time_tracking
  @time_tracking
end

#vendor_typeObject

Vendor type. This is a user configurable list with the following initial default values <Banking - General>, <Banking - Mortgage>, <Banking - Investment>, <Contractors - Carpentry>, <Contractors - Dry Wall>, <Contractors - Electrical>, <Contractors - Fencing>, <Contractors - Flooring>, <Contractors - General>, <Contractors - HVAC>, <Contractors - Landscaping>, <Contractors - Masonry>, <Contractors - Miscellaneous>, <Contractors - Painting>, <Contractors - Paving>, <Contractors - Plumbing>, <Contractors - Roofing>, <Contractors - Sheet Metal>, <Contractors - Windows>, <Owners>, <Management Company>, <Suppliers - Carpets>, <Suppliers - Electrical>, <Suppliers - General>, <Suppliers - Lighting>, <Suppliers - Lumber>, <Suppliers - Plumbing>, <Suppliers - Security>, <Suppliers - Stone>, <Suppliers - Tiling>, <Suppliers - Windows>, <Utilities - Communications>, <Utilities - Gas & Electric>, <Utilities - Waste Management>, <Utilities - Water>



101
102
103
# File 'lib/propertyware/models/save_vendor.rb', line 101

def vendor_type
  @vendor_type
end

#websiteObject

Website



104
105
106
# File 'lib/propertyware/models/save_vendor.rb', line 104

def website
  @website
end

#zipObject

Zip



107
108
109
# File 'lib/propertyware/models/save_vendor.rb', line 107

def zip
  @zip
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



168
169
170
# File 'lib/propertyware/models/save_vendor.rb', line 168

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/propertyware/models/save_vendor.rb', line 132

def self.attribute_map
  {
    :'account_number' => :'accountNumber',
    :'address' => :'address',
    :'address2' => :'address2',
    :'alert_email' => :'alertEmail',
    :'city' => :'city',
    :'company_name' => :'companyName',
    :'country' => :'country',
    :'credit_limit' => :'creditLimit',
    :'days_to_pay' => :'daysToPay',
    :'default_bill_split_account_id' => :'defaultBillSplitAccountId',
    :'default_markup_discount_percentage' => :'defaultMarkupDiscountPercentage',
    :'description' => :'description',
    :'eligible1099' => :'eligible1099',
    :'email' => :'email',
    :'fax' => :'fax',
    :'include_company_name_on1099' => :'includeCompanyNameOn1099',
    :'markup_account_id' => :'markupAccountId',
    :'name' => :'name',
    :'name_on_check' => :'nameOnCheck',
    :'phone' => :'phone',
    :'search_tag' => :'searchTag',
    :'state' => :'state',
    :'sync_to_vmm' => :'syncToVMM',
    :'tax_id' => :'taxID',
    :'tax_payer_name' => :'taxPayerName',
    :'terms' => :'terms',
    :'time_tracking' => :'timeTracking',
    :'vendor_type' => :'vendorType',
    :'website' => :'website',
    :'zip' => :'zip'
  }
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



447
448
449
# File 'lib/propertyware/models/save_vendor.rb', line 447

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

.openapi_nullableObject

List of attributes with nullable: true



209
210
211
212
# File 'lib/propertyware/models/save_vendor.rb', line 209

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/propertyware/models/save_vendor.rb', line 173

def self.openapi_types
  {
    :'account_number' => :'String',
    :'address' => :'String',
    :'address2' => :'String',
    :'alert_email' => :'String',
    :'city' => :'String',
    :'company_name' => :'String',
    :'country' => :'String',
    :'credit_limit' => :'Float',
    :'days_to_pay' => :'Integer',
    :'default_bill_split_account_id' => :'Integer',
    :'default_markup_discount_percentage' => :'Float',
    :'description' => :'String',
    :'eligible1099' => :'Boolean',
    :'email' => :'String',
    :'fax' => :'String',
    :'include_company_name_on1099' => :'Boolean',
    :'markup_account_id' => :'Integer',
    :'name' => :'String',
    :'name_on_check' => :'String',
    :'phone' => :'String',
    :'search_tag' => :'String',
    :'state' => :'String',
    :'sync_to_vmm' => :'Boolean',
    :'tax_id' => :'String',
    :'tax_payer_name' => :'String',
    :'terms' => :'String',
    :'time_tracking' => :'Boolean',
    :'vendor_type' => :'String',
    :'website' => :'String',
    :'zip' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/propertyware/models/save_vendor.rb', line 397

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      address == o.address &&
      address2 == o.address2 &&
      alert_email == o.alert_email &&
      city == o.city &&
      company_name == o.company_name &&
      country == o.country &&
      credit_limit == o.credit_limit &&
      days_to_pay == o.days_to_pay &&
       == o. &&
      default_markup_discount_percentage == o.default_markup_discount_percentage &&
      description == o.description &&
      eligible1099 == o.eligible1099 &&
      email == o.email &&
      fax == o.fax &&
      include_company_name_on1099 == o.include_company_name_on1099 &&
       == o. &&
      name == o.name &&
      name_on_check == o.name_on_check &&
      phone == o.phone &&
      search_tag == o.search_tag &&
      state == o.state &&
      sync_to_vmm == o.sync_to_vmm &&
      tax_id == o.tax_id &&
      tax_payer_name == o.tax_payer_name &&
      terms == o.terms &&
      time_tracking == o.time_tracking &&
      vendor_type == o.vendor_type &&
      website == o.website &&
      zip == o.zip
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



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/propertyware/models/save_vendor.rb', line 478

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 = Propertyware.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



549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/propertyware/models/save_vendor.rb', line 549

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



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/propertyware/models/save_vendor.rb', line 454

def build_from_hash(attributes)
  return 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)
      self.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
      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
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


434
435
436
# File 'lib/propertyware/models/save_vendor.rb', line 434

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



440
441
442
# File 'lib/propertyware/models/save_vendor.rb', line 440

def hash
  [, address, address2, alert_email, city, company_name, country, credit_limit, days_to_pay, , default_markup_discount_percentage, description, eligible1099, email, fax, include_company_name_on1099, , name, name_on_check, phone, search_tag, state, sync_to_vmm, tax_id, tax_payer_name, terms, time_tracking, vendor_type, website, zip].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/propertyware/models/save_vendor.rb', line 352

def list_invalid_properties
  invalid_properties = Array.new
  if @company_name.nil?
    invalid_properties.push('invalid value for "company_name", company_name cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @name_on_check.nil?
    invalid_properties.push('invalid value for "name_on_check", name_on_check cannot be nil.')
  end

  if @vendor_type.nil?
    invalid_properties.push('invalid value for "vendor_type", vendor_type cannot be nil.')
  end

  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



525
526
527
# File 'lib/propertyware/models/save_vendor.rb', line 525

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



531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/propertyware/models/save_vendor.rb', line 531

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



519
520
521
# File 'lib/propertyware/models/save_vendor.rb', line 519

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



375
376
377
378
379
380
381
382
383
# File 'lib/propertyware/models/save_vendor.rb', line 375

def valid?
  return false if @company_name.nil?
  days_to_pay_validator = EnumAttributeValidator.new('Integer', [0, 5, 10, 15, 30, 45, 60, 90])
  return false unless days_to_pay_validator.valid?(@days_to_pay)
  return false if @name.nil?
  return false if @name_on_check.nil?
  return false if @vendor_type.nil?
  true
end