Class: Tremendous::Invoice

Inherits:
Object
  • Object
show all
Defined in:
lib/tremendous/invoice.rb

Class Method Summary collapse

Class Method Details

.create!(data = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tremendous/invoice.rb', line 4

def self.create!(data={})
  data_to_post = data.merge(Tremendous.default_options)

  response = Tremendous::Request.post(
    'invoices',
    {
      body: data_to_post.to_json,
      headers: { 'Content-Type' => 'application/json' }
    }
  )[:invoice]

end

.delete(id) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/tremendous/invoice.rb', line 25

def self.delete(id)
  Tremendous::Request.delete(
    "invoices/#{id}",
      query: Tremendous.default_options,
      format: 'json'
  )[:invoice]
end

.list(filters = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/tremendous/invoice.rb', line 17

def self.list(filters={})
  Tremendous::Request.get(
    'invoices',
    query: filters.merge(Tremendous.default_options),
    format: 'json'
  )[:invoices]
end

.render(id) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/tremendous/invoice.rb', line 33

def self.render(id)
  Tremendous::Request.get(
    "invoices/#{id}",
      query: Tremendous.default_options,
      format: 'json'
  )[:invoice]
end