Class: SubskribeSandboxClient::InvoiceJson

Inherits:
Object
  • Object
show all
Defined in:
lib/subskribe_sandbox/models/invoice_json.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InvoiceJson

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 149

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'invoiceItems')
    if (value = attributes[:'invoiceItems']).is_a?(Array)
      self.invoice_items = value
    end
  end

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



43
44
45
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 43

def 
  @account_id
end

#billing_contactObject

Returns the value of attribute billing_contact.



47
48
49
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 47

def billing_contact
  @billing_contact
end

#currencyObject

Returns the value of attribute currency.



27
28
29
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 27

def currency
  @currency
end

#due_dateObject

Returns the value of attribute due_date.



25
26
27
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 25

def due_date
  @due_date
end

#email_notifiers_listObject

Returns the value of attribute email_notifiers_list.



59
60
61
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 59

def email_notifiers_list
  @email_notifiers_list
end

#erp_idObject

Returns the value of attribute erp_id.



61
62
63
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 61

def erp_id
  @erp_id
end

#generation_methodObject

Returns the value of attribute generation_method.



63
64
65
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 63

def generation_method
  @generation_method
end

#invoice_dateObject

Returns the value of attribute invoice_date.



21
22
23
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 21

def invoice_date
  @invoice_date
end

#invoice_itemsObject

Returns the value of attribute invoice_items.



45
46
47
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 45

def invoice_items
  @invoice_items
end

#invoice_numberObject

Returns the value of attribute invoice_number.



17
18
19
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 17

def invoice_number
  @invoice_number
end

#noteObject

Returns the value of attribute note.



57
58
59
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 57

def note
  @note
end

#payment_termObject

Returns the value of attribute payment_term.



29
30
31
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 29

def payment_term
  @payment_term
end

#posted_dateObject

Returns the value of attribute posted_date.



19
20
21
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 19

def posted_date
  @posted_date
end

#purchase_order_numberObject

Returns the value of attribute purchase_order_number.



53
54
55
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 53

def purchase_order_number
  @purchase_order_number
end

#purchase_order_requiredObject

Returns the value of attribute purchase_order_required.



55
56
57
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 55

def purchase_order_required
  @purchase_order_required
end

#shipping_contactObject

Returns the value of attribute shipping_contact.



49
50
51
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 49

def shipping_contact
  @shipping_contact
end

#statusObject

Returns the value of attribute status.



51
52
53
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 51

def status
  @status
end

#sub_totalObject

Returns the value of attribute sub_total.



33
34
35
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 33

def sub_total
  @sub_total
end

#subscription_idObject

Returns the value of attribute subscription_id.



41
42
43
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 41

def subscription_id
  @subscription_id
end

#tax_totalObject

Returns the value of attribute tax_total.



35
36
37
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 35

def tax_total
  @tax_total
end

#tax_transaction_codeObject

Returns the value of attribute tax_transaction_code.



37
38
39
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 37

def tax_transaction_code
  @tax_transaction_code
end

#totalObject

Returns the value of attribute total.



39
40
41
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 39

def total
  @total
end

#total_discountObject

Returns the value of attribute total_discount.



31
32
33
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 31

def total_discount
  @total_discount
end

#voided_dateObject

Returns the value of attribute voided_date.



23
24
25
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 23

def voided_date
  @voided_date
end

Class Method Details

.attribute_mapObject

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



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 88

