Class: Footrest::Client

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Configurable, Connection, Request
Defined in:
lib/footrest/client.rb

Instance Method Summary collapse

Methods included from Request

#delete, #get, #post, #put, #request, #request_with_params_in_body, #request_with_params_in_url

Methods included from Connection

#set_connection

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:


15
16
17
18
19
# File 'lib/footrest/client.rb', line 15

def initialize(options={}, &block)
  self.config.merge!(options)
  yield self if block_given?
  set_connection(config)
end

Instance Method Details

#connection(&block) ⇒ Object


21
22
23
24
25
# File 'lib/footrest/client.rb', line 21

def connection(&block)
  @connection.tap do |conn|
    yield conn if block_given?
  end
end

#fullpath(path) ⇒ Object


27
28
29
30
# File 'lib/footrest/client.rb', line 27

def fullpath(path)
  return path if path =~ /^https?:/i
  prefix ? join(prefix, path) : path
end