Class: Vellum::AsyncRequestClient
- Inherits:
-
Object
- Object
- Vellum::AsyncRequestClient
- Defined in:
- lib/requests.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
-
#default_environment ⇒ Object
readonly
Returns the value of attribute default_environment.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
Constructor Details
#initialize(api_key:, environment: Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil) ⇒ AsyncRequestClient
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/requests.rb', line 44 def initialize(api_key:, environment: Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil) @default_environment = environment @headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "Vellum", "X-Fern-SDK-Version": "0.3.15", "X_API_KEY": api_key.to_s } @conn = Faraday.new(headers: @headers) do |faraday| faraday.request :multipart 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
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
37 38 39 |
# File 'lib/requests.rb', line 37 def conn @conn end |
#default_environment ⇒ Object (readonly)
Returns the value of attribute default_environment.
37 38 39 |
# File 'lib/requests.rb', line 37 def default_environment @default_environment end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
37 38 39 |
# File 'lib/requests.rb', line 37 def headers @headers end |