Class: Billimatic::Resources::Company

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

Instance Attribute Summary

Attributes inherited from Base

#http

Instance Method Summary collapse

Methods inherited from Base

#collection_name, #create, crud, #destroy, #list, #list_by_organization, #parsed_body, #show, #show_by_organization

Methods included from Hooks

#notify

Constructor Details

#initialize(http) ⇒ Company

Returns a new instance of Company.



6
7
8
9
# File 'lib/billimatic/resources/company.rb', line 6

def initialize(http)
  @collection_name = 'companies'
  super(http)
end

Instance Method Details

#search(cnpj) ⇒ Object

GET /api/v1/companies/search



12
13
14
15
16
# File 'lib/billimatic/resources/company.rb', line 12

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

#update(id, params) ⇒ Object

PATCH /api/v1/companies/:id



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

def update(id, params)
  http.patch("#{resource_base_path}/#{id}", body: params) do |response|
    respond_with_entity(response)
  end
end