Module: Flickr::Configuration

Included in:
Flickr
Defined in:
lib/flickr/configuration.rb

Overview

Provides general configuration options for the library.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_token_keyObject

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_secretObject

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_keyObject

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

#cacheObject

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)

96
97
98
# File 'lib/flickr/configuration.rb', line 96

def cache
  @cache
end

#open_timeoutObject

Time to wait for the connection to Flickr to open. After that TimeoutError is thrown.


53
54
55
# File 'lib/flickr/configuration.rb', line 53

def open_timeout
  @open_timeout
end

#paginationObject

When retrieving photos from Flickr, you can enable automatic compatibility with a pagination library.

config.pagination = :will_paginate

Supports WillPaginate and Kaminari.


88
89
90
# File 'lib/flickr/configuration.rb', line 88

def pagination
  @pagination
end

#proxyObject

You can choose to go over a proxy.

config.proxy = "http://proxy.com"

75
76
77
# File 'lib/flickr/configuration.rb', line 75

def proxy
  @proxy
end

#shared_secretObject

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

#timeoutObject

Time to wait for the first block of response from Flickr. After that TimeoutError is thrown.


58
59
60
# File 'lib/flickr/configuration.rb', line 58

def timeout
  @timeout
end

#use_sslObject

You can choose to make requests over a secure connection (SSL).

config.use_ssl = true

Default is false.


67
68
69
# File 'lib/flickr/configuration.rb', line 67

def use_ssl
  @use_ssl
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Examples:

Flickr.configure do |config|
  config.api_key = "..."
  config.shared_secret = "..."
  # ...
end

Yields:

  • (_self)

Yield Parameters:


16
17
18
19
# File 'lib/flickr/configuration.rb', line 16

def configure
  yield self
  self
end