Module: MealTicketRoutes

Included in:
MealTicket
Defined in:
lib/meal_ticket.rb

Constant Summary collapse

FLICKR_API_BASE_URL =

:nodoc:

"http://api.flickr.com/services/"

Instance Method Summary collapse

Instance Method Details

#facebook_auth_url(root_url, scope) ⇒ Object

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/



10
11
12
# 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

#facebook_exchange_url(root_url, code) ⇒ Object

Generates the URL for the 2nd step of Facebook auth - exchanging the code for user data



15
16
17
# File 'lib/meal_ticket.rb', line 15

def facebook_exchange_url(root_url, code) # :nodoc:
  "https://graph.facebook.com/oauth/access_token?client_id=#{MealTicket::Config.facebook_app_id}&redirect_uri=#{root_url}meal_ticket/facebook_callback&client_secret=#{MealTicket::Config.facebook_secret}&code=#{CGI::escape code}"
end

#flickr_auth_url(perm) ⇒ Object

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



20
21
22
# File 'lib/meal_ticket.rb', line 20

def flickr_auth_url(perm)
  flickr_url({"perms" => perm}, "auth")
end

#flickr_frob_url(frob) ⇒ Object

Generates the URL for the 2nd step of Facebook auth - exchanging the frob for user data



25
26
27
# File 'lib/meal_ticket.rb', line 25

def flickr_frob_url(frob) # :nodoc:
  flickr_url({"method" => "flickr.auth.getToken", "frob" => frob})
end