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