Class: SplitIoClient::Api::Client
- Inherits:
-
Object
- Object
- SplitIoClient::Api::Client
show all
- Defined in:
- lib/engine/api/client.rb
Instance Method Summary
collapse
Instance Method Details
#get_api(url, config, api_key, params = {}) ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/engine/api/client.rb', line 4
def get_api(url, config, api_key, params = {})
api_client.get(url, params) do |req|
req. = (api_key, config).merge('Accept-Encoding' => 'gzip')
req.options.timeout = config.read_timeout
req.options.open_timeout = config.connection_timeout
config.logger.debug("GET #{url}") if config.debug_enabled
end
end
|
#post_api(url, config, api_key, data, params = {}) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/engine/api/client.rb', line 15
def post_api(url, config, api_key, data, params = {})
api_client.post(url) do |req|
req. = (api_key, config).merge('Content-Type' => 'application/json')
req.body = data.to_json
req.options.timeout = config.read_timeout
req.options.open_timeout = config.connection_timeout
if config.transport_debug_enabled
config.logger.debug("POST #{url} #{req.body}")
elsif config.debug_enabled
config.logger.debug("POST #{url}")
end
end
end
|