putpat / rockstar

Rockstar is a wrapper for the audioscrobbler v2.0 (last.fm) web services. This gem includes scrobbling with the new api.
MIT License
82 stars 29 forks source link

How do I get auth.session.key #26

Closed hbdev011 closed 12 years ago

hbdev011 commented 12 years ago

I need to fetch recommended Artists . I am new for the Gem , Can you help me get auth.session.key

The session_key is returned by auth.session.key

def recommended_artists(session_key, force=false)
  get_instance("user.getRecommendedArtists", :recommendations, :artist, {:user => @username, :sk => session_key}, force)
end
bitboxer commented 12 years ago

Please look here on how to fetch the session.key .

hbdev011 commented 12 years ago
rock_auth = Rockstar::Auth.new
rock_token = rock_auth.token
gets
rock_session = rock_auth.session(rock_token)`

I am getting undefined method `inner_html' for nil:NilClass

from the files

/gems/activesupport-2.3.8/lib/active_support/whiny_nil.rb:52:in `method_missing`
gems/rockstar-0.6.4/lib/rockstar/session.rb:8:in `new_from_xml` 
gems/rockstar-0.6.4/lib/rockstar/auth.rb:29:in `session`
bitboxer commented 12 years ago

You are using it wrong. Did you set the API Key and Secret like it said in the beginning of the documentation? And did you open the URL with the token and confirmed the token for the app?