Class: Pingram::ListInvoicesResponseInvoicesInner

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pingram/models/list_invoices_response_invoices_inner.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ ListInvoicesResponseInvoicesInner

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 125

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

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

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

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

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

  if attributes.key?(:'currency')
    self.currency = attributes[:'currency']
  else
    self.currency = nil
  end

  if attributes.key?(:'total')
    self.total = attributes[:'total']
  else
    self.total = nil
  end

  if attributes.key?(:'amount_due')
    self.amount_due = attributes[:'amount_due']
  else
    self.amount_due = nil
  end

  if attributes.key?(:'amount_paid')
    self.amount_paid = attributes[:'amount_paid']
  else
    self.amount_paid = nil
  end

  if attributes.key?(:'created')
    self.created = attributes[:'created']
  else
    self.created = nil
  end

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

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

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

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

Instance Attribute Details

#amount_dueObject

Returns the value of attribute amount_due.



30
31
32
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 30

def amount_due
  @amount_due
end

#amount_paidObject

Returns the value of attribute amount_paid.



32
33
34
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 32

def amount_paid
  @amount_paid
end

#createdObject

Unix timestamp (seconds) when the invoice was created.



35
36
37
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 35

def created
  @created
end

#currencyObject

Returns the value of attribute currency.



25
26
27
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 25

def currency
  @currency
end

#hosted_invoice_urlObject

Stripe-hosted invoice page (receipt / pay).



38
39
40
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 38

def hosted_invoice_url
  @hosted_invoice_url
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 18

def id
  @id
end

#invoice_pdfObject

Direct PDF download URL.



41
42
43
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 41

def invoice_pdf
  @invoice_pdf
end

#numberObject

Human-readable invoice number, when assigned.



21
22
23
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 21

def number
  @number
end

#period_endObject

Billing period end (unix seconds), when applicable.



47
48
49
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 47

def period_end
  @period_end
end

#period_startObject

Billing period start (unix seconds), when applicable.



44
45
46
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 44

def period_start
  @period_start
end

#statusObject

Returns the value of attribute status.



23
24
25
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 23

def status
  @status
end

#totalObject

Total amount due on the invoice (cents).



28
29
30
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 28

def total
  @total
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



90
91
92
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 90

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



95
96
97
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 95

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 72

def self.attribute_map
  {
    :'id' => :'id',
    :'number' => :'number',
    :'status' => :'status',
    :'currency' => :'currency',
    :'total' => :'total',
    :'amount_due' => :'amountDue',
    :'amount_paid' => :'amountPaid',
    :'created' => :'created',
    :'hosted_invoice_url' => :'hostedInvoiceUrl',
    :'invoice_pdf' => :'invoicePdf',
    :'period_start' => :'periodStart',
    :'period_end' => :'periodEnd'
  }
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



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

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



118
119
120
121
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 118

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

.openapi_typesObject

Attribute type mapping.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 100

def self.openapi_types
  {
    :'id' => :'String',
    :'number' => :'String',
    :'status' => :'String',
    :'currency' => :'String',
    :'total' => :'Float',
    :'amount_due' => :'Float',
    :'amount_paid' => :'Float',
    :'created' => :'Float',
    :'hosted_invoice_url' => :'String',
    :'invoice_pdf' => :'String',
    :'period_start' => :'Float',
    :'period_end' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 319

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      number == o.number &&
      status == o.status &&
      currency == o.currency &&
      total == o.total &&
      amount_due == o.amount_due &&
      amount_paid == o.amount_paid &&
      created == o.created &&
      hosted_invoice_url == o.hosted_invoice_url &&
      invoice_pdf == o.invoice_pdf &&
      period_start == o.period_start &&
      period_end == o.period_end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


338
339
340
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 338

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



344
345
346
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 344

def hash
  [id, number, status, currency, total, amount_due, amount_paid, created, hosted_invoice_url, invoice_pdf, period_start, period_end].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 202

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

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

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 373

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/pingram/models/list_invoices_response_invoices_inner.rb', line 234

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  status_validator = EnumAttributeValidator.new('String', ["draft", "open", "paid", "uncollectible", "void"])
  return false unless status_validator.valid?(@status)
  return false if @currency.nil?
  return false if @total.nil?
  return false if @amount_due.nil?
  return false if @amount_paid.nil?
  return false if @created.nil?
  true
end