Class: Flickr::Client
- Inherits:
-
Object
- Object
- Flickr::Client
- Extended by:
- AutoloadHelper
- Defined in:
- lib/flickr/client.rb,
lib/flickr/client/data.rb,
lib/flickr/client/oauth.rb,
lib/flickr/client/upload.rb
Overview
This abstract class is the base for the client classes which communicate with the Flickr API. For example, the part of Flickr API for uploading photos need requests to be marked as multipart, while the part for querying data of photos doesn’t need it. So it’s obvious that we need separate classes.
This class just extracts the common behaviour, like including the API key in requests.
Defined Under Namespace
Instance Method Summary collapse
- #get(*args, &block) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #post(*args, &block) ⇒ Object
Methods included from AutoloadHelper
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
27 28 29 30 31 32 33 34 35 |
# File 'lib/flickr/client.rb', line 27 def initialize @connection = Faraday.new(url, ) do |builder| builder.use Flickr::Middleware::CatchTimeout yield builder if block_given? builder.use FaradayMiddleware::Caching, Flickr.cache if Flickr.cache builder.adapter :net_http end end |