Class: Aptly::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/aptly/connection.rb

Overview

Connection adaptor. This class wraps HTTP interactions for our purposes and adds general purpose automation on top of the raw HTTP actions.

Instance Method Summary collapse

Constructor Details

#initialize(config: ::Aptly.configuration, query: DEFAULT_QUERY, uri: config.uri) ⇒ Connection

New connection.

Parameters:

  • config (Configuration) (defaults to: ::Aptly.configuration)

    Configuration instance to use

  • query (Hash) (defaults to: DEFAULT_QUERY)

    Default HTTP query paramaters, these get the specific query parameters merged upon.

  • uri (URI) (defaults to: config.uri)

    Base URI for the remote (default from Aptly::Configuration#uri).


54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/aptly/connection.rb', line 54

def initialize(config: ::Aptly.configuration, query: DEFAULT_QUERY,
               uri: config.uri)
  @query = query
  @base_uri = uri
  raise if faraday_uri.nil?
  @config = config
  @connection = Faraday.new(faraday_uri) do |c|
    c.request :multipart
    c.request :url_encoded
    c.adapter :excon, @adapter_options
  end
end