oa-codeschool 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e30ff1b29a6f401225ea8cd1925766b2f49681d4
4
+ data.tar.gz: a0d171155838228280de81730f56fb6ac7310138
5
+ SHA512:
6
+ metadata.gz: 4cc85703f5a6a79f4507eeee2f30e933b8cf605948ec292130a3b5eb3d473842cc65d19d96aa33857691ec67fcd34e67eb3d7d6281b7b2c0e04eb2d4da409051
7
+ data.tar.gz: 17f95513f0cc5089ed07d14f9ddecf4f50efe6201226cc16fbb1c9136fe8f2ace224b7bd1ec54728628533f8772b52262f827068a2bc0d875b2e6e87ab352c9d
data/.gitignore CHANGED
@@ -1,4 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
1
15
  *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
@@ -0,0 +1,34 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ ## 0.1.0 - unreleased
5
+ ### Added
6
+ - `image` in `user_info` return the user's Gravatar on Code School.
7
+
8
+ ### Changed
9
+ - **BREAKING**: point to new Code School `/oauth2` endpoints.
10
+ - **BREAKING**: remove `first_name` and `last_name` from `user_info`.
11
+ - **BREAKING**: strategy name changed from `code_path` to `code_school`.
12
+ - Point to Code School's v2 User API endpoint.
13
+ - Use Faraday's parser instead of MultiJSON to parse Code School User
14
+ API response.
15
+
16
+ ## 0.0.6 - 2014-12-11 (yanked)
17
+ ### Added
18
+ - This CHANGELOG
19
+ - CONTRIBUTING file
20
+
21
+ ### Changed
22
+ - Fixed documentation to refer to CodeSchool instead of CodePath.
23
+ - Updated LICENSE.
24
+ - Updated homepage.
25
+
26
+ ## 0.0.5 - 2011-05-06
27
+
28
+ ## 0.0.4 - 2011-04-15
29
+
30
+ ## 0.0.3 - 2011-04-15
31
+
32
+ ## 0.0.2 - 2011-04-15
33
+
34
+ ## 0.0.1 - 2011-04-15
@@ -0,0 +1,7 @@
1
+ # Contribution Guidelines
2
+
3
+ 1. Fork it ( https://github.com/[my-github-username]/oa-codeschool/fork )
4
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
5
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
6
+ 4. Push to the branch (`git push origin my-new-feature`)
7
+ 5. Create a new Pull Request
data/Gemfile CHANGED
@@ -1,2 +1,3 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
+
2
3
  gemspec
@@ -1,20 +1,21 @@
1
- Copyright (c) 2011 Eric Allam
1
+ The MIT License (MIT)
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
3
+ Copyright (c) 2014 Code School
10
4
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
13
11
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,54 @@
1
+ # oa-codeschool
2
+
3
+ A backward-compatible OmniAuth gem strategy for Code School.
4
+
5
+ There a new [omniauth-codeschool](https://github.com/codeschool/omniauth-codeschool)
6
+ gem but it requires OmniAuth 1.x and above. This strategy is compatible
7
+ with OmniAuth 0.2.x which we still use in older apps.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'oa-codeschool'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ ```
20
+ $ bundle
21
+ ```
22
+
23
+ Or install it yourself as:
24
+
25
+ ```
26
+ $ gem install oa-codeschool
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ In your config/initializers/omniauth.rb :
32
+
33
+ ```ruby
34
+ Rails.application.config.middleware.use OmniAuth::Builder do
35
+ provider OmniAuth::Strategies::CodeSchool, 'client_id', 'client_secret'
36
+ end
37
+ ```
38
+
39
+ By default, the `base_uri` for code_path is set to http://localhost:3000.
40
+ In different environments you may want to change it:
41
+
42
+ ```ruby
43
+ OmniAuth::Strategies::CodePath.base_uri = "http://codepath.com"
44
+ ```
45
+
46
+ Then all you have to do is redirect the `/` link to `/auth/code_school` and
47
+ OmniAuth will take care of the rest
48
+
49
+
50
+ ## Contributing
51
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
52
+
53
+ ## License
54
+ See [LICENSE][LICENSE].
data/Rakefile CHANGED
@@ -1,15 +1,2 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ require "bundler/gem_tasks"
3
2
 
4
- require 'rspec/core'
5
- require 'rspec/core/rake_task'
6
- RSpec::Core::RakeTask.new(:spec) do |spec|
7
- spec.pattern = FileList['spec/**/*_spec.rb']
8
- end
9
-
10
- RSpec::Core::RakeTask.new(:rcov) do |spec|
11
- spec.pattern = 'spec/**/*_spec.rb'
12
- spec.rcov = true
13
- end
14
-
15
- task :default => :spec
@@ -8,8 +8,7 @@ require 'omniauth/oauth'
8
8
 
9
9
  module OmniAuth
10
10
  module Strategies
11
- # Authenticate to Code School utilizing OAuth 2.0 and retrieve
12
- # basic user information.
11
+ # Authenticate to Code School with OAuth 2.0 and retrieve basic user information.
13
12
  #
14
13
  # @example Basic Usage
15
14
  # use OmniAuth::Strategies::CodeSchool, 'client_id', 'client_secret'
@@ -20,13 +19,13 @@ module OmniAuth
20
19
  # @param [String] client_secret the application secret as registered on Facebook
21
20
  # @option options [String] :scope ('email,offline_access') comma-separated extended permissions such as `email` and `manage_pages`
22
21
  def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
23
- super(app, :code_path, client_id, client_secret, {
22
+ super(app, :code_school, client_id, client_secret, {
24
23
  :site => self.class.base_uri.presence || "http://localhost:3000",
25
- :authorize_path => "/oauth/authorize",
26
- :access_token_path => "/oauth/token"
24
+ :authorize_url => "/oauth2/authorize",
25
+ :token_url => "/oauth2/token"
27
26
  }, options, &block)
28
27
  end
29
-
28
+
30
29
  def request_phase
31
30
  options[:response_type] ||= "code"
32
31
  super
@@ -38,24 +37,23 @@ module OmniAuth
38
37
  end
39
38
 
40
39
  def user_data
41
- @data ||= MultiJson.decode(@access_token.get('/api/v1/user.json', {}, {}))['user']
40
+ @data ||= @access_token.get('/api/v2/user.json').parsed['user']
42
41
  end
43
42
 
44
43
  # memoize the client or else setting up Faraday stubs does not work
45
44
  def client
46
45
  @_client ||= super
47
46
  end
48
-
47
+
49
48
  def user_info
50
49
  {
51
- 'nickname' => user_data["twitter_name"],
52
- 'email' => (user_data["email"] if user_data["email"]),
53
- 'first_name' => user_data["name"].split(" ").first,
54
- 'last_name' => user_data["name"].split(" ").last,
55
- 'name' => user_data['name']
50
+ 'nickname' => user_data["username"],
51
+ 'email' => user_data["email"],
52
+ 'name' => user_data['name'],
53
+ 'image' => user_data['avatar']
56
54
  }
57
55
  end
58
-
56
+
59
57
  def auth_hash
60
58
  OmniAuth::Utils.deep_merge(super, {
61
59
  'uid' => user_data['id'],
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Strategies
3
- CODE_SCHOOL_VERSION = '0.0.5'
3
+ CODE_SCHOOL_VERSION = '0.1.0'
4
4
  end
5
5
  end
@@ -1,26 +1,27 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
4
  require 'oa-codeschool/version'
4
5
 
5
- Gem::Specification.new do |s|
6
- s.name = 'oa-codeschool'
7
- s.version = OmniAuth::Strategies::CODE_SCHOOL_VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ['Eric Allam']
10
- s.email = ['eric@envylabs.com']
11
- s.homepage = 'https://github.com/envylabs/oa-codeschool'
12
- s.summary = 'Provides an OmniAuth strategy for OAuth2 on CodeSchool.com'
13
- s.description = 'Provides an OmniAuth strategy for OAuth2 on CodeSchool.com'
14
- s.licenses = ['MIT']
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "oa-codeschool"
8
+ spec.version = OmniAuth::Strategies::CODE_SCHOOL_VERSION
9
+ spec.authors = ["Eric Allam", "Olivier Lacan"]
10
+ spec.email = ["vendor@codeschool.com"]
11
+ spec.summary = %q{OAuth2 OmniAuth strategy for Code School}
12
+ spec.description = %q{OAuth2 OmniAuth strategy for Code School}
13
+ spec.homepage = "https://github.com/codeschool/oa-codeschool/"
14
+ spec.license = "MIT"
15
15
 
16
- s.add_runtime_dependency('omniauth', ['~> 0.2.5'])
17
- s.add_runtime_dependency('multi_json', ['>= 0'])
18
- s.add_runtime_dependency('activesupport', ['>= 0'])
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
19
20
 
20
- s.add_development_dependency('rspec', ['~> 2.3.0'])
21
+ spec.add_runtime_dependency('omniauth', ['~> 0.3.0'])
22
+ spec.add_runtime_dependency('activesupport', ['>= 0'])
21
23
 
22
- s.files = `git ls-files`.split("\n")
23
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
- s.require_paths = ['lib']
24
+ spec.add_development_dependency('rspec', ['~> 2.3.0'])
25
+ spec.add_development_dependency "bundler", "~> 1.7"
26
+ spec.add_development_dependency "rake", "~> 10.0"
26
27
  end
metadata CHANGED
@@ -1,138 +1,131 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: oa-codeschool
3
- version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 5
10
- version: 0.0.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Eric Allam
8
+ - Olivier Lacan
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-05-06 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2014-12-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: omniauth
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 29
29
- segments:
30
- - 0
31
- - 2
32
- - 5
33
- version: 0.2.5
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.3.0
34
21
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: multi_json
38
22
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.3.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: activesupport
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
42
32
  - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
48
35
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: activesupport
52
36
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
56
39
  - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
62
- type: :runtime
63
- version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
65
43
  name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 2.3.0
49
+ type: :development
66
50
  prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ~>
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 2
75
- - 3
76
- - 0
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
77
55
  version: 2.3.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.7'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.7'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '10.0'
78
77
  type: :development
79
- version_requirements: *id004
80
- description: Provides an OmniAuth strategy for OAuth2 on CodeSchool.com
81
- email:
82
- - eric@envylabs.com
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '10.0'
84
+ description: OAuth2 OmniAuth strategy for Code School
85
+ email:
86
+ - vendor@codeschool.com
83
87
  executables: []
84
-
85
88
  extensions: []
86
-
87
89
  extra_rdoc_files: []
88
-
89
- files:
90
- - .gitignore
91
- - .rspec
92
- - .rvmrc
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".rvmrc"
94
+ - CHANGELOG.md
95
+ - CONTRIBUTING.md
93
96
  - Gemfile
94
97
  - LICENSE.txt
95
- - README.rdoc
98
+ - README.md
96
99
  - Rakefile
97
- - VERSION
98
100
  - lib/oa-codeschool.rb
99
101
  - lib/oa-codeschool/version.rb
100
102
  - oa-codeschool.gemspec
101
103
  - spec/oa-codepath_spec.rb
102
104
  - spec/spec_helper.rb
103
- homepage: https://github.com/envylabs/oa-codeschool
104
- licenses:
105
+ homepage: https://github.com/codeschool/oa-codeschool/
106
+ licenses:
105
107
  - MIT
108
+ metadata: {}
106
109
  post_install_message:
107
110
  rdoc_options: []
108
-
109
- require_paths:
111
+ require_paths:
110
112
  - lib
111
- required_ruby_version: !ruby/object:Gem::Requirement
112
- none: false
113
- requirements:
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
114
115
  - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
118
- - 0
119
- version: "0"
120
- required_rubygems_version: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
123
120
  - - ">="
124
- - !ruby/object:Gem::Version
125
- hash: 3
126
- segments:
127
- - 0
128
- version: "0"
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
129
123
  requirements: []
130
-
131
124
  rubyforge_project:
132
- rubygems_version: 1.7.2
125
+ rubygems_version: 2.2.2
133
126
  signing_key:
134
- specification_version: 3
135
- summary: Provides an OmniAuth strategy for OAuth2 on CodeSchool.com
136
- test_files:
127
+ specification_version: 4
128
+ summary: OAuth2 OmniAuth strategy for Code School
129
+ test_files:
137
130
  - spec/oa-codepath_spec.rb
138
131
  - spec/spec_helper.rb
@@ -1,33 +0,0 @@
1
- = oa-codepath
2
-
3
- Include in your Gemfile:
4
-
5
- gem 'oa-codepath'
6
-
7
- Then in your config/initializers/omniauth.rb :
8
-
9
- Rails.application.config.middleware.use OmniAuth::Builder do
10
- provider OmniAuth::Strategies::CodePath, 'client_id', 'client_secret'
11
- end
12
-
13
- By default the base_uri for code_path is set to http://localhost::3000, in different environments you may want to change it:
14
-
15
- OmniAuth::Strategies::CodePath.base_uri = "http://codepath.com"
16
-
17
- Then all you have to do is redirect / link to /auth/code_path and omniauth will take care of the rest
18
-
19
- == Contributing to oa-codepath
20
-
21
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
22
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
23
- * Fork the project
24
- * Start a feature/bugfix branch
25
- * Commit and push until you are happy with your contribution
26
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
27
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
28
-
29
- == Copyright
30
-
31
- Copyright (c) 2011 Eric Allam. See LICENSE.txt for
32
- further details.
33
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.5