def self.attribute_map
  {
    :'invoice_number' => :'invoiceNumber',
    :'posted_date' => :'postedDate',
    :'invoice_date' => :'invoiceDate',
    :'voided_date' => :'voidedDate',
    :'due_date' => :'dueDate',
    :'currency' => :'currency',
    :'payment_term' => :'paymentTerm',
    :'total_discount' => :'totalDiscount',
    :'sub_total' => :'subTotal',
    :'tax_total' => :'taxTotal',
    :'tax_transaction_code' => :'taxTransactionCode',
    :'total' => :'total',
    :'subscription_id' => :'subscriptionId',
    :'account_id' => :'accountId',
    :'invoice_items' => :'invoiceItems',
    :'billing_contact' => :'billingContact',
    :'shipping_contact' => :'shippingContact',
    :'status' => :'status',
    :'purchase_order_number' => :'purchaseOrderNumber',
    :'purchase_order_required' => :'purchaseOrderRequired',
    :'note' => :'note',
    :'email_notifiers_list' => :'emailNotifiersList',
    :'erp_id' => :'erpId',
    :'generation_method' => :'generationMethod'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 118

def self.swagger_types
  {
    :'invoice_number' => :'String',
    :'posted_date' => :'Integer',
    :'invoice_date' => :'Integer',
    :'voided_date' => :'Integer',
    :'due_date' => :'Integer',
    :'currency' => :'String',
    :'payment_term' => :'String',
    :'total_discount' => :'Float',
    :'sub_total' => :'Float',
    :'tax_total' => :'Float',
    :'tax_transaction_code' => :'String',
    :'total' => :'Float',
    :'subscription_id' => :'String',
    :'account_id' => :'String',
    :'invoice_items' => :'Array<InvoiceItemJson>',
    :'billing_contact' => :'AccountContactJson',
    :'shipping_contact' => :'AccountContactJson',
    :'status' => :'String',
    :'purchase_order_number' => :'String',
    :'purchase_order_required' => :'BOOLEAN',
    :'note' => :'String',
    :'email_notifiers_list' => :'EmailNotifiersList',
    :'erp_id' => :'String',
    :'generation_method' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 293

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      invoice_number == o.invoice_number &&
      posted_date == o.posted_date &&
      invoice_date == o.invoice_date &&
      voided_date == o.voided_date &&
      due_date == o.due_date &&
      currency == o.currency &&
      payment_term == o.payment_term &&
      total_discount == o.total_discount &&
      sub_total == o.sub_total &&
      tax_total == o.tax_total &&
      tax_transaction_code == o.tax_transaction_code &&
      total == o.total &&
      subscription_id == o.subscription_id &&
       == o. &&
      invoice_items == o.invoice_items &&
      billing_contact == o.billing_contact &&
      shipping_contact == o.shipping_contact &&
      status == o.status &&
      purchase_order_number == o.purchase_order_number &&
      purchase_order_required == o.purchase_order_required &&
      note == o.note &&
      email_notifiers_list == o.email_notifiers_list &&
      erp_id == o.erp_id &&
      generation_method == o.generation_method
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



358
359
360
361
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
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 358

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



424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 424

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



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 337

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


324
325
326
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 324

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



330
331
332
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 330

def hash
  [invoice_number, posted_date, invoice_date, voided_date, due_date, currency, payment_term, total_discount, sub_total, tax_total, tax_transaction_code, total, subscription_id, , invoice_items, billing_contact, shipping_contact, status, purchase_order_number, purchase_order_required, note, email_notifiers_list, erp_id, generation_method].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



256
257
258
259
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 256

def list_invalid_properties
  invalid_properties = Array.new
  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



404
405
406
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 404

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



410
411
412
413
414
415
416
417
418
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 410

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



398
399
400
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 398

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



263
264
265
266
267
268
269
# File 'lib/subskribe_sandbox/models/invoice_json.rb', line 263

def valid?
  status_validator = EnumAttributeValidator.new('String', ['DRAFT', 'POSTED', 'PAID', 'CONVERTED', 'VOIDED'])
  return false unless status_validator.valid?(@status)
  generation_method_validator = EnumAttributeValidator.new('String', ['USER_INITIATED', 'API_INITIATED', 'BULK_INVOICE_RUN', 'AUTOMATED_INVOICE_JOB', 'RULE_DRIVEN_INVOICE_JOB'])
  return false unless generation_method_validator.valid?(@generation_method)
  true
end