Class: Billimatic::Resources::InvoiceRule

Inherits:
Base
  • Object
show all
Defined in:
lib/billimatic/resources/invoice_rule.rb

Direct Known Subclasses

Invoice

Instance Attribute Summary

Attributes inherited from Base

#http

Instance Method Summary collapse

Methods inherited from Base

#collection_name, crud, #initialize, #list_by_organization, #parsed_body, #show, #show_by_organization

Methods included from Hooks

#notify

Constructor Details

This class inherits a constructor from Billimatic::Resources::Base

Instance Method Details

#create(params, contract_id:) ⇒ Object



10
11
12
13
14
15
# File 'lib/billimatic/resources/invoice_rule.rb', line 10

def create(params, contract_id:)
  http.post(
    "/contracts/#{contract_id}#{resource_base_path}",
    body: { underscored_klass_name.to_sym => params }
  ) { |response| respond_with_entity(response) }
end

#destroy(id, contract_id:) ⇒ Object



24
25
26
27
28
# File 'lib/billimatic/resources/invoice_rule.rb', line 24

def destroy(id, contract_id:)
  http.delete(
    "/contracts/#{contract_id}#{resource_base_path}/#{id}"
  ) { |response| response.code == 204 }
end

#list(contract_id:) ⇒ Object



4
5
6
7
8
# File 'lib/billimatic/resources/invoice_rule.rb', line 4

def list(contract_id:)
  http.get(
    "/contracts/#{contract_id}#{resource_base_path}"
  ) { |response| respond_with_collection(response) }
end

#update(id, params, contract_id:) ⇒ Object



17
18
19
20
21
22
# File 'lib/billimatic/resources/invoice_rule.rb', line 17

def update(id, params, contract_id:)
  http.put(
    "/contracts/#{contract_id}#{resource_base_path}/#{id}",
    body: { underscored_klass_name.to_sym => params }
  ) { |response| respond_with_entity(response) }
end