Class: Emites::Resources::Taker
- Defined in:
- lib/emites/resources/taker.rb
Overview
A wrapper to Emites takers API
- API
-
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/taker.html
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(params) ⇒ Emites::Entities::Taker
Creates a Taker related to the Account.
-
#destroy(id) ⇒ Boolean
Deletes a Taker by it’s id.
-
#info(id) ⇒ Emites::Entities::Taker
Retrieves a Taker by it’s id.
-
#list ⇒ Array
Lists all takers related to the account.
-
#search(params) ⇒ Array
Lists all takers related to the account matching search results.
Methods inherited from Base
Methods included from Hooks
Constructor Details
This class inherits a constructor from Emites::Resources::Base
Instance Method Details
#create(params) ⇒ Emites::Entities::Taker
Creates a Taker related to the Account
- API
-
Method:
POST /api/v1/takers
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/taker.html#criacao
29 30 31 32 33 |
# File 'lib/emites/resources/taker.rb', line 29 def create(params) http.post("/takers", { body: params }) do |response| respond_with_entity(response) end end |
#destroy(id) ⇒ Boolean
Deletes a Taker by it’s id. Returns true</true> if deletion performed well, otherwise, returns <tt>false
.
- API
-
Method:
DELETE /api/v1/takers/:id
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/taker.html#remocao
89 90 91 92 93 |
# File 'lib/emites/resources/taker.rb', line 89 def destroy(id) http.delete("/takers/#{id}") do |response| response.code == 204 end end |
#info(id) ⇒ Emites::Entities::Taker
Retrieves a Taker by it’s id
- API
-
Method:
GET /api/v1/takers/:id
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/taker.html#detalhes
44 45 46 47 48 |
# File 'lib/emites/resources/taker.rb', line 44 def info(id) http.get("/takers/#{id}") do |response| respond_with_entity(response) end end |
#list ⇒ Array
Lists all takers related to the account
- API
-
Method:
GET /api/v1/takers
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/taker.html#listagem
58 59 60 61 62 |
# File 'lib/emites/resources/taker.rb', line 58 def list http.get("/takers") do |response| respond_with_collection(response) end end |
#search(params) ⇒ Array
Lists all takers related to the account matching search results
- API
-
Method:
GET /api/v1/takers?cnpj=:cnpj
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/taker.html#filtros
73 74 75 76 77 |
# File 'lib/emites/resources/taker.rb', line 73 def search(params) http.get("/takers", { params: params }) do |response| respond_with_collection(response) end end |