omniauth-typetalk 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bc1947f01e44f45cd0fc5a7eb2b962105fa85ba4
4
- data.tar.gz: d69f14161a67c08259011b7135f3b99196ac79b3
2
+ SHA256:
3
+ metadata.gz: f6f08284ede4a0ff4a212eb2b1699b185e728bd95529796ab538b8f56432eadb
4
+ data.tar.gz: 5182741e2e5d1500b7b698cbfb7cce204d3eb968d043bda50cbeab5c3404e5e2
5
5
  SHA512:
6
- metadata.gz: 2ccd64dbaf6ec496ed824bcfac02bdb6b0439ba5066155cab1b71bc37407305109ddec8c44cb1906aa05bcc2c598cbbba7c34e1dadb564df954105410208a191
7
- data.tar.gz: 17cc2548339e09b17f3731103ac78547a241fdbe1c8aa12980c88ed9fc207d7c646eb10cb81d27836737e13b842df386b2b5cd2912d6de08cf7af0db8aeb754b
6
+ metadata.gz: 89240e2e6d0a44371250fb5ce0cd8a83cbcc7638a79b475bc3c77d64d474319064fbea5d8f42782195e7ad3b8fe1d797eefad3f6514d81ad19717f5faafca46f
7
+ data.tar.gz: f1937086367ca55ad6843308276904da45bf7b82b130417160077cf5336f1816c68f87b386a4c9a0926e82b6390c6aceb6a2e884329da4577e73ca1313ad8292
@@ -0,0 +1,10 @@
1
+ before_install:
2
+ - gem update bundler
3
+ - bundle --version
4
+ - gem update --system
5
+ - gem --version
6
+ rvm:
7
+ - 2.6
8
+ - 2.5
9
+ - 2.4
10
+ - 2.3
@@ -1,5 +1,17 @@
1
+ ## Setup
2
+
3
+ ```
4
+ $ bundle install
5
+ ```
6
+
1
7
  ## TEST
2
8
 
3
9
  ```
4
10
  $ rake spec
11
+ ```
12
+
13
+ ## lint
14
+
15
+ ```
16
+ $ rubocop
5
17
  ```
data/Gemfile CHANGED
@@ -1,8 +1,9 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in omniauth-typetalk.gemspec
4
3
  gemspec
5
4
 
6
5
  group :development, :test do
7
- gem 'rake'
8
- end
6
+ gem 'rake'
7
+ gem 'rspec'
8
+ gem 'rubocop', '~> 0.63.0', require: false
9
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-typetalk (0.1.0)
4
+ omniauth-typetalk (0.1.3)
5
5
  omniauth (~> 1.5)
6
6
  omniauth-oauth2 (>= 1.4.0, < 2.0)
7
7
 
@@ -10,13 +10,16 @@ GEM
10
10
  specs:
11
11
  addressable (2.6.0)
12
12
  public_suffix (>= 2.0.2, < 4.0)
13
+ ast (2.4.0)
13
14
  crack (0.4.3)
14
15
  safe_yaml (~> 1.0.0)
16
+ diff-lcs (1.3)
15
17
  docile (1.3.1)
16
18
  faraday (0.15.4)
17
19
  multipart-post (>= 1.2, < 3)
18
20
  hashdiff (0.3.8)
19
21
  hashie (3.6.0)
22
+ jaro_winkler (1.5.2)
20
23
  json (2.1.0)
21
24
  jwt (2.1.0)
22
25
  multi_json (1.13.1)
@@ -34,17 +37,45 @@ GEM
34
37
  omniauth-oauth2 (1.6.0)
35
38
  oauth2 (~> 1.1)
36
39
  omniauth (~> 1.9)
40
+ parallel (1.13.0)
41
+ parser (2.6.0.0)
42
+ ast (~> 2.4.0)
43
+ powerpack (0.1.2)
37
44
  public_suffix (3.0.3)
38
45
  rack (2.0.6)
39
46
  rack-test (1.1.0)
40
47
  rack (>= 1.0, < 3)
48
+ rainbow (3.0.0)
41
49
  rake (12.3.2)
50
+ rspec (3.8.0)
51
+ rspec-core (~> 3.8.0)
52
+ rspec-expectations (~> 3.8.0)
53
+ rspec-mocks (~> 3.8.0)
54
+ rspec-core (3.8.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-expectations (3.8.2)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.8.0)
59
+ rspec-mocks (3.8.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.8.0)
62
+ rspec-support (3.8.0)
63
+ rubocop (0.63.0)
64
+ jaro_winkler (~> 1.5.1)
65
+ parallel (~> 1.10)
66
+ parser (>= 2.5, != 2.5.1.1)
67
+ powerpack (~> 0.1)
68
+ rainbow (>= 2.2.2, < 4.0)
69
+ ruby-progressbar (~> 1.7)
70
+ unicode-display_width (~> 1.4.0)
71
+ ruby-progressbar (1.10.0)
42
72
  safe_yaml (1.0.4)
43
73
  simplecov (0.16.1)
44
74
  docile (~> 1.1)
45
75
  json (>= 1.8, < 3)
46
76
  simplecov-html (~> 0.10.0)
47
77
  simplecov-html (0.10.2)
78
+ unicode-display_width (1.4.1)
48
79
  webmock (3.5.1)
49
80
  addressable (>= 2.3.6)
50
81
  crack (>= 0.3.2)
@@ -58,6 +89,8 @@ DEPENDENCIES
58
89
  omniauth-typetalk!
59
90
  rack-test
60
91
  rake
92
+ rspec
93
+ rubocop (~> 0.63.0)
61
94
  simplecov
62
95
  webmock
63
96
 
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  omniauth-typetalk
2
2
  ===
3
3
 
4
+ [![Build Status](https://travis-ci.org/is2ei/omniauth-typetalk.svg?branch=master)][travis]
5
+ [![Gem Version](https://img.shields.io/gem/v/omniauth-typetalk.svg)][rubygems]
6
+
7
+ [travis]: https://travis-ci.org/is2ei/omniauth-typetalk
8
+ [rubygems]: https://rubygems.org/gems/omniauth-typetalk
9
+
4
10
  Typetalk OAuth2 Strategy for OmniAuth
5
11
 
6
12
  ## Basic Usage
@@ -10,3 +16,36 @@ use OmniAuth::Builder do
10
16
  provider :typetalk, ENV['TYPETALK_KEY'], ENV['TYPETALK_SECRET']
11
17
  end
12
18
  ```
19
+
20
+ ## Sinatra Example
21
+
22
+ ```ruby
23
+ require 'sinatra'
24
+ require 'omniauth'
25
+ require 'omniauth-typetalk'
26
+
27
+ use Rack::Session::Cookie
28
+ use OmniAuth::Builder do
29
+ provider :typetalk, ENV['TYPETALK_KEY'], ENV['TYPETALK_SECRET'], scope: "my topic.read"
30
+ end
31
+
32
+ get '/' do
33
+ <<-HTML
34
+ <a href='/auth/typetalk'>Sign in with Typetalk</a>
35
+ HTML
36
+ end
37
+
38
+ get '/auth/:name/callback' do
39
+ auth = request.env['omniauth.auth']
40
+
41
+ <<-HTML
42
+ <p>[Profile]</p>
43
+ <p>id: #{auth.info.id}</p>
44
+ <p>name: #{auth.info.name}</p>
45
+ <p>fullName: #{auth.info.fullName}</p>
46
+ <p>suggestion: #{auth.info.suggestion}</p>
47
+ <p>imageUrl: #{auth.info.imageUrl}</p>
48
+ <p>createdAt: #{auth.info.createdAt}</p>
49
+ HTML
50
+ end
51
+ ```
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rubocop/rake_task'
3
3
  require 'rspec/core/rake_task'
4
4
 
5
+ RuboCop::RakeTask.new
5
6
  RSpec::Core::RakeTask.new
6
7
 
7
8
  desc 'Run specs'
8
- task :default => :spec
9
+ task default: %i[rubocop spec]
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Typetalk
3
- VERSION = "0.1.3"
3
+ VERSION = '0.1.4'.freeze
4
4
  end
5
- end
5
+ end
@@ -2,12 +2,12 @@ require 'omniauth-oauth2'
2
2
 
3
3
  module OmniAuth
4
4
  module Strategies
5
+ # Typetalk handles Oauth2 authentication with Typetalk.
5
6
  class Typetalk < OmniAuth::Strategies::OAuth2
6
- option :client_options, {
7
- :site => 'https://typetalk.com',
8
- :authorize_url => 'https://typetalk.com/oauth2/authorize',
9
- :token_url => 'https://typetalk.com/oauth2/access_token',
10
- }
7
+ option :client_options,
8
+ site: 'https://typetalk.com',
9
+ authorize_url: 'https://typetalk.com/oauth2/authorize',
10
+ token_url: 'https://typetalk.com/oauth2/access_token'
11
11
 
12
12
  def request_phase
13
13
  super
@@ -16,30 +16,28 @@ module OmniAuth
16
16
  def authorize_params
17
17
  super.tap do |params|
18
18
  %w[scope client_options].each do |v|
19
- if request.params[v]
20
- params[v.to_sym] = request.params[v]
21
- end
19
+ params[v.to_sym] = request.params[v] if request.params[v]
22
20
  end
23
21
  end
24
22
  end
25
23
 
26
24
  info do
27
25
  {
28
- 'id' => raw_info['account']['id'],
29
- 'name' => raw_info['account']['name'],
30
- 'fullName' => raw_info['account']['fullName'],
26
+ 'id' => raw_info['account']['id'],
27
+ 'name' => raw_info['account']['name'],
28
+ 'fullName' => raw_info['account']['fullName'],
31
29
  'suggestion' => raw_info['account']['suggestion'],
32
- 'imageUrl' => raw_info['account']['imageUrl'],
33
- 'isBot' => raw_info['account']['isBot'],
34
- 'lang' => raw_info['account']['lang'],
30
+ 'imageUrl' => raw_info['account']['imageUrl'],
31
+ 'isBot' => raw_info['account']['isBot'],
32
+ 'lang' => raw_info['account']['lang'],
35
33
  'timezoneId' => raw_info['account']['timezoneId'],
36
- 'createdAt' => raw_info['account']['createdAt'],
37
- 'updatedAt' => raw_info['account']['updatedAt'],
34
+ 'createdAt' => raw_info['account']['createdAt'],
35
+ 'updatedAt' => raw_info['account']['updatedAt']
38
36
  }
39
37
  end
40
38
 
41
39
  extra do
42
- {:raw_info => raw_info}
40
+ { raw_info: raw_info }
43
41
  end
44
42
 
45
43
  def raw_info
@@ -0,0 +1,2 @@
1
+ require 'omniauth-typetalk/version'
2
+ require 'omniauth/strategies/typetalk'
@@ -1,31 +1,30 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "omniauth-typetalk/version"
3
+ require 'omniauth-typetalk/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "omniauth-typetalk"
6
+ spec.name = 'omniauth-typetalk'
8
7
  spec.version = OmniAuth::Typetalk::VERSION
9
- spec.authors = ["Issei Horie"]
10
- spec.email = ["is2ei.horie@gmail.com"]
8
+ spec.authors = ['Issei Horie']
9
+ spec.email = ['is2ei.horie@gmail.com']
11
10
 
12
- spec.summary = %q{OmniAuth strategy for Typetalk.}
13
- spec.description = %q{OmniAuth strategy for Typetalk.}
14
- spec.homepage = "https://github.com/is2ei/omniauth-typetalk"
11
+ spec.summary = 'OmniAuth strategy for Typetalk.'
12
+ spec.description = 'OmniAuth strategy for Typetalk, chat app by Nulab'
13
+ spec.homepage = 'https://github.com/is2ei/omniauth-typetalk'
14
+ spec.license = 'MIT'
15
15
 
16
- # Specify which files should be added to the gem when it is released.
17
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
+ `git ls-files -z`
18
+ .split("\x0")
19
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
20
20
  end
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
21
+ spec.require_paths = ['lib']
23
22
 
24
- spec.add_development_dependency "bundler", "~> 2.0"
25
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency 'bundler', '~> 2.0'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
26
25
  spec.add_dependency 'omniauth', '~> 1.5'
27
26
  spec.add_dependency 'omniauth-oauth2', '>= 1.4.0', '< 2.0'
28
- spec.add_development_dependency 'rack-test'
29
- spec.add_development_dependency 'simplecov'
30
- spec.add_development_dependency 'webmock'
27
+ spec.add_development_dependency 'rack-test', '0.6.3'
28
+ spec.add_development_dependency 'simplecov', '0.16.1'
29
+ spec.add_development_dependency 'webmock', '3.5.1'
31
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-typetalk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Issei Horie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-19 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,45 +76,45 @@ dependencies:
76
76
  name: rack-test
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: 0.6.3
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: '0'
88
+ version: 0.6.3
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: simplecov
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: '0'
95
+ version: 0.16.1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: '0'
102
+ version: 0.16.1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: webmock
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
107
+ - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: 3.5.1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ">="
114
+ - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: '0'
117
- description: OmniAuth strategy for Typetalk.
116
+ version: 3.5.1
117
+ description: OmniAuth strategy for Typetalk, chat app by Nulab
118
118
  email:
119
119
  - is2ei.horie@gmail.com
120
120
  executables: []
@@ -122,18 +122,20 @@ extensions: []
122
122
  extra_rdoc_files: []
123
123
  files:
124
124
  - ".gitignore"
125
+ - ".travis.yml"
125
126
  - DEVELOPMENT.md
126
127
  - Gemfile
127
128
  - Gemfile.lock
128
129
  - LICENSE
129
130
  - README.md
130
131
  - Rakefile
131
- - lib/omniauth-typetalk.rb
132
132
  - lib/omniauth-typetalk/version.rb
133
133
  - lib/omniauth/strategies/typetalk.rb
134
+ - lib/omniauth_typetalk.rb
134
135
  - omniauth-typetalk.gemspec
135
136
  homepage: https://github.com/is2ei/omniauth-typetalk
136
- licenses: []
137
+ licenses:
138
+ - MIT
137
139
  metadata: {}
138
140
  post_install_message:
139
141
  rdoc_options: []
@@ -151,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
153
  version: '0'
152
154
  requirements: []
153
155
  rubyforge_project:
154
- rubygems_version: 2.5.2.3
156
+ rubygems_version: 2.7.3
155
157
  signing_key:
156
158
  specification_version: 4
157
159
  summary: OmniAuth strategy for Typetalk.
@@ -1,2 +0,0 @@
1
- require "omniauth-typetalk/version"
2
- require "omniauth/strategies/typetalk"