Method: Flickr#initialize

Defined in:
lib/flickr.rb

#initialize(api_key = ENV['FLICKR_API_KEY'], shared_secret = ENV['FLICKR_SHARED_SECRET']) ⇒ Flickr

Returns a new instance of Flickr.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/flickr.rb', line 38

def initialize(api_key = ENV['FLICKR_API_KEY'], shared_secret = ENV['FLICKR_SHARED_SECRET'])

  raise FlickrAppNotConfigured.new("No API key defined!") if api_key.nil?
  raise FlickrAppNotConfigured.new("No shared secret defined!") if shared_secret.nil?

  @access_token = @access_secret = nil
  @oauth_consumer = oauth_consumer api_key, shared_secret

  @@mutex.synchronize do
    unless @@initialized
      build_classes retrieve_endpoints
      @@initialized = true
    end
  end
  @client = self # used for propagating the client to sub-classes
end