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