Class: Flickr::User
Overview
Todo: logged_in? if logged in: flickr.blogs.getList flickr.favorites.add flickr.favorites.remove flickr.groups.browse flickr.photos.getCounts flickr.photos.getNotInSet flickr.photos.getUntagged flickr.photosets.create flickr.photosets.orderSets flickr.tags.getListUserPopular flickr.test.login uploading
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#firstdate ⇒ Object
readonly
Returns the value of attribute firstdate.
-
#firstdatetaken ⇒ Object
readonly
Returns the value of attribute firstdatetaken.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#photos_url ⇒ Object
readonly
Returns the value of attribute photos_url.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(id_or_params_hash = nil, username = nil, email = nil, password = nil, api_key = nil) ⇒ User
constructor
A Flickr::User can be instantiated in two ways.
Constructor Details
#initialize(id_or_params_hash = nil, username = nil, email = nil, password = nil, api_key = nil) ⇒ User
A Flickr::User can be instantiated in two ways. The old (deprecated) method is with an ordered series of values. The new method is with a params Hash, which is easier when a variable number of params are supplied, which is the case here, and also avoids having to constantly supply nil values for the email and password, which are now irrelevant as authentication is no longer done this way. An associated flickr client will also be generated if an api key is passed among the arguments or in the params hash. Alternatively, and most likely, an existing client object may be passed in the params hash (e.g. ‘client’ => some_existing_flickr_client_object), and this is what happends when users are initlialized as the result of a method called on the flickr client (e.g. flickr.users)
139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 139 def initialize(id_or_params_hash=nil, username=nil, email=nil, password=nil, api_key=nil) if id_or_params_hash.is_a?(Hash) id_or_params_hash.each { |k,v| self.instance_variable_set("@#{k}", v) } # convert extra_params into instance variables else @id = id_or_params_hash @username = username @email = email @password = password @api_key = api_key end @client ||= Flickr.new('api_key' => @api_key, 'shared_secret' => @shared_secret, 'auth_token' => @auth_token) if @api_key @client.login(@email, @password) if @email and @password # this is now irrelevant as Flickr API no longer supports authentication this way end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def client @client end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def count @count end |
#firstdate ⇒ Object (readonly)
Returns the value of attribute firstdate.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def firstdate @firstdate end |
#firstdatetaken ⇒ Object (readonly)
Returns the value of attribute firstdatetaken.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def firstdatetaken @firstdatetaken end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def id @id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def name @name end |
#photos_url ⇒ Object (readonly)
Returns the value of attribute photos_url.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def photos_url @photos_url end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
125 126 127 |
# File 'lib/acts_as_unvlogable/flickr.rb', line 125 def url @url end |