Class: Invofox::Company
- Defined in:
- lib/invofox/resources/company.rb
Class Method Summary collapse
- .create(country_code:, tax_id:, name:) ⇒ Object
- .get(id:) ⇒ Object
-
.list(country_code:, tax_id:) ⇒ Object
TODO allow not required fields; for now we just need this scenario at Quipu.
- .update(id:, country_code:, tax_id:, name:) ⇒ Object
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
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/invofox/resources/company.rb', line 35 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
25 26 27 28 29 30 31 32 33 |
# File 'lib/invofox/resources/company.rb', line 25 def get(id:) Invofox.api_call( clazz: self, method: :get, path: "/companies/#{id}" ) do |response_body| response_body['result'] end end |
.list(country_code:, tax_id:) ⇒ Object
TODO allow not required fields; for now we just need this scenario at Quipu
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/invofox/resources/company.rb', line 11 def list(country_code:, tax_id:) Invofox.api_call( clazz: self, method: :get, path: "/companies", params: { countryCode: country_code, taxId: tax_id } ) do |response_body| response_body['result'] end end |
.update(id:, country_code:, tax_id:, name:) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/invofox/resources/company.rb', line 50 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 |