omniauth-tanita 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ce09505bfcc54bef4d79556e0c262fc41aa4850896123227ff1d4fc034ac901
4
- data.tar.gz: 6b986363e5484f80103e6fb0c08fc8c3f857350eabbc2d3d1faf83d9dc18d498
3
+ metadata.gz: 3ba22682ade5a3ac1076bfa1df775743a4dcd75c9a09b04e3c05a0e3a91d2329
4
+ data.tar.gz: a66cf2bb9a329eb9f751340cbcaaca6eb49c4bb6402e46762c84854fb03b4639
5
5
  SHA512:
6
- metadata.gz: 3656e2f993c681a44fc24093129db027ce2248c66467ad2fd5dc81fbff0637b08fd07d0563ba6b270f999a3160cc2707610157e3692b76aa3b4b08b9b0dd6fb1
7
- data.tar.gz: dfc739abeb56392da788e6498174d35ed0ff464c77b1d21fcba39b2bd72eb049659ab8dfa7c116a2dbe68155991d994f887226347cc4fd0355883d4d54f770b7
6
+ metadata.gz: bdff4c2dff1f08df8e48d21d7746b44c5f7282a49e1d6e5d3e6174741beb8d363a35a3f780584740917580da757032dab460583d244fc201be6ff00f0d5e5f3f
7
+ data.tar.gz: 995094eadfa8eb06e62d52e6531161863e89634aa7c6a3654160d8aed3c4746f09b72ccfbfa06616abf2b3260d801d3e518244a52e6b55ab60bf4b319e362e1a
@@ -0,0 +1,37 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+
7
+ jobs:
8
+ build:
9
+ name: Build + Publish
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby 2.6
15
+ uses: actions/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.6
18
+
19
+ - name: Build and test
20
+ run: |
21
+ gem install bundler
22
+ bundle install --jobs 4 --retry 3
23
+ bundle exec rspec
24
+ env:
25
+ CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
26
+
27
+ - name: Publish to RubyGems
28
+ run: |
29
+ mkdir -p $HOME/.gem
30
+ touch $HOME/.gem/credentials
31
+ chmod 0600 $HOME/.gem/credentials
32
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33
+ gem build *.gemspec
34
+ gem push *.gem
35
+ continue-on-error: true
36
+ env:
37
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -0,0 +1,21 @@
1
+ name: Test
2
+
3
+ on: pull_request
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.6
15
+ - name: Build and test
16
+ run: |
17
+ gem install bundler
18
+ bundle install --jobs 4 --retry 3
19
+ bundle exec rspec
20
+ env:
21
+ CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
@@ -1,11 +1,26 @@
1
+ # 0.4.0
2
+
3
+ - refs #7 fix dependencies.
4
+
5
+ # 0.3.0
6
+
7
+ - remove 'tanita-api-client' dependency.
8
+ - rename module 'Omniauth' to 'OmniAuth'.
9
+ - update gem-push GitHub Actions settings in order to ignore error for same version.
10
+
11
+ # 0.2.3
12
+
13
+ - refs #1 setup GitHub Actions for rspec and pushing to RubyGems.
14
+ - measure code coverage
15
+
1
16
  # 0.2.0
2
17
 
3
- * set default `provider_ignores_state` to true
18
+ - set default `provider_ignores_state` to true
4
19
 
5
20
  # 0.1.1
6
21
 
7
- * Update dependent library 'tanita-api-client' to v0.2.3
22
+ - Update dependent library 'tanita-api-client' to v0.2.3
8
23
 
9
24
  # 0.1.0
10
25
 
11
- * Initial release
26
+ - Initial release
data/README.md CHANGED
@@ -1,17 +1,18 @@
1
1
  # OmniAuth::Tanita
2
2
 
