Class: Flagsmith::ApiClient

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/flagsmith/sdk/api_client.rb

Overview

Ruby client for flagsmith.com

Constant Summary collapse

HTTP_METHODS_ALLOW_LIST =
%i[get post].freeze

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ApiClient

Returns a new instance of ApiClient.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/flagsmith/sdk/api_client.rb', line 14

def initialize(config)
  @conn = Faraday.new(url: config.api_url) do |f|
    build_headers(f, config)
    f.response :json, parser_options: { symbolize_names: true }
    f.adapter Faraday.default_adapter

    f.options.timeout = config.request_timeout_seconds
    configure_logger(f, config)
    configure_retries(f, config)
  end

  freeze
end