Sha256: b7c601bc7855fcf0b4e7d5a87744b05567da97fcb493c2ebe92efc37bdd1ab3f
Contents?: true
Size: 867 Bytes
Versions: 12
Compression:
Stored size: 867 Bytes
Contents
require 'footrest/connection' require 'footrest/request' require 'active_support/configurable' module Footrest class Client include Footrest::Connection include Footrest::Request include ActiveSupport::Configurable config_accessor :token config_accessor :prefix config_accessor :logging def initialize(options={}, &block) self.config.merge!(options) yield self if block_given? set_connection(config) end def connection(&block) @connection.tap do |conn| yield conn if block_given? end end def fullpath(path) return path if path =~ /^https?:/i prefix ? join(prefix, path) : path end protected def join(*parts) joined = parts.map{ |p| p.gsub(%r{^/|/$}, '') }.join('/') joined = '/' + joined if parts.first[0] == '/' joined end end end
Version data entries
12 entries across 12 versions & 1 rubygems