Class: Tremendous::Invoice::InvoiceResource

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

Instance Attribute Summary

Attributes included from Request

#access_token, #uri

Instance Method Summary collapse

Methods included from Request

#_execute, #delete, #get, #handle_response, #initialize, #post, #put, #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



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

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

#list(filters = {}) ⇒ Object



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

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

#show(id) ⇒ Object



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

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