Sha256: 7d33efef4e4396695cb4fefae457921e829dd3aab9799119775312ebd6984683

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

module Lokalise
  module Connection
    BASE_URL = 'https://api.lokalise.co/api2/'

    def connection(client)
      options = {
        headers: {
          accept: 'application/json',
          user_agent: "ruby-lokalise-api gem/#{Lokalise::VERSION}",
          'x-api-token': client.token
        },
        url: BASE_URL
      }
      Faraday.new(options, request_params_for(client)) { |faraday| faraday.adapter Faraday.default_adapter }
    end

    private

    # Allows to customize request params per-client
    def request_params_for(client)
      {request: {timeout: client.timeout, open_timeout: client.open_timeout}}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-lokalise-api-2.9.0.1 lib/ruby-lokalise-api/connection.rb
ruby-lokalise-api-2.9.0 lib/ruby-lokalise-api/connection.rb