facebook_oauth 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/facebook_oauth/client.rb +16 -10
  2. metadata +61 -69
@@ -12,47 +12,53 @@ module FacebookOAuth
12
12
 
13
13
  def authorize_url(options = {})
14
14
  options[:scope] ||= 'offline_access,publish_stream'
15
- consumer.web_server.authorize_url(
15
+ client.auth_code.authorize_url(
16
+ :client_id => @application_id,
16
17
  :redirect_uri => options[:callback] || @callback,
17
18
  :scope => options[:scope]
18
19
  )
19
20
  end
20
21
 
21
22
  def authorize(options = {})
22
- @access_token ||= consumer.web_server.get_access_token(
23
+ @access_token ||= client.auth_code.get_token(
23
24
  options[:code],
24
- :redirect_uri => options[:callback] || @callback
25
+ :redirect_uri => options[:callback] || @callback,
26
+ :parse => :query
25
27
  )
28
+
26
29
  @token = @access_token.token
27
30
  @access_token
28
31
  end
29
32
 
30
33
  private
31
- def consumer
32
- @consumer ||= OAuth2::Client.new(
34
+ def client
35
+ @client ||= OAuth2::Client.new(
33
36
  @application_id,
34
37
  @application_secret,
35
- { :site=>"https://graph.facebook.com" }
38
+ { :site=>"https://graph.facebook.com", :token_url => "/oauth/access_token" }
36
39
  )
37
40
  end
38
41
 
39
42
  def access_token
40
- OAuth2::AccessToken.new(consumer, @token)
43
+ @access_token ||= OAuth2::AccessToken.new(client, @token)
44
+ @access_token.options[:mode] = :query
45
+ @access_token.options[:param_name] = :access_token
46
+ @access_token
41
47
  end
42
48
 
43
49
  def _get(url)
44
- oauth_response = access_token.get(url)
50
+ oauth_response = access_token.get(url).parsed
45
51
  JSON.parse(oauth_response) rescue oauth_response
46
52
  end
47
53
 
48
54
  def _post(url, params={}, headers={})
49
- oauth_response = access_token.post(url, params, headers)
55
+ oauth_response = access_token.post(url, :params => params, :headers => headers).parsed
50
56
  puts oauth_response.inspect
51
57
  JSON.parse(oauth_response) rescue oauth_response
52
58
  end
53
59
 
54
60
  def _delete(url)
55
- oauth_response = access_token.delete(url)
61
+ oauth_response = access_token.delete(url).parsed
56
62
  JSON.parse(oauth_response) rescue oauth_response
57
63
  end
58
64
  end
metadata CHANGED
@@ -1,115 +1,107 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: facebook_oauth
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
4
5
  prerelease:
5
- version: 0.2.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Richard Taylor
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-29 00:00:00 +01:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: oauth2
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70199995921540 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 0.4.1
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.5.1
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: json
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70199995921540
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ requirement: &70199995920440 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
35
32
  version: 1.5.3
36
33
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: mime-types
40
34
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70199995920440
36
+ - !ruby/object:Gem::Dependency
37
+ name: mime-types
38
+ requirement: &70199995919700 !ruby/object:Gem::Requirement
42
39
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: "1.16"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '1.16'
47
44
  type: :runtime
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: shoulda
51
45
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70199995919700
47
+ - !ruby/object:Gem::Dependency
48
+ name: shoulda
49
+ requirement: &70199995919000 !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
58
55
  type: :development
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: mocha
62
56
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70199995919000
58
+ - !ruby/object:Gem::Dependency
59
+ name: mocha
60
+ requirement: &70199995918280 !ruby/object:Gem::Requirement
64
61
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
69
66
  type: :development
70
- version_requirements: *id005
71
- description: facebook_oauth is a Ruby client library for the Facebook OAuth Graph API
67
+ prerelease: false
68
+ version_requirements: *70199995918280
69
+ description: facebook_oauth is a Ruby client library for the Facebook OAuth Graph
70
+ API
72
71
  email: moomerman@gmail.com
73
72
  executables: []
74
-
75
73
  extensions: []
76
-
77
74
  extra_rdoc_files: []
78
-
79
- files:
75
+ files:
80
76
  - LICENSE
81
77
  - README.textile
82
78
  - lib/facebook_oauth.rb
83
79
  - lib/facebook_oauth/client.rb
84
80
  - lib/facebook_oauth/objects.rb
85
- has_rdoc: true
86
81
  homepage: http://github.com/moomerman/facebook_oauth
87
82
  licenses: []
88
-
89
83
  post_install_message:
90
- rdoc_options:
84
+ rdoc_options:
91
85
  - --inline-source
92
86
  - --charset=UTF-8
93
- require_paths:
87
+ require_paths:
94
88
  - lib
95
- required_ruby_version: !ruby/object:Gem::Requirement
89
+ required_ruby_version: !ruby/object:Gem::Requirement
96
90
  none: false
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- version: "0"
101
- required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
96
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: "0"
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
107
101
  requirements: []
108
-
109
102
  rubyforge_project: facebook_oauth
110
- rubygems_version: 1.6.2
103
+ rubygems_version: 1.8.10
111
104
  signing_key:
112
105
  specification_version: 2
113
106
  summary: facebook_oauth is a Ruby client library for the Facebook OAuth Graph API
114
107
  test_files: []
115
-