Class: Tremendous::Invoice::InvoiceResource

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

Instance Method Summary collapse

Methods included from Request

#_execute, #access_token, #delete, #get, #handle_response, #initialize, #post, #put, #uri, #url

Instance Method Details

#create!(data = {}) ⇒ Object



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

def create!(data={})
  post(
    'invoices',
    {
      body: data.to_json,
      headers: { 'Content-Type' => 'application/json' }
    }
  )[:invoice]
end

#delete!(id) ⇒ Object



39
40
41
# File 'lib/tremendous/invoice.rb', line 39

def delete!(id)
  delete("invoices/#{id}")[:invoice]
end

#list(filters = {}) ⇒ Object



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

def list(filters={})
  get(
    'invoices',
    query: filters,
    format: 'json'
  )[:invoices]
end

#show(id) ⇒ Object



35
36
37
# File 'lib/tremendous/invoice.rb', line 35

def show(id)
  get("invoices/#{id}")[:invoice]
end