graph-api 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graph-api (0.9.7)
4
+ graph-api (0.9.8)
5
5
  json
6
6
  rake
7
7
  rest-client
data/lib/graph_api.rb CHANGED
@@ -12,7 +12,7 @@ require 'graph_api/version'
12
12
  # end
13
13
  #
14
14
  # get '/facebook_callback' do
15
- # @facebook_user = GraphAPI.new(params[:code])
15
+ # @facebook_user = GraphAPI.new(false, params[:code])
16
16
  # session[:auth_token] = @facebook_user.auth_token
17
17
  # render :signed_in
18
18
  # end
@@ -59,11 +59,18 @@ class GraphAPI
59
59
  #
60
60
  # Example:
61
61
  #
62
- # GraphAPI.config app_secret: '124ca2a483f12723cafa7a5da33a3492',
63
- # client_id: '234513432316919'
62
+ # GraphAPI.config do
63
+ # app_secret '124ca2a483f12723cafa7a5da33a3492'
64
+ # client_id '234513432316919'
65
+ # end
64
66
  #
65
- def self.config(settings)
66
- settings.each do |setting, value|
67
+ def self.config(&block)
68
+ config = Class.new do
69
+ def self.method_missing(setting, value)
70
+ @settings ||= []
71
+ @settings << [setting, value]
72
+ end
73
+ end.class_eval(&block).each do |setting, value|
67
74
  self.send("#{setting}=", value)
68
75
  end
69
76
  end
@@ -1,3 +1,3 @@
1
1
  class GraphAPI
2
- VERSION = '0.9.8'
2
+ VERSION = '0.9.9'
3
3
  end
data/readme.md CHANGED
@@ -14,11 +14,13 @@ Here is how to use it.
14
14
 
15
15
  You will have to configure the gem before using it. Here is an example setup.
16
16
 
17
- GraphAPI.config app_secret: '124ca2a483f12723cafa7a5da33a3492', # The Facebook Application Secret
18
- client_id: '234513432316919', # The Facebook Application Id
19
- callback_url: 'http://example.com/facebook_callback/', # URI for receiving the Facebook code param
20
- access_scope: [:offline_access, :email, :user_photos], # The Facebook application requirements
21
- user_fields: [:id, :picture, :name, :gender, :email] # The user fields pulled for
17
+ GraphAPI.config do
18
+ app_secret '124ca2a483f12723cafa7a5da33a3492' # The Facebook Application Secret
19
+ client_id '234513432316919' # The Facebook Application Id
20
+ callback_url 'http://example.com/facebook_callback/' # URI for receiving the Facebook code param
21
+ access_scope [:offline_access, :email, :user_photos] # The Facebook application requirements
22
+ user_fields [:id, :picture, :name, :gender, :email] # The user fields pulled for
23
+ end
22
24
 
23
25
  Visit https://developers.facebook.com/apps to register your Facebook application
24
26
  or checkout https://developers.facebook.com/docs/reference/api/user/ for a list
@@ -34,7 +36,7 @@ user fields in your application. Here is basic example using Sinatra.
34
36
  end
35
37
 
36
38
  get '/facebook_callback' do
37
- @facebook_user = GraphAPI.new(params[:code])
39
+ @facebook_user = GraphAPI.new(false, params[:code])
38
40
  session[:auth_token] = @facebook_user.auth_token
39
41
  render :signed_in
40
42
  end
@@ -7,12 +7,13 @@ describe GraphAPI do
7
7
 
8
8
  describe '#config' do
9
9
  it 'should configuration constants to be set' do
10
- GraphAPI.config app_secret: 'APP_SECRET',
11
- client_id: 'CLIENT_ID',
12
- callback_url: 'CALLBACK_URL',
13
- access_scope: 'ACCESS_SCOPE',
14
- user_fields: 'USER_FIELDS'
15
-
10
+ GraphAPI.config do
11
+ app_secret 'APP_SECRET'
12
+ client_id 'CLIENT_ID'
13
+ callback_url 'CALLBACK_URL'
14
+ access_scope 'ACCESS_SCOPE'
15
+ user_fields 'USER_FIELDS'
16
+ end
16
17
  GraphAPI.app_secret.should == 'APP_SECRET'
17
18
  GraphAPI.client_id.should == 'CLIENT_ID'
18
19
  GraphAPI.callback_url.should == 'CALLBACK_URL'
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.8
4
+ version: 0.9.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: