OpenAuth2 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -86,7 +86,7 @@ task :release => :build do
86
86
  sh "git tag v#{version}"
87
87
  sh "git push origin master"
88
88
  sh "git push origin v#{version}"
89
- sh "gem push pkg/#{name}-#{version}.gem"
89
+ sh "gem push pkg/OpenAuth2-#{version}.gem"
90
90
  end
91
91
 
92
92
  desc "Build #{gem_file} into the pkg directory"
@@ -144,6 +144,46 @@ client.run_request(verb: :get, path: path, body: nil, header: nil)
144
144
  client.connection.run_request(:get, path, nil, nil)
145
145
  ```
146
146
 
147
+ ## Plugins
148
+
149
+ OpenAuth2 comes with inbuilt support for Google and Facebook, but its trivial to add new plugins.
150
+
151
+ There are only three requirements:
152
+
153
+ 1. Should be under right namespace (OpenAuth2::Provider)
154
+ 1. Contains Options hash
155
+ 1. Contains #parse class method
156
+
157
+ ### Foursquare Example
158
+
159
+ ```ruby
160
+ module OpenAuth2
161
+ module Provider
162
+ module Facebook
163
+
164
+ # Provider::Base contains keys of various accepted
165
+ # Options, while Provider::Default contains the default options and
166
+ # their values. You can however override them here.
167
+ #
168
+ Options = {
169
+ :authorize_url => '',
170
+ :code_url => '',
171
+ :refresh_token_grant_name => '',
172
+ }
173
+
174
+ def self.parse(config, response_body)
175
+ # parse the response body
176
+ access_token = response_body.gsub('access_token=', '')
177
+
178
+ # update config to reflect new information
179
+ config.access_token = access_token
180
+ config.token_arrived_at = Time.now
181
+ end
182
+ end
183
+ end
184
+ end
185
+ ```
186
+
147
187
  ## Google example
148
188
 
149
189
  ```ruby
@@ -199,6 +239,13 @@ client.run_request(:verb => :post,
199
239
  * URI
200
240
  * Json
201
241
 
242
+ ## Supported Versions
243
+
244
+ * MRI 1.9.2
245
+ * MRI 1.9.3
246
+ * jRuby (jruby --1.9 rspec)
247
+ * Rubinius 2.0.0dev (RBXOPT=-X19 rbx- S rspec)
248
+
202
249
  ## Install
203
250
 
204
251
  $ gem install open_auth2
@@ -112,7 +112,6 @@ module OpenAuth2
112
112
  }.merge(params)
113
113
  end
114
114
 
115
- # TODO: learn about merge vs merge!
116
115
  def get_body_hash(params)
117
116
  {
118
117
  :client_id => client_id,
@@ -1,3 +1,3 @@
1
1
  module OpenAuth2
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -22,6 +22,12 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_dependency 'faraday', '~> 0.7'
24
24
  s.add_dependency 'activesupport', '~> 3.2'
25
+ s.add_dependency 'json'
26
+
27
+ if RUBY_PLATFORM == 'java'
28
+ s.add_dependency 'json'
29
+ s.add_dependency 'jruby-openssl'
30
+ end
25
31
 
26
32
  s.add_development_dependency 'rake', '~> 0.9'
27
33
  s.add_development_dependency 'rspec', '~> 2.8'
@@ -78,12 +78,9 @@ describe OpenAuth2::Config do
78
78
  # mimicking beh. of users including their own provider
79
79
  module OpenAuth2::Provider module UserDefined end end
80
80
 
81
- providers = [:Default, :Facebook, :Google, :UserDefined]
82
- error_message = "Known Providers: #{providers}"
83
-
84
81
  expect do
85
82
  subject.provider = :unknown
86
- end.to raise_error(OpenAuth2::UnknownProvider, error_message)
83
+ end.to raise_error(OpenAuth2::UnknownProvider)
87
84
  end
88
85
  end
89
86
 
@@ -1,7 +1,7 @@
1
1
  require 'open_auth2'
2
2
  require 'spec_helper'
3
3
 
4
- describe OpenAuth2::Client do
4
+ describe OpenAuth2::Token do
5
5
  let(:config) do
6
6
  OpenAuth2::Config.new do |c|
7
7
  c.provider = :facebook
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: OpenAuth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-03 00:00:00.000000000 Z
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
16
- requirement: &70361644616180 !ruby/object:Gem::Requirement
16
+ requirement: &70136571467600 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.7'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70361644616180
24
+ version_requirements: *70136571467600
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70361644615200 !ruby/object:Gem::Requirement
27
+ requirement: &70136571467080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,21 @@ dependencies:
32
32
  version: '3.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70361644615200
35
+ version_requirements: *70136571467080
36
+ - !ruby/object:Gem::Dependency
37
+ name: json
38
+ requirement: &70136571466700 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70136571466700
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: rake
38
- requirement: &70361644614360 !ruby/object:Gem::Requirement
49
+ requirement: &70136571466140 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ~>
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '0.9'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70361644614360
57
+ version_requirements: *70136571466140
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: rspec
49
- requirement: &70361644613500 !ruby/object:Gem::Requirement
60
+ requirement: &70136571465600 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: '2.8'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70361644613500
68
+ version_requirements: *70136571465600
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: vcr
60
- requirement: &70361644612160 !ruby/object:Gem::Requirement
71
+ requirement: &70136571465120 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ~>
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '1.11'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70361644612160
79
+ version_requirements: *70136571465120
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: fakeweb
71
- requirement: &70361644608520 !ruby/object:Gem::Requirement
82
+ requirement: &70136571464540 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '1.3'
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70361644608520
90
+ version_requirements: *70136571464540
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: timecop
82
- requirement: &70361644606700 !ruby/object:Gem::Requirement
93
+ requirement: &70136571463920 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,7 +98,7 @@ dependencies:
87
98
  version: '0.3'
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *70361644606700
101
+ version_requirements: *70136571463920
91
102
  description: OpenAuth2 is a thin OAuth2 wrapper written on top of Faraday in Ruby.
92
103
  email:
93
104
  - senthil196@gmail.com