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 CHANGED
@@ -1,13 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graph-api (0.9.1)
4
+ graph-api (0.9.2)
5
+ json
5
6
  rake
6
7
 
7
8
  GEM
8
9
  remote: http://rubygems.org/
9
10
  specs:
10
11
  diff-lcs (1.1.3)
12
+ json (1.7.5)
11
13
  rake (0.9.2.2)
12
14
  rspec (2.11.0)
13
15
  rspec-core (~> 2.11.0)
data/graph_api.gemspec CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.homepage = 'https://github.com/nickbarth/RakeAR'
14
14
 
15
15
  gem.add_dependency('rake')
16
+ gem.add_dependency('json')
16
17
  gem.add_development_dependency('rspec')
17
18
 
18
19
  gem.files = `git ls-files`.split($/)
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
@@ -1,3 +1,3 @@
1
1
  module GraphAPI
2
- VERSION = '0.9.2'
2
+ VERSION = '0.9.4'
3
3
  end
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
- module GraphAPI
17
- # Public: Required constant used for Facebook private application secret.
18
- APP_SECRET = '124ca2a483f12723cafa7a5da33a3492'
19
- # Public: Required constant used for Facebook private application client ID.
20
- CLIENT_ID = '234513432316919'
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
 
@@ -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
- stub_const('GraphAPI::CLIENT_ID', 'CLIENT_ID')
7
- stub_const('GraphAPI::APP_SECRET', 'APP_SECRET')
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.2
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