graph-api 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -85,10 +85,10 @@ module GraphAPI
85
85
  # the sent callback. This is useful when you're using dynamic
86
86
  # URIs with subdomains.
87
87
  def fetch_token(code, callback_url=nil)
88
- RestClient.get('https://graph.facebook.com/oauth/access_token', { client_id: @client_id,
89
- redirect_uri: (@callback_url or callback_url),
90
- client_secret: @app_secret,
91
- code: code
88
+ RestClient.post('https://graph.facebook.com/oauth/access_token', { client_id: @client_id,
89
+ redirect_uri: (@callback_url or callback_url),
90
+ client_secret: @app_secret,
91
+ code: code
92
92
  })[/access_token=(.+?)&/, 1]
93
93
  end
94
94
 
@@ -133,7 +133,7 @@ module GraphAPI
133
133
  #
134
134
  # access_token - This method requires an Facebook Authentication token.
135
135
  def fetch_thumbnail(access_token)
136
- request('/me?fields=picture', access_token)['picture']
136
+ request('/me?fields=picture', access_token)['picture']['data']['url']
137
137
  end
138
138
 
139
139
  extend self
@@ -1,3 +1,3 @@
1
1
  module GraphAPI
2
- VERSION = '0.9.6'
2
+ VERSION = '0.9.7'
3
3
  end
data/readme.md CHANGED
@@ -7,27 +7,29 @@ Here is how to use it.
7
7
 
8
8
  ### Add it to your Gemfile
9
9
 
10
- gem 'graph-api', require 'graph_api'
10
+ gem 'graph-api', require: 'graph_api'
11
11
 
12
12
  ### Set up your Facebook Appications constants
13
13
 
14
14
  You will have to configure the module before using it. Here is an example setup.
15
15
 
16
- GraphAPI.config app_secret: '124ca2a483f12723cafa7a5da33a3492' # The Facebook Application Secret
17
- client_id: '234513432316919' # The Facebook Client ID
18
- callback_url: 'http://example.com/facebook_callback/' # URI for receiving the Facebook connect code param
19
- access_scope: [:offline_access, :email, :user_photos, :user_location] # The Facebook application requirements
20
- user_fields: [:id, :picture, :name, :gender, :link, :email] # The user fields pulled for
16
+ GraphAPI.config app_secret: '124ca2a483f12723cafa7a5da33a3492', # The Facebook Application Secret
17
+ client_id: '234513432316919', # The Facebook Client ID
18
+ callback_url: 'http://example.com/facebook_callback/', # URI for receiving the Facebook code param
19
+ access_scope: [:offline_access, :email, :user_photos], # The Facebook application requirements
20
+ user_fields: [:id, :picture, :name, :gender, :email] # The user fields pulled for
21
+
22
+ Visit https://developers.facebook.com/apps to register your Facebook application.
21
23
 
22
24
  ### Add it to your Application
23
25
 
24
26
  Once configured you will be able to use any of its functions in your application. Here is basic example using Sinatra.
25
27
 
26
28
  get '/facebook_login' do
27
- redirect FaceGraph.auth_url
29
+ redirect GraphAPI.auth_url
28
30
  end
29
31
 
30
- get '/facebook_auth' do
32
+ get '/facebook_callback' do
31
33
  @facebook_user = GraphAPI.fetch_user(params[:code])
32
34
  @photo = GraphAPI.fetch_photo(@facebook_user['access_token'])
33
35
  render :signed_in
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graph-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: