Class: Ravelin::ProxyClient
- Defined in:
- lib/ravelin/proxy_client.rb
Constant Summary
Constants inherited from Client
Instance Method Summary collapse
- #faraday_proxy_options ⇒ Object
-
#initialize(base_url:, username:, password:, api_version: 2) ⇒ ProxyClient
constructor
A new instance of ProxyClient.
Methods inherited from Client
#delete_tag, #get_tag, #send_backfill_event, #send_event, #send_tag
Constructor Details
#initialize(base_url:, username:, password:, api_version: 2) ⇒ ProxyClient
Returns a new instance of ProxyClient.
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ravelin/proxy_client.rb', line 3 def initialize(base_url:, username:, password:, api_version: 2) raise ArgumentError, "api_version must be 2 or 3" unless [2,3].include? api_version @api_version = api_version @url_prefix = '/ravelinproxy' @connection = Faraday.new(base_url, ) do |conn| conn.response :json, context_type: /\bjson$/ conn.adapter Ravelin.faraday_adapter conn.basic_auth(username, password) end end |
Instance Method Details
#faraday_proxy_options ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/ravelin/proxy_client.rb', line 16 def { request: { timeout: Ravelin.faraday_timeout }, headers: { 'Content-Type' => 'application/json; charset=utf-8'.freeze, 'User-Agent' => "Ravelin Proxy RubyGem/#{Ravelin::VERSION}".freeze } } end |