module MealTicketRoutes
Public Instance Methods
facebook_auth_url(root_url, scope)
click to toggle source
- root_url
-
The base url of your app, eg “www.google.com/”. If you're running a rails app, you can literally type root_url
- scope
-
A comma-separated list of permissions. For a full list of permissions, see developers.facebook.com/docs/authentication/permissions/
# File lib/meal_ticket.rb, line 10 def facebook_auth_url(root_url, scope) "https://graph.facebook.com/oauth/authorize?client_id=#{MealTicket::Config.facebook_app_id}&redirect_uri=#{root_url}meal_ticket/facebook_callback&scope=#{scope}" end
flickr_auth_url(perm)
click to toggle source
- perm
-
A single permission level. Permissions can be read, write, or delete. Each successive permission implies the ones before it, eg “write” implies “read”. For more information, see www.flickr.com/services/api/auth.spec.html
# File lib/meal_ticket.rb, line 20 def flickr_auth_url(perm) flickr_url({"perms" => perm}, "auth") end
Private Instance Methods
flickr_sign(arg_hash)
click to toggle source
# File lib/meal_ticket.rb, line 40 def flickr_sign(arg_hash) arg_list = [] arg_hash.keys.sort.each do |key| arg_list << key arg_list << arg_hash[key] end Digest::MD5.hexdigest("#{MealTicket::Config.flickr_secret}#{arg_list.join()}") end
flickr_url(arg_hash, endpoint = "rest")
click to toggle source
# File lib/meal_ticket.rb, line 31 def flickr_url(arg_hash, endpoint = "rest") arg_hash.merge!({"api_key" => MealTicket::Config.flickr_token}) arg_list = [] arg_hash.each do |key, value| arg_list << "#{key}=#{value}" end "#{FLICKR_API_BASE_URL}#{endpoint}/?&api_sig=#{flickr_sign(arg_hash)}&#{arg_list.join('&')}" end