graph-api 0.9.2 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -1
- data/graph_api.gemspec +1 -0
- data/lib/graph_api.rb +13 -0
- data/lib/graph_api/version.rb +1 -1
- data/readme.md +5 -12
- data/spec/graph_api_spec.rb +15 -2
- metadata +17 -1
data/Gemfile.lock
CHANGED
data/graph_api.gemspec
CHANGED
data/lib/graph_api.rb
CHANGED
@@ -44,6 +44,19 @@ module GraphAPI
|
|
44
44
|
#
|
45
45
|
# USER_FIELDS = [:id, :picture, :name, :gender, :link, :email, :verified, :bio]
|
46
46
|
|
47
|
+
# Public: Method for configuring the setting constants for a nicer syntax.
|
48
|
+
#
|
49
|
+
# Example:
|
50
|
+
#
|
51
|
+
# GraphAPI.config APP_SECRET: '124ca2a483f12723cafa7a5da33a3492',
|
52
|
+
# CLIENT_ID: '234513432316919'
|
53
|
+
#
|
54
|
+
def self.config(consts)
|
55
|
+
consts.each do |const, value|
|
56
|
+
self.const_set(const.to_s, value)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
47
60
|
# Public: Creates and returns a Facebook Authentication URL based on the supplied constants.
|
48
61
|
#
|
49
62
|
# callback_url - With CALLBACK_URL set to nil setting this parameter will use
|
data/lib/graph_api/version.rb
CHANGED
data/readme.md
CHANGED
@@ -13,18 +13,11 @@ Here is how to use it.
|
|
13
13
|
|
14
14
|
You will have to configure the module before using it. Here is an example setup.
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# Public: Reqired constant used for Facebook call back URL when receiving the Facebook connect code param.
|
22
|
-
CALLBACK_URL = nil
|
23
|
-
# Public: Required constant used for setting Facebook application requirements.
|
24
|
-
ACCESS_SCOPE = [:offline_access, :email, :user_photos, :user_location, :user_about_me]
|
25
|
-
# Public: Required constant used for setting the fields pulled for.
|
26
|
-
USER_FIELDS = [:id, :picture, :name, :gender, :link, :email, :verified, :bio]
|
27
|
-
end
|
16
|
+
GraphAPI.config APP_SECRET: '124ca2a483f12723cafa7a5da33a3492' # Constant required for setting the Facebook Application Secret
|
17
|
+
CLIENT_ID: '234513432316919' # Constant required for setting the Facebook Client ID
|
18
|
+
CALLBACK_URL: 'http://example.com/facebook_callback/' # Constant required for when receiving the Facebook connect code param
|
19
|
+
ACCESS_SCOPE: [:offline_access, :email, :user_photos, :user_location] # Constant required for setting Facebook application requirements
|
20
|
+
USER_FIELDS: [:id, :picture, :name, :gender, :link, :email] # Constant required for setting the user fields pulled for
|
28
21
|
|
29
22
|
### Add it to your Application
|
30
23
|
|
data/spec/graph_api_spec.rb
CHANGED
@@ -3,8 +3,21 @@ require 'spec_helper'
|
|
3
3
|
describe GraphAPI do
|
4
4
|
before(:each) do
|
5
5
|
stub_const('RestClient', Class.new)
|
6
|
-
|
7
|
-
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#config' do
|
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
|
+
GraphAPI::APP_SECRET.should == 'APP_SECRET'
|
16
|
+
GraphAPI::CLIENT_ID.should == 'CLIENT_ID'
|
17
|
+
GraphAPI::CALLBACK_URL.should == 'CALLBACK_URL'
|
18
|
+
GraphAPI::ACCESS_SCOPE.should == 'ACCESS_SCOPE'
|
19
|
+
GraphAPI::USER_FIELDS.should == 'USER_FIELDS'
|
20
|
+
end
|
8
21
|
end
|
9
22
|
|
10
23
|
describe '#auth_url' do
|
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.
|
4
|
+
version: 0.9.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: rspec
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|