omniauth-niconico 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84af34c375d6cb3d8170b9e890f7d0a784d2e60f
4
+ data.tar.gz: ef67a4c2efddcc2938b709f89190789f996671c0
5
+ SHA512:
6
+ metadata.gz: fe8f60125bcce4ac2f17fd3a6382df4a255888d6683915511a186efa37666ee4326c964b9b4c133ee393bebbe6dc80b6153f347676f1090b2e6b36f9423a3a0a
7
+ data.tar.gz: 671871dfa579239771412436ced4b5451b58378636ba2cad00a9ae06f1a3301b04d40815ff478408d906b4234b5af2df84cfa20aab41ca99f802e3db74de0e88
data/.drone.yml ADDED
@@ -0,0 +1,14 @@
1
+ build:
2
+ image: ruby:$$RUBY_VERSION
3
+ commands:
4
+ - gem install bundler
5
+ - bundle install --path vendor/bundle
6
+ - bundle exec rubocop
7
+ - bundle exec rake spec
8
+ cache:
9
+ mount:
10
+ - vendor
11
+ matrix:
12
+ RUBY_VERSION:
13
+ - 2.3.1
14
+ - 2.2.5
data/.gitignore ADDED
@@ -0,0 +1,14 @@
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
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ Metrics/LineLength:
2
+ Enabled: false
3
+ Metrics/MethodLength:
4
+ Enabled: false
5
+ Style/AsciiComments:
6
+ Enabled: false
7
+ Style/Documentation:
8
+ Enabled: false
9
+ Style/FileName:
10
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-niconico.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 dwango
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.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Omniauth::Niconico
2
+
3
+ Niconico OAuth2 Strategy for OmniAuth
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-niconico'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-niconico
20
+
21
+ ## Usage
22
+
23
+ ### Setup
24
+
25
+ [OmniAuth Only](https://github.com/intridea/omniauth)
26
+ or
27
+ [Devise + OmniAuth](https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview)
28
+
29
+ ### User Info
30
+
31
+ ```ruby
32
+ {
33
+ id: '25252525',
34
+ name: 'niconico user',
35
+ image: 'http://example.com/user_icon_of_25252525.png',
36
+ small_image: 'http://example.com/user_thumbnail_of_25252525.png'
37
+ }
38
+ ```
39
+
40
+ ## Contributing
41
+
42
+ 1. Fork it ( https://github.com/dwango/omniauth-niconico/fork )
43
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
44
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
45
+ 4. Push to the branch (`git push origin my-new-feature`)
46
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1 @@
1
+ require 'omniauth/niconico'
@@ -0,0 +1,2 @@
1
+ require 'omniauth/niconico/version'
2
+ require 'omniauth/strategies/niconico'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Niconico
3
+ VERSION = '0.0.1'.freeze
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ require 'omniauth/strategies/oauth2'
2
+
3
+ module Omniauth
4
+ module Strategies
5
+ class Niconico < OmniAuth::Strategies::OAuth2
6
+ option :name, 'niconico'
7
+
8
+ option :client_options,
9
+ site: 'https://oauth.nicovideo.jp',
10
+ authorize_url: '/oauth2/authorize',
11
+ token_url: '/oauth2/token'
12
+
13
+ uid { raw_info['userId'] }
14
+
15
+ info do
16
+ {
17
+ id: raw_info['userId'],
18
+ name: raw_info['nickName'],
19
+ image: raw_info['thumbnailUrl'],
20
+ small_image: raw_info['thumbnailSmallUrl']
21
+ }
22
+ end
23
+
24
+ extra do
25
+ {
26
+ raw_info: raw_info
27
+ }
28
+ end
29
+
30
+ def raw_info
31
+ return @raw_info if @raw_info
32
+ user = access_token.get('/v1/user.json').parsed
33
+ raise unless user['meta']['status'] == 200
34
+ @raw_info = user['data']
35
+ end
36
+
37
+ def callback_url
38
+ full_host + script_name + callback_path
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'omniauth/niconico/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'omniauth-niconico'
9
+ spec.version = Omniauth::Niconico::VERSION
10
+ spec.authors = ['dwango']
11
+ spec.email = ['rubygems@dwango.co.jp']
12
+ spec.summary = 'Niconico OAuth2 Strategy for OmniAuth.'
13
+ spec.description = 'Niconico OAuth2 Strategy for OmniAuth.'
14
+ spec.homepage = 'http://github.com/dwango/omniauth-niconico'
15
+ spec.license = 'MIT'
16
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_dependency 'omniauth-oauth2'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.14'
26
+ spec.add_development_dependency 'rake', '~> 12.0'
27
+ spec.add_development_dependency 'rspec'
28
+ spec.add_development_dependency 'rubocop'
29
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-niconico
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - dwango
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-04-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Niconico OAuth2 Strategy for OmniAuth.
84
+ email:
85
+ - rubygems@dwango.co.jp
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".drone.yml"
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".rubocop.yml"
94
+ - ".travis.yml"
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - lib/omniauth-niconico.rb
100
+ - lib/omniauth/niconico.rb
101
+ - lib/omniauth/niconico/version.rb
102
+ - lib/omniauth/strategies/niconico.rb
103
+ - omniauth-niconico.gemspec
104
+ homepage: http://github.com/dwango/omniauth-niconico
105
+ licenses:
106
+ - MIT
107
+ metadata:
108
+ allowed_push_host: https://rubygems.org
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.6.11
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Niconico OAuth2 Strategy for OmniAuth.
129
+ test_files: []