Class: Footrest::Client
- Inherits:
-
Object
- Object
- Footrest::Client
- Includes:
- ActiveSupport::Configurable, Connection, Request
- Defined in:
- lib/footrest/client.rb
Instance Method Summary collapse
- #connection(&block) ⇒ Object
- #fullpath(path) ⇒ Object
-
#initialize(options = {}) {|_self| ... } ⇒ Client
constructor
A new instance of Client.
Methods included from Request
#delete, #get, #patch, #post, #put, #request, #request_with_params_in_body, #request_with_params_in_url
Methods included from Connection
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 |
# File 'lib/footrest/client.rb', line 15 def initialize(={}, &block) self.config.merge!() 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 |