Class: Intrinsic::AsyncRequestClient
- Inherits:
-
Object
- Object
- Intrinsic::AsyncRequestClient
- Defined in:
- lib/requests.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
Constructor Details
#initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil) ⇒ AsyncRequestClient
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/requests.rb', line 43 def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil) @default_environment = environment @base_url = environment @headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "Intrinsic", "X-Fern-SDK-Version": "0.0.2", "X-API-Key": api_key.to_s } @conn = Faraday.new(@base_url, headers: @headers) do |faraday| faraday.request :json faraday.response :raise_error, include_request: true faraday.adapter :async_http faraday.request :retry, { max: max_retries } unless max_retries.nil? faraday..timeout = timeout_in_seconds unless timeout_in_seconds.nil? end end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
36 37 38 |
# File 'lib/requests.rb', line 36 def base_url @base_url end |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
36 37 38 |
# File 'lib/requests.rb', line 36 def conn @conn end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
36 37 38 |
# File 'lib/requests.rb', line 36 def headers @headers end |