Class: Billimatic::Resources::Invoice

Inherits:
InvoiceRule show all
Defined in:
lib/billimatic/resources/invoice.rb

Instance Attribute Summary

Attributes inherited from Base

#http

Instance Method Summary collapse

Methods inherited from InvoiceRule

#create, #list, #update

Methods inherited from Base

#collection_name, #create, crud, #initialize, #list, #list_by_organization, #parsed_body, #show_by_organization, #update

Methods included from Hooks

#notify

Constructor Details

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

Instance Method Details

#approve(id, contract_id:) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/billimatic/resources/invoice.rb', line 43

def approve(id, contract_id:)
  http.patch(
    "/contracts/#{contract_id}/invoices/#{id}/approve"
  ) do |response|
    respond_with_entity response
  end
end

#block(id, contract_id:) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/billimatic/resources/invoice.rb', line 35

def block(id, contract_id:)
  http.patch(
    "/contracts/#{contract_id}/invoices/#{id}/block"
  ) do |response|
    respond_with_entity response
  end
end

#destroy(id, contract_id:) ⇒ Object



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

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

#late(contract_id:) ⇒ Object



13
14
15
16
17
# File 'lib/billimatic/resources/invoice.rb', line 13

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

#search(contract_id:, issue_date_from:, issue_date_to:) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/billimatic/resources/invoice.rb', line 4

def search(contract_id:, issue_date_from:, issue_date_to:)
  http.get(
    "/contracts/#{contract_id}#{resource_base_path}/search",
    params: { issue_date_from: issue_date_from, issue_date_to: issue_date_to }
  ) do |response|
    respond_with_collection response
  end
end

#show(id, contract_id:) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/billimatic/resources/invoice.rb', line 19

def show(id, contract_id:)
  http.get(
    "/contracts/#{contract_id}#{resource_base_path}/#{id}"
  ) do |response|
    respond_with_entity response
  end
end