views:

258

answers:

3

http://github.com/ctagg/flickr/tree/master

I'm trying the example in the home page of the flickr gem.

require 'flickr' flickr = Flickr.new('MY_KEY')
user = flickr.users('[email protected]')

user.name
user.location

while I'm able to get the user object, I can't get any of the other attributes like name, location etc. How to get those details?

A: 

I worked through the problem I was experiencing above in my comment but I am not having difficulty getting people's attributes. The following code works as expected in a ruby script/console session:

require 'flickr'

f = Flickr.new('<<MY_KEY>>')

u = f.users('[email protected]')

puts u.name
puts u.location

Substituting my username ('topherfangio') instead of Scott's, the name attribute works, but apparently my location is nil.

Could you describe a little bit more about exactly what you are getting? Any errors or is it just blank? Have you tried multiple users?

Edit 1: Just got your API key and it doesn't work for me either, try the following and see if that makes any difference. Also, are you using a non-commercial key or a commercial key?

f = Flickr.new(:api_key => 'MY_KEY', :shared_secret => 'MY_SECRET')

My guess is that it's not fully authenticating or something like that.

Edit 2: I'm a freaking liar...I was typing f = Flickr.new(...); f.name which was breaking. Your API key is working correctly for me. Perhaps it's your network or something?

Topher Fangio
Just a note: obviously replace <<MY_KEY>> with your actual API key. I'm sure you know this, but in case someone else comes along later and gets confused :-)
Topher Fangio
no, I tried with your name too, still not working. simply gives me an error Invalid API key (Key not found)
Aha! Are you sure your key is valid and you're not copying any whitespace?
Topher Fangio
do the other attributes work for you? like groups, contacts, favorites etc?
You can view your keys or apply for one at http://www.flickr.com/services/api/keys/
Topher Fangio
Key is valid, I double checked
@unknown Yes, the other attributes work just fine. However, if I don't enter the correct API key, I get the invalid message.
Topher Fangio
If you don't mind sharing it, can you send me your API key to (fangiotophia at gmail dot com) and I'll test it? I promise I won't use it for anything else :-)
Topher Fangio
Check Edit 1 for more info :-)
Topher Fangio
Just shot you an e-mail with an example (including your API key) that works properly for me.
Topher Fangio
A: 

To not entirely answer your question, I've been using the Fleakr gem and found it to be extremely straightforward. Documentation is good and you do everything in the code once it is installed.

No tricks, just sudo gem install fleakr

It depends on the builder gem, so also do sudo gem install builder.

Once I switched to Fleakr my project finished quickly!

MattK
A: 

It looks like the flickr gem isn't being maintained. Uninstall the gem by doing a gem uninstall flickr, then install a more up to date branch of it by doing a gem install moonpxi-flickr