omniauth-skritter 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 86bc34ac5043995bab85572b92eea1344d0e73da
4
+ data.tar.gz: a139fb23269b23b9995f1d9f38dac285b0aeb2c7
5
+ SHA512:
6
+ metadata.gz: 5daf315b3644903a0248c7dc463de0641c619d5d5db4bab97a37e22967cf2ce4ec7d9d166162e3ceae0772a44cd970340709199970292995275d8620f8890c5f
7
+ data.tar.gz: 66046d7f9afe05185943ed375d70cc1514e7fbd4740fe1423b37ef4afe6a70d6415a074f107e6d16ae4d045ff4000c9279733bc83841c4df7a086038f04698c8
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Bethany Marie Soule
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+
2
+ An Omniauth strategy for Skritter
3
+
@@ -0,0 +1,2 @@
1
+ require 'omniauth-skritter/version'
2
+ require 'omniauth/strategies/skritter'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Skritter
3
+ VERSION = "0.1"
4
+ end
5
+ end
@@ -0,0 +1,56 @@
1
+ require 'omniauth-oauth2'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Skritter < OmniAuth::Strategies::OAuth2
7
+
8
+ # Give your strategy a name.
9
+ option :name, "skritter"
10
+
11
+ # This is where you pass the options you would pass when
12
+ # initializing your consumer from the OAuth gem.
13
+ option :client_options, {
14
+ :site => "https://www.skritter.com",
15
+ :authorize_url => "/api/v0/oauth2/authorize",
16
+ :token_url => "/api/v0/oauth2/token"
17
+ }
18
+
19
+ # These are called after authentication has succeeded. If
20
+ # possible, you should try to set the UID without making
21
+ # additional calls (if the user id is returned with the token
22
+ # or as a URI parameter). This may not be possible with all
23
+ # providers.
24
+ uid{ access_token.params['user_id'] }
25
+
26
+ info do
27
+ { :email => raw_info['email'] }
28
+ end
29
+
30
+ def raw_info
31
+ @raw_info ||= { }
32
+ end
33
+
34
+ # Bugfix for regression introduced after omniauth-oauth2 v1.3.1
35
+ # details: https://github.com/intridea/omniauth-oauth2/issues/81
36
+ def callback_url
37
+ options[:callback_url] || (full_host + script_name + callback_path)
38
+ end
39
+ protected
40
+ # v1.1.2
41
+ def build_access_token
42
+ params = {
43
+ :redirect_uri => callback_url,
44
+ :headers => { "Authorization" => "Basic " +
45
+ Base64.strict_encode64("#{client.id}:#{client.secret}")
46
+ },
47
+ :code=>request.params['code'],
48
+ :grant_type=>"authorization_code",
49
+ :client_id=>client.id
50
+ }.merge(token_params.to_hash(:symbolize_keys => true))
51
+ client.auth_code.get_token(request.params['code'], params)
52
+ end
53
+ end
54
+ end
55
+ end
56
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth-skritter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-skritter"
8
+ spec.version = Omniauth::Skritter::VERSION
9
+ spec.authors = ["Bethany Marie Soule"]
10
+ spec.email = ["bsoule@gmail.com"]
11
+ spec.description = "OmniAuth strategy for Skritter"
12
+ spec.summary = "This is an omniauth strategy for Skritter"
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-skritter
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Bethany Marie Soule
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: OmniAuth strategy for Skritter
42
+ email:
43
+ - bsoule@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - Gemfile
49
+ - LICENSE.txt
50
+ - README.md
51
+ - lib/omniauth-skritter.rb
52
+ - lib/omniauth-skritter/version.rb
53
+ - lib/omniauth/strategies/skritter.rb
54
+ - omniauth-skritter.gemspec
55
+ homepage: ''
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.4.5
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: This is an omniauth strategy for Skritter
79
+ test_files: []