Class: Invofox::Company

Inherits:
Resource show all
Defined in:
lib/invofox/resources/company.rb

Class Method Summary collapse

Methods inherited from Resource

fields_information, #fields_information, has_fields, #initialize

Constructor Details

This class inherits a constructor from Invofox::Resource

Class Method Details

.create(country_code:, tax_id:, name:) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/invofox/resources/company.rb', line 20

def create(country_code:, tax_id:, name:)
  Invofox.api_call(
    clazz:  self,
    method: :post,
    path:   "/companies",
    params: {
      countryCode: country_code,
      taxId:       tax_id,
      name:        name
    }
  ) do |response_body|
    response_body['result']
  end
end

.get(id:) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/invofox/resources/company.rb', line 10

def get(id:)
  Invofox.api_call(
    clazz:  self,
    method: :get,
    path:   "/companies/#{id}"
  ) do |response_body|
    response_body['result']
  end
end

.update(id:, country_code:, tax_id:, name:) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/invofox/resources/company.rb', line 35

def update(id:, country_code:, tax_id:, name:)
  Invofox.api_call(
    clazz:  self,
    method: :put,
    path:   "/companies/#{id}",
    params: {
      countryCode: country_code,
      taxId:       tax_id,
      name:        name
    }
  ) do |response_body|
    response_body['result']
  end
end