Class: ApiBrasil::Services::BaseService
- Inherits:
-
Object
- Object
- ApiBrasil::Services::BaseService
show all
- Defined in:
- lib/api_brasil/services/base_service.rb
Overview
Base de todos os servicos - guarda o cliente HTTP compartilhado e
expoe os atalhos por verbo.
Direct Known Subclasses
Data::BulkService, Data::ChipVirtualService, Data::ConsultaService, Data::DatabaseIpService, Data::LoteriasService, Data::UraService, DeviceProxyService, Messaging::EvolutionService, Messaging::WhatsMeowService, Platform::AccountService, Platform::AuthService, Platform::BearerRateLimitService, Platform::CatalogService, Platform::DevicesService, Platform::IpWhitelistService, Platform::PaymentsService, Platform::ReportsService
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#delete(path, body = nil, options = {}) ⇒ Object
-
#download(path, options = {}) ⇒ String
Baixa os bytes crus de uma rota (PDF, imagens...).
-
#get(path, options = {}) ⇒ Object
-
#initialize(http) ⇒ BaseService
constructor
A new instance of BaseService.
-
#patch(path, body = nil, options = {}) ⇒ Object
-
#post(path, body = nil, options = {}) ⇒ Object
-
#put(path, body = nil, options = {}) ⇒ Object
Constructor Details
Returns a new instance of BaseService.
12
13
14
|
# File 'lib/api_brasil/services/base_service.rb', line 12
def initialize(http)
@http = http
end
|
Instance Attribute Details
9
10
11
|
# File 'lib/api_brasil/services/base_service.rb', line 9
def http
@http
end
|
Instance Method Details
#delete(path, body = nil, options = {}) ⇒ Object
37
38
39
|
# File 'lib/api_brasil/services/base_service.rb', line 37
def delete(path, body = nil, options = {})
http.delete(path, body, options)
end
|
#download(path, options = {}) ⇒ String
Baixa os bytes crus de uma rota (PDF, imagens...).
44
45
46
|
# File 'lib/api_brasil/services/base_service.rb', line 44
def download(path, options = {})
http.get(path, { response_type: "raw" }.merge(options))
end
|
#get(path, options = {}) ⇒ Object
17
18
19
|
# File 'lib/api_brasil/services/base_service.rb', line 17
def get(path, options = {})
http.get(path, options)
end
|
#patch(path, body = nil, options = {}) ⇒ Object
32
33
34
|
# File 'lib/api_brasil/services/base_service.rb', line 32
def patch(path, body = nil, options = {})
http.patch(path, body, options)
end
|
#post(path, body = nil, options = {}) ⇒ Object
22
23
24
|
# File 'lib/api_brasil/services/base_service.rb', line 22
def post(path, body = nil, options = {})
http.post(path, body, options)
end
|
#put(path, body = nil, options = {}) ⇒ Object
27
28
29
|
# File 'lib/api_brasil/services/base_service.rb', line 27
def put(path, body = nil, options = {})
http.put(path, body, options)
end
|