omniauth-readmill 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Guardfile CHANGED
@@ -1,4 +1,4 @@
1
- guard 'rspec', :version => 2 do
1
+ guard 'rspec', version: 2 do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
3
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
4
  watch('spec/spec_helper.rb') { 'spec' }
data/README.md CHANGED
@@ -10,6 +10,43 @@ use OmniAuth::Builder do
10
10
  end
11
11
  ```
12
12
 
13
+ # Example auth hash
14
+
15
+ ```json
16
+ {
17
+ "provider":"readmill",
18
+ "uid":5708,
19
+ "info":{
20
+ "name":"Christof Dorner",
21
+ "email":"xxx",
22
+ "nickname":"chdorner",
23
+ "first_name":"Christof",
24
+ "last_name":"Dorner",
25
+ "location":"Zürich",
26
+ "description":"iOS/Android/Rails developer. geek.",
27
+ "image":"http://static.readmill.com/avatars/6d4357e2e7839a27011a25835b9fabc3-medium.png?1320704267",
28
+ "urls":{
29
+ "Readmill":"http://readmill.com/chdorner",
30
+ "Website":"http://chdorner.com"
31
+ }
32
+ },
33
+ "credentials":{
34
+ "token":"xxx",
35
+ "refresh_token":"xxx",
36
+ "expires_at":1321541661,
37
+ "expires":true
38
+ },
39
+ "extra":{
40
+ "books_interesting":5,
41
+ "books_open":3,
42
+ "books_finished":2,
43
+ "books_abandoned":0,
44
+ "followers":3,
45
+ "followings":13
46
+ }
47
+ }
48
+ ```
49
+
13
50
  # License (MIT)
14
51
 
15
52
  Copyright (c) 2011 Christof Dorner
data/Rakefile CHANGED
@@ -3,10 +3,8 @@ require "bundler/gem_tasks"
3
3
  require "rspec/core/rake_task"
4
4
 
5
5
  desc "Default: run specs."
6
- task :default => :spec
6
+ task default: :spec
7
7
 
8
8
  desc "Run specs"
9
9
  RSpec::Core::RakeTask.new
10
10
 
11
- desc "Run specs"
12
- task :default => :spec
@@ -4,9 +4,12 @@ module OmniAuth
4
4
  module Strategies
5
5
  class Readmill < OmniAuth::Strategies::OAuth2
6
6
  option :client_options, {
7
- :site => 'http://api.readmill.com',
8
- :authorize_url => 'http://readmill.com/oauth/authorize',
9
- :token_url => 'http://readmill.com/oauth/token'
7
+ site: 'https://api.readmill.com',
8
+ authorize_url: 'https://readmill.com/oauth/authorize',
9
+ token_url: 'https://readmill.com/oauth/token'
10
+ }
11
+ option :authorize_params, {
12
+ scope: 'non-expiring'
10
13
  }
11
14
 
12
15
  uid { raw_info['id'] }
@@ -27,7 +30,7 @@ module OmniAuth
27
30
  },
28
31
  }
29
32
  end
30
-
33
+
31
34
  extra do
32
35
  {
33
36
  'books_interesting' => raw_info['books_interesting'],
@@ -41,7 +44,7 @@ module OmniAuth
41
44
 
42
45
  def raw_info
43
46
  access_token.options[:mode] = :query
44
- @raw_info ||= access_token.get("/me?access_token=#{access_token.token}").parsed
47
+ @raw_info ||= access_token.get("/v2/me?access_token=#{access_token.token}").parsed['user']
45
48
  end
46
49
  end
47
50
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Readmill
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -2,19 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe OmniAuth::Strategies::Readmill do
4
4
  def app; lambda{|env| [200, {}, ["Hello."]]} end
5
- let(:fresh_strategy){ Class.new(OmniAuth::Strategies::Readmill) }
6
-
5
+ let(:strategy) { Class.new(OmniAuth::Strategies::Readmill) }
6
+
7
7
  describe '#client' do
8
- subject{ fresh_strategy }
9
-
10
- it 'should have the correct authorize url' do
11
- instance = subject.new(app)
12
- instance.client.options[:authorize_url].should == 'http://readmill.com/oauth/authorize'
13
- end
14
-
15
- it 'should have the correct token url' do
16
- instance = subject.new(app)
17
- instance.client.options[:token_url].should == 'http://readmill.com/oauth/token'
18
- end
8
+ subject { strategy.new(app) }
9
+
10
+ specify { subject.client.options[:authorize_url].should == 'https://readmill.com/oauth/authorize' }
11
+ specify { subject.client.options[:token_url].should == 'https://readmill.com/oauth/token' }
12
+ specify { subject.authorize_params.should include(scope: 'non-expiring') }
19
13
  end
20
14
  end
data/spec/spec_helper.rb CHANGED
@@ -11,5 +11,5 @@ require 'omniauth-readmill'
11
11
  RSpec.configure do |config|
12
12
  config.include WebMock::API
13
13
  config.include Rack::Test::Methods
14
- config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
14
+ config.extend OmniAuth::Test::StrategyMacros, type: :strategy
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-readmill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-17 00:00:00.000000000 +01:00
13
- default_executable:
12
+ date: 2012-11-04 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: omniauth
17
- requirement: &2152510880 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
@@ -22,10 +21,15 @@ dependencies:
22
21
  version: '1.0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2152510880
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
26
30
  - !ruby/object:Gem::Dependency
27
31
  name: omniauth-oauth2
28
- requirement: &2152510380 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
34
  requirements:
31
35
  - - ~>
@@ -33,10 +37,15 @@ dependencies:
33
37
  version: '1.0'
34
38
  type: :runtime
35
39
  prerelease: false
36
- version_requirements: *2152510380
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
37
46
  - !ruby/object:Gem::Dependency
38
47
  name: rspec
39
- requirement: &2152509920 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
50
  requirements:
42
51
  - - ~>
@@ -44,10 +53,15 @@ dependencies:
44
53
  version: '2.7'
45
54
  type: :development
46
55
  prerelease: false
47
- version_requirements: *2152509920
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.7'
48
62
  - !ruby/object:Gem::Dependency
49
63
  name: rack-test
50
- requirement: &2152509540 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
51
65
  none: false
52
66
  requirements:
53
67
  - - ! '>='
@@ -55,10 +69,15 @@ dependencies:
55
69
  version: '0'
56
70
  type: :development
57
71
  prerelease: false
58
- version_requirements: *2152509540
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
59
78
  - !ruby/object:Gem::Dependency
60
79
  name: simplecov
61
- requirement: &2152509080 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
62
81
  none: false
63
82
  requirements:
64
83
  - - ! '>='
@@ -66,10 +85,15 @@ dependencies:
66
85
  version: '0'
67
86
  type: :development
68
87
  prerelease: false
69
- version_requirements: *2152509080
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
70
94
  - !ruby/object:Gem::Dependency
71
95
  name: webmock
72
- requirement: &2152508660 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
73
97
  none: false
74
98
  requirements:
75
99
  - - ! '>='
@@ -77,7 +101,12 @@ dependencies:
77
101
  version: '0'
78
102
  type: :development
79
103
  prerelease: false
80
- version_requirements: *2152508660
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
81
110
  description: Unofficial OmniAuth strategy for Readmill.
82
111
  email:
83
112
  - christof@chdorner.com
@@ -96,7 +125,6 @@ files:
96
125
  - omniauth-readmill.gemspec
97
126
  - spec/omniauth/strategies/readmill_spec.rb
98
127
  - spec/spec_helper.rb
99
- has_rdoc: true
100
128
  homepage: https://github.com/chdorner/omniauth-readmill
101
129
  licenses: []
102
130
  post_install_message:
@@ -117,10 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
145
  version: '0'
118
146
  requirements: []
119
147
  rubyforge_project:
120
- rubygems_version: 1.6.2
148
+ rubygems_version: 1.8.23
121
149
  signing_key:
122
150
  specification_version: 3
123
151
  summary: Unofficial OmniAuth strategy for Readmill.
124
- test_files:
125
- - spec/omniauth/strategies/readmill_spec.rb
126
- - spec/spec_helper.rb
152
+ test_files: []