Module: RubyLokaliseApi::Connection

Included in:
Request
Defined in:
lib/ruby_lokalise_api/connection.rb

Overview

Module to setup connection using Faraday

Instance Method Summary collapse

Instance Method Details

#connection(endpoint, params = {}) ⇒ Faraday::Connection

Creates a new Faraday object with specified params

Parameters:

  • endpoint (Object)

    the API endpoint

  • params (Hash) (defaults to: {})

    additional connection parameters

Returns:

  • (Faraday::Connection)

    the Faraday connection object



11
12
13
14
15
16
# File 'lib/ruby_lokalise_api/connection.rb', line 11

def connection(endpoint, params = {})
  Faraday.new(options(endpoint, params), request_params_for(endpoint.client)) do |faraday|
    faraday.adapter Faraday.default_adapter
    faraday.request :gzip
  end
end