class Bintray::Client::Ruby::HttpClient

Constants

DEFAULT_OPTIONS

Attributes

connection[R]
options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/bintray/client/ruby/http_client.rb, line 19
def initialize(options = {})
        @options = set_options(options)
        create_connection
end

Public Instance Methods

api() click to toggle source
# File lib/bintray/client/ruby/http_client.rb, line 24
def api
        @api ||= Api.new(connection)
end
log() click to toggle source
# File lib/bintray/client/ruby/http_client.rb, line 28
def log
        options[:logger_resource]
end

Private Instance Methods

bintray_url() click to toggle source
# File lib/bintray/client/ruby/http_client.rb, line 38
def bintray_url
        @bintray_url ||= File.join(options[:base], options[:version])
end
create_connection() click to toggle source
# File lib/bintray/client/ruby/http_client.rb, line 34
def create_connection
        @connection = ConnectionFactory.new(options.merge(url: bintray_url)).connect!
end
set_options(options) click to toggle source
# File lib/bintray/client/ruby/http_client.rb, line 42
def set_options(options)
        opts = DEFAULT_OPTIONS.merge(options)
        if opts[:username].blank? || opts[:password].blank?
                raise ::ArgumentError.new("username and/or password cannot be empty")
        end
        opts
end