Sha256: 4e81a5758766a74cc861f551b12c733bbffb1967b096675d5bb111e86492a259

Contents?: true

Size: 988 Bytes

Versions: 5

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true

module FirebaseDynamicLink
  # Responsible to do HTTP request
  class Connection
    extend Forwardable

    # @!method post
    #   see Faraday::Connection#post
    def_delegators :client, :post

    def initialize(end_point)
      @client = Faraday::Connection.new(url: end_point,
                                        headers: { 'Content-Type' => 'application/json' })

      client.options.timeout = FirebaseDynamicLink.config.timeout
      client.options.open_timeout = FirebaseDynamicLink.config.open_timeout
    end

    # @see Faraday.timeout=
    def timeout=(time)
      client.options.timeout = time
    end

    # @see Faraday.timeout
    def timeout
      client.options.timeout
    end

    # @see Faraday.open_timeout=
    def open_timeout=(time)
      client.options.open_timeout = time
    end

    # @see Faraday.open_timeout
    def open_timeout
      client.options.open_timeout
    end

    private

    attr_reader :client
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
firebase_dynamic_link-3.0.0 lib/firebase_dynamic_link/connection.rb
firebase_dynamic_link-2.0.1 lib/firebase_dynamic_link/connection.rb
firebase_dynamic_link-2.0.0 lib/firebase_dynamic_link/connection.rb
firebase_dynamic_link-1.1.0 lib/firebase_dynamic_link/connection.rb
firebase_dynamic_link-1.0.5 lib/firebase_dynamic_link/connection.rb