Module: Flickr::Configuration
- Included in:
- Flickr
- Defined in:
- lib/flickr/configuration.rb
Overview
Provides general configuration options for the library.
Instance Attribute Summary collapse
-
#access_token_key ⇒ Object
Required for authenticated requests.
-
#access_token_secret ⇒ Object
Required for authenticated requests.
-
#api_key ⇒ Object
API key and shared secret are necessary for making API requests.
-
#cache ⇒ Object
Enables caching responses.
-
#open_timeout ⇒ Object
Time to wait for the connection to Flickr to open.
-
#pagination ⇒ Object
When retrieving photos from Flickr, you can enable automatic compatibility with a pagination library.
-
#proxy ⇒ Object
You can choose to go over a proxy.
-
#shared_secret ⇒ Object
API key and shared secret are necessary for making API requests.
-
#timeout ⇒ Object
Time to wait for the first block of response from Flickr.
-
#use_ssl ⇒ Object
You can choose to make requests over a secure connection (SSL).
Instance Method Summary collapse
Instance Attribute Details
#access_token_key ⇒ Object
Required for authenticated requests.
config.access_token_key = "KEY"
config.access_token_secret = "SECRET"
For details on how to obtain it, take a look at the OAuth module.
37 38 39 |
# File 'lib/flickr/configuration.rb', line 37 def access_token_key @access_token_key end |
#access_token_secret ⇒ Object
Required for authenticated requests.
config.access_token_key = "KEY"
config.access_token_secret = "SECRET"
For details on how to obtain it, take a look at the OAuth module.
37 38 39 |
# File 'lib/flickr/configuration.rb', line 37 def access_token_secret @access_token_secret end |
#api_key ⇒ Object
API key and shared secret are necessary for making API requests. You can apply for them here.
27 28 29 |
# File 'lib/flickr/configuration.rb', line 27 def api_key @api_key end |
#cache ⇒ Object
Enables caching responses. An object that is passed must respond to
#read, #write and #fetch.
config.cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 1.hour)
100 101 102 |
# File 'lib/flickr/configuration.rb', line 100 def cache @cache end |
#open_timeout ⇒ Object
Time to wait for the connection to Flickr to open. After that TimeoutError is thrown.
Default is 5 seconds.
55 56 57 |
# File 'lib/flickr/configuration.rb', line 55 def open_timeout @open_timeout end |
#pagination ⇒ Object
When retrieving photos from Flickr, you can enable automatic compatibility with a pagination library.
config.pagination = :will_paginate
Supports WillPaginate and Kaminari.
92 93 94 |
# File 'lib/flickr/configuration.rb', line 92 def pagination @pagination end |
#proxy ⇒ Object
You can choose to go over a proxy.
config.proxy = "http://proxy.com"
79 80 81 |
# File 'lib/flickr/configuration.rb', line 79 def proxy @proxy end |
#shared_secret ⇒ Object
API key and shared secret are necessary for making API requests. You can apply for them here.
27 28 29 |
# File 'lib/flickr/configuration.rb', line 27 def shared_secret @shared_secret end |
#timeout ⇒ Object
Time to wait for the first block of response from Flickr. After that TimeoutError is thrown.
Default is 10 seconds.
62 63 64 |
# File 'lib/flickr/configuration.rb', line 62 def timeout @timeout end |
#use_ssl ⇒ Object
You can choose to make requests over a secure connection (SSL).
config.use_ssl = true
Default is false.
71 72 73 |
# File 'lib/flickr/configuration.rb', line 71 def use_ssl @use_ssl end |
Instance Method Details
#access_token ⇒ Array(string, string)
43 44 45 46 47 |
# File 'lib/flickr/configuration.rb', line 43 def access_token if access_token_key and access_token_secret [access_token_key, access_token_secret] end end |
#configure {|_self| ... } ⇒ Object
16 17 18 19 |
# File 'lib/flickr/configuration.rb', line 16 def configure yield self self end |