Class: AdvancedBilling::ListInvoiceEventsResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/list_invoice_events_response.rb

Overview

ListInvoiceEventsResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(events = SKIP, page = SKIP, per_page = SKIP, total_pages = SKIP) ⇒ ListInvoiceEventsResponse

Returns a new instance of ListInvoiceEventsResponse.



53
54
55
56
57
58
59
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 53

def initialize(events = SKIP, page = SKIP, per_page = SKIP,
               total_pages = SKIP)
  @events = events unless events == SKIP
  @page = page unless page == SKIP
  @per_page = per_page unless per_page == SKIP
  @total_pages = total_pages unless total_pages == SKIP
end

Instance Attribute Details

#eventsArray[InvoiceEvent]

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 14

def events
  @events
end

#pageInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 18

def page
  @page
end

#per_pageInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 22

def per_page
  @per_page
end

#total_pagesInteger

TODO: Write general description for this method

Returns:

  • (Integer)


26
27
28
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 26

def total_pages
  @total_pages
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  events = nil
  unless hash['events'].nil?
    events = []
    hash['events'].each do |structure|
      events << (InvoiceEvent.from_hash(structure) if structure)
    end
  end

  events = SKIP unless hash.key?('events')
  page = hash.key?('page') ? hash['page'] : SKIP
  per_page = hash.key?('per_page') ? hash['per_page'] : SKIP
  total_pages = hash.key?('total_pages') ? hash['total_pages'] : SKIP

  # Create object from extracted values.
  ListInvoiceEventsResponse.new(events,
                                page,
                                per_page,
                                total_pages)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['events'] = 'events'
  @_hash['page'] = 'page'
  @_hash['per_page'] = 'per_page'
  @_hash['total_pages'] = 'total_pages'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/advanced_billing/models/list_invoice_events_response.rb', line 39

def self.optionals
  %w[
    events
    page
    per_page
    total_pages
  ]
end