3
+ [![Test](https://github.com/koshilife/omniauth-tanita/workflows/Test/badge.svg)](https://github.com/koshilife/omniauth-tanita/actions?query=workflow%3ATest)
4
+ [![codecov](https://codecov.io/gh/koshilife/omniauth-tanita/branch/master/graph/badge.svg)](https://codecov.io/gh/koshilife/omniauth-tanita)
3
5
  [![Gem Version](https://badge.fury.io/rb/omniauth-tanita.svg)](http://badge.fury.io/rb/omniauth-tanita)
6
+ [![license](https://img.shields.io/github/license/koshilife/omniauth-tanita)](https://github.com/koshilife/omniauth-tanita/blob/master/LICENSE.txt)
4
7
 
5
8
  This gem contains the Tanita Health Planet strategy for OmniAuth.
6
9
 
7
-
8
10
  ## Before You Begin
9
11
 
10
12
  You should have already installed OmniAuth into your app; if not, read the [OmniAuth README](https://github.com/intridea/omniauth) to get started.
11
13
 
12
14
  Now sign into the [Health Planet API Settings page](https://www.healthplanet.jp/apis_account.do) and create an application. Take note of your API keys.
13
15
 
14
-
15
16
  ## Using This Strategy
16
17
 
17
18
  First start by adding this gem to your Gemfile:
@@ -33,8 +34,8 @@ Rails.application.config.middleware.use OmniAuth::Builder do
33
34
  provider :tanita, "API_KEY", "API_SECRET"
34
35
  end
35
36
  ```
36
- Replace `"API_KEY"` and `"API_SECRET"` with the appropriate values you obtained [earlier](https://www.healthplanet.jp/apis_account.do).
37
37
 
38
+ Replace `"API_KEY"` and `"API_SECRET"` with the appropriate values you obtained [earlier](https://www.healthplanet.jp/apis_account.do).
38
39
 
39
40
  ## Scopes
40
41
 
@@ -44,20 +45,34 @@ If you use other scope, you can specify like so:
44
45
  ```ruby
45
46
 
46
47
  Rails.application.config.middleware.use OmniAuth::Builder do
47
- TanitaScope = Tanita::Api::Client::Scope
48
48
 
49
49
  # Sphygmomanometer
50
- provider :tanita, "API_KEY", "API_SECRET", :scope => TanitaScope::SPHYGMOMANOMETER
50
+ provider :tanita, "API_KEY", "API_SECRET", :scope => 'sphygmomanometer'
51
51
 
52
52
  # Pedometer and Smug
53
- provider :tanita, "API_KEY", "API_SECRET", :scope => [TanitaScope::PEDOMETER, TanitaScope::SMUG].join(',')
54
-
55
- # All scopes
56
- provider :tanita, "API_KEY", "API_SECRET", :scope => TanitaScope.all.join(',')
53
+ provider :tanita, "API_KEY", "API_SECRET", :scope => ['pedometer', 'smug'].join(',')
57
54
 
58
55
  end
59
56
  ```
60
57
 
58
+ ## Auth Hash Example
59
+
60
+ The auth hash `request.env['omniauth.auth']` would look like this:
61
+
62
+ ```js
63
+ {
64
+ "provider": "tanita",
65
+ "uid": null, // uid will be empty, because there is no apis to get.
66
+ "credentials": {
67
+ "token": "ACCESS_TOKEN",
68
+ "refresh_token": "REFRESH_TOKEN",
69
+ "expires_at": 1581419031,
70
+ "expires": true
71
+ },
72
+ "extra": {}
73
+ }
74
+ ```
75
+
61
76
  ## Contributing
62
77
 
63
78
  Bug reports and pull requests are welcome on [GitHub](https://github.com/koshilife/omniauth-tanita). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -3,13 +3,5 @@
3
3
 
4
4
  require 'bundler/setup'
5
5
  require 'omniauth-tanita'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
6
  require 'irb'
15
7
  IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -4,5 +4,3 @@ IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
6
  bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omniauth
3
+ module OmniAuth
4
4
  module Tanita
5
- VERSION = '0.2.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
@@ -1,28 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'omniauth-oauth2'
4
- require 'tanita/api/client'
5
4
 
6
5
  module OmniAuth
7
6
  module Strategies
8
- TANITA = Tanita::Api::Client
9
-
7
+ # OmniAuth strategy for Health Planet
10
8
  class Tanita < OmniAuth::Strategies::OAuth2
11
9
  option :name, 'tanita'
12
10
 
13
11
  option :skip_info, true
14
12
  option :provider_ignores_state, true
13
+ option :scope, 'innerscan'
15
14
 
16
- option :client_options, :site => TANITA::BASE_URL,
17
- :authorize_url => TANITA::AUTH_URL_PATH,
18
- :token_url => TANITA::TOKEN_URL_PATH
15
+ option :client_options, :site => 'https://www.healthplanet.jp',
16
+ :authorize_url => '/oauth/auth'
19
17
 
20
- option :authorize_options, %i[client_id redirect_uri scope response_type]
21
- option :response_type, 'code'
22
- option :scope, TANITA::Scope::INNERSCAN
18
+ private
23
19
 
24
- option :token_options, %i[client_id client_secret redirect_uri grant_type]
25
- option :grant_type, 'authorization_code'
20
+ def callback_url
21
+ full_host + script_name + callback_path
22
+ end
26
23
  end
27
24
  end
28
25
  end
@@ -4,7 +4,7 @@ require_relative 'lib/omniauth-tanita/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'omniauth-tanita'
7
- spec.version = Omniauth::Tanita::VERSION
7
+ spec.version = OmniAuth::Tanita::VERSION
8
8
  spec.authors = ['Kenji Koshikawa']
9
9
  spec.email = ['koshikawa2009@gmail.com']
10
10
 
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
18
  spec.metadata['source_code_uri'] = 'https://github.com/koshilife/omniauth-tanita'
19
19
  spec.metadata['changelog_uri'] = "#{spec.metadata['source_code_uri']}/blob/master/CHANGELOG.md"
20
+ spec.metadata['documentation_uri'] = "https://www.rubydoc.info/gems/omniauth-tanita/#{spec.version}"
20
21
 
21
22
  # Specify which files should be added to the gem when it is released.
22
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -27,10 +28,11 @@ Gem::Specification.new do |spec|
27
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
29
  spec.require_paths = ['lib']
29
30
 
30
- spec.add_runtime_dependency 'tanita-api-client', '~> 0.2.3'
31
- spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6.0'
31
+ spec.add_runtime_dependency 'omniauth-oauth2', '>= 1.6.0'
32
32
 
33
- spec.add_development_dependency 'bundler', '~> 2.0'
34
- spec.add_development_dependency 'rake', '~> 12.0'
35
- spec.add_development_dependency 'rspec', '~> 3.0'
33
+ spec.add_development_dependency 'bundler'
34
+ spec.add_development_dependency 'codecov'
35
+ spec.add_development_dependency 'rake'
36
+ spec.add_development_dependency 'rspec'
37
+ spec.add_development_dependency 'simplecov'
36
38
  end
metadata CHANGED
@@ -1,85 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-tanita
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenji Koshikawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-12 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: tanita-api-client
14
+ name: omniauth-oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.3
19
+ version: 1.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.3
26
+ version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: omniauth-oauth2
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.6.0
34
- type: :runtime
33
+ version: '0'
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.6.0
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: codecov
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '12.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '12.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
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
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: '3.0'
89
+ version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: '3.0'
96
+ version: '0'
83
97
  description: ''
84
98
  email:
85
99
  - koshikawa2009@gmail.com
@@ -87,10 +101,11 @@ executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
104
+ - ".github/workflows/gem-push.yml"
105
+ - ".github/workflows/test.yml"
90
106
  - ".gitignore"
91
107
  - ".rspec"
92
108
  - ".rubocop.yml"
93
- - ".travis.yml"
94
109
  - CHANGELOG.md
95
110
  - CODE_OF_CONDUCT.md
96
111
  - Gemfile
@@ -110,6 +125,7 @@ metadata:
110
125
  homepage_uri: https://github.com/koshilife/omniauth-tanita
111
126
  source_code_uri: https://github.com/koshilife/omniauth-tanita
112
127
  changelog_uri: https://github.com/koshilife/omniauth-tanita/blob/master/CHANGELOG.md
128
+ documentation_uri: https://www.rubydoc.info/gems/omniauth-tanita/0.4.0
113
129
  post_install_message:
114
130
  rdoc_options: []
115
131
  require_paths:
@@ -125,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
141
  - !ruby/object:Gem::Version
126
142
  version: '0'
127
143
  requirements: []
128
- rubygems_version: 3.1.2
144
+ rubygems_version: 3.0.3
129
145
  signing_key:
130
146
  specification_version: 4
131
147
  summary: OmniAuth strategy for Tanita Health Planet
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.3
6
- before_install: gem install bundler -v 2.1.3