twitch_oauth2 0.1.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: 774bd262b409e02731b8d17031f22130f886a821b8042e8eb948e8e6b7137114
4
- data.tar.gz: 32afb0a9c9406acc3225d468e9d23245470eaaa40ae94c6d0795d7137bf3a8bf
3
+ metadata.gz: db75a943539bebe359931ac1b78fd29b6d55add3922c1dd56c3ff457c190ebbd
4
+ data.tar.gz: d171153225fac0312176a923848b6c9f3be048946e23fbec72f5b7413801665d
5
5
  SHA512:
6
- metadata.gz: 6b0220445931a12f5cb271b178ead318674d4a9c9e113758dc8784853e16a3305d1623c6595cf3783d40a84293fe28e60abd537c5f7e33148d4ac70c314d5972
7
- data.tar.gz: 28dc850d48767600756bcba6ff1a609f062ff971dd05e39a257a34c8c59892b7069191e7b74ae932de751c6e752297b6de57561e0f8077c7fbfd443a1f725a7b
6
+ metadata.gz: 0d191956b126deec94d160e85af9d147ac1e920db8b5031d68602c6459bb2c172a8025b5205be596d32fb8b1f2040c29f401afb533853ac2f2e813899b36d276
7
+ data.tar.gz: 75625c8ef174b8115ae4b6fdac56d3fd6e9ab6239854b92619f3e04c978a3ef252bf5255a87ae3685a389f203365739d705a9d588f47f3cb4597c09685b00d38
data/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.4.0 (2022-07-23)
6
+
7
+ * Support Ruby 3.
8
+ * Drop Ruby 2.5 support.
9
+ * Update Faraday to version 2.
10
+ * Resolve new RuboCop offenses.
11
+ * Update development dependencies.
12
+
13
+ ## 0.3.0 (2020-12-05)
14
+
15
+ * Raise an error for `:user` token type with a login link inside
16
+ See [this discussion](https://github.com/mauricew/ruby-twitch-api/pull/22#discussion_r526518859).
17
+ * Update (development) dependencies.
18
+
19
+ ## 0.2.0 (2020-11-05)
20
+
21
+ * Add an ability to generate Application tokens.
22
+ Useful for the actual, Helix, Twitch API.
23
+ * Update dependencies.
24
+
25
+ ## 0.1.0 (2020-05-23)
26
+
27
+ * Initial release
data/README.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # TwitchOAuth2
2
2
 
3
+ [![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/AlexWayfer/twitch_oauth2?style=flat-square)](https://cirrus-ci.com/github/AlexWayfer/twitch_oauth2)
4
+ [![Codecov branch](https://img.shields.io/codecov/c/github/AlexWayfer/twitch_oauth2/main.svg?style=flat-square)](https://codecov.io/gh/AlexWayfer/twitch_oauth2)
5
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/AlexWayfer/twitch_oauth2.svg?style=flat-square)](https://codeclimate.com/github/AlexWayfer/twitch_oauth2)
6
+ [![Depfu](https://img.shields.io/depfu/AlexWayfer/twitch_oauth2?style=flat-square)](https://depfu.com/repos/github/AlexWayfer/twitch_oauth2)
7
+ [![Inline docs](https://inch-ci.org/github/AlexWayfer/twitch_oauth2.svg?branch=main)](https://inch-ci.org/github/AlexWayfer/twitch_oauth2)
8
+ [![license](https://img.shields.io/github/license/AlexWayfer/twitch_oauth2.svg?style=flat-square)](https://github.com/AlexWayfer/twitch_oauth2/blob/main/LICENSE.txt)
9
+ [![Gem](https://img.shields.io/gem/v/twitch_oauth2.svg?style=flat-square)](https://rubygems.org/gems/twitch_oauth2)
10
+
3
11
  Twitch authentication with OAuth 2.
4
12
  Result tokens can be used for API libraries, chat libraries or something else.
5
13
 
6
- [Twitch Authentication Documentation]
14
+ [Twitch Authentication Documentation](https://dev.twitch.tv/docs/authentication)
7
15
 
8
16
  ## Installation
9
17
 
@@ -47,14 +55,32 @@ tokens = previously_saved_tokens
47
55
  # => { access_token: 'abcdef', refresh_token: 'ghikjl' }
48
56
  # Can be empty.
49
57
 
50
- client.check_tokens **tokens
58
+ client.check_tokens **tokens, token_type: :user
51
59
  ```
52
60
 
61
+ `:token_type` is optional and is `:application` by default,
62
+ but a number of available API end-points is limited in this case.
63
+
64
+ Also, Application Access Token has no `refresh_token`, but this gem just receive a new one
65
+ if a given one is invalid.
66
+
53
67
  #### The first run
54
68
 
55
69
  You can pass nothing to `#check_tokens`, then client will generate new ones.
56
- You will be asked to open a Twitch link in a browser and login as user
57
- for whom tokens are intended.
70
+
71
+ If you've specified `:token_type` as `:application` or have not specify it at all (default),
72
+ there will be an Application Access Token (without refresh token).
73
+
74
+ Otherwise, for User Access Token here will be raised a `TwitchOAuth2::Error` with Twitch link
75
+ inside `#metadata[:link]`.
76
+
77
+ If you have a web-application with N users, you can redirect them to this link
78
+ and use `redirect_uri` to your application for callbacks.
79
+
80
+ Otherwise, if you have something like CLI tool, you can print instructions with a link for user.
81
+
82
+ Then you can use `#token(token_type: :user, code: 'a code from params in redirect uri')`
83
+ and get your `:access_token` and `:refresh_token`.
58
84
 
59
85
  #### Reusing tokens
60
86
 
@@ -72,22 +98,18 @@ client.refreshed_tokens refresh_token: 'ghikjl'
72
98
  This is used internally in `#check_tokens`, and can be used separately
73
99
  for failed requests to API.
74
100
 
101
+ And, because Application Access Tokens have no refresh tokens — this method will not work for them.
102
+
75
103
  ## Development
76
104
 
77
105
  After checking out the repo, run `bundle install` to install dependencies.
78
- Then, run `bundle exec rake spec` to run the tests.
79
106
 
80
- We're using [VCR](https://relishapp.com/vcr/vcr/docs) cassettes
81
- with filtered sensitive data, so you don't need for real credentials
82
- (like Twitch Client ID and Client Secret) for changing existing methods,
83
- but you need for them to add new requests.
84
- You can read how to get them [here][Twitch Authentication Documentation].
107
+ Then, run `toys rspec` to run the tests.
85
108
 
86
- To install this gem onto your local machine, run `bundle exec rake install`.
87
- To release a new version, update the version number in `version.rb`,
88
- and then run `bundle exec rake release`, which will create a git tag
89
- for the version, push git commits and tags, and push the `.gem` file
90
- to [rubygems.org](https://rubygems.org).
109
+ To install this gem onto your local machine, run `toys gem install`.
110
+
111
+ To release a new version, run `toys gem release %version%`.
112
+ See how it works [here](https://github.com/AlexWayfer/gem_toys#release).
91
113
 
92
114
  ## Contributing
93
115
 
@@ -97,5 +119,3 @@ Bug reports and pull requests are welcome on [GitHub](https://github.com/AlexWay
97
119
 
98
120
  The gem is available as open source under the terms of the
99
121
  [MIT License](https://opensource.org/licenses/MIT).
100
-
101
- [Twitch Authentication Documentation]: https://dev.twitch.tv/docs/authentication
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'faraday'
4
- require 'faraday_middleware'
4
+ require 'faraday/parse_dates'
5
5
  require 'securerandom'
6
6
 
7
7
  module TwitchOAuth2
@@ -12,7 +12,7 @@ module TwitchOAuth2
12
12
  ) do |connection|
13
13
  connection.request :json
14
14
 
15
- connection.response :dates
15
+ connection.response :parse_dates
16
16
 
17
17
  connection.response :json,
18
18
  content_type: /\bjson$/,
@@ -26,46 +26,49 @@ module TwitchOAuth2
26
26
  @client_secret = client_secret
27
27
  @redirect_uri = redirect_uri
28
28
  @scopes = scopes
29
-
30
- @state = SecureRandom.alphanumeric(32)
31
29
  end
32
30
 
33
- def check_tokens(access_token: nil, refresh_token: nil)
31
+ def check_tokens(access_token: nil, refresh_token: nil, token_type: :user)
34
32
  if access_token
35
33
  validate_result = validate access_token: access_token
36
34
 
37
35
  if validate_result[:status] == 401
38
- return refreshed_tokens(refresh_token: refresh_token)
39
- end
40
-
41
- if validate_result[:expires_in].positive?
36
+ return refreshed_tokens(refresh_token: refresh_token) if token_type == :user
37
+ elsif validate_result[:expires_in].positive?
42
38
  return { access_token: access_token, refresh_token: refresh_token }
43
39
  end
44
40
  end
45
41
 
46
- flow
42
+ flow token_type: token_type
47
43
  end
48
44
 
49
45
  def refreshed_tokens(refresh_token:)
50
46
  refresh(refresh_token: refresh_token).slice(:access_token, :refresh_token)
51
47
  end
52
48
 
53
- private
49
+ def token(token_type:, code: nil)
50
+ response = CONNECTION.post(
51
+ 'token',
52
+ client_id: @client_id,
53
+ client_secret: @client_secret,
54
+ code: code,
55
+ grant_type: grant_type_by_token_type(token_type),
56
+ redirect_uri: @redirect_uri
57
+ )
54
58
 
55
- def flow
56
- link = authorize
59
+ return response.body if response.success?
57
60
 
58
- puts <<~TEXT
59
- 1. Open URL in your browser:
60
- #{link}
61
- 2. Login to Twitch.
62
- 3. Copy the `code` parameter from redirected URL.
63
- 4. Insert below:
64
- TEXT
61
+ raise Error, response.body[:message]
62
+ end
65
63
 
66
- code = STDIN.gets.chomp
64
+ private
65
+
66
+ def flow(token_type:)
67
+ if token_type == :user
68
+ raise Error.new('Use `error.metadata[:link]` for getting new tokens', link: authorize)
69
+ end
67
70
 
68
- token(code: code).slice(:access_token, :refresh_token)
71
+ token(token_type: token_type).slice(:access_token, :refresh_token)
69
72
  end
70
73
 
71
74
  def authorize
@@ -83,17 +86,12 @@ module TwitchOAuth2
83
86
  raise Error, response.body[:message]
84
87
  end
85
88
 
86
- def token(code:)
87
- response = CONNECTION.post(
88
- 'token',
89
- client_id: @client_id,
90
- client_secret: @client_secret,
91
- code: code,
92
- grant_type: :authorization_code,
93
- redirect_uri: @redirect_uri
94
- )
95
-
96
- response.body
89
+ def grant_type_by_token_type(token_type)
90
+ case token_type
91
+ when :user then :authorization_code
92
+ when :application then :client_credentials
93
+ else raise Error, 'unsupported token type'
94
+ end
97
95
  end
98
96
 
99
97
  def validate(access_token:)
@@ -1,6 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TwitchOAuth2
4
+ ## Error during Twitch OAuth2 operations
4
5
  class Error < StandardError
6
+ attr_reader :metadata
7
+
8
+ def initialize(message, metadata = {})
9
+ super message
10
+
11
+ @metadata = metadata
12
+ end
5
13
  end
6
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TwitchOAuth2
4
- VERSION = '0.1.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitch_oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Popov
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-23 00:00:00.000000000 Z
11
+ date: 2022-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,84 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.3'
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: '1.0'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
28
+ name: faraday-parse_dates
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: 0.1.0
34
34
  type: :runtime
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.0'
40
+ version: 0.1.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: codecov
42
+ name: pry-byebug
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.0
47
+ version: '3.9'
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: 0.1.0
54
+ version: '3.9'
55
55
  - !ruby/object:Gem::Dependency
56
- name: mdl
56
+ name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.0
61
+ version: '2.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: 0.9.0
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: pry-byebug
70
+ name: gem_toys
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.9'
75
+ version: 0.12.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.9'
82
+ version: 0.12.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: toys
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.13.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.13.0
83
97
  - !ruby/object:Gem::Dependency
84
- name: rake
98
+ name: codecov
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '13.0'
103
+ version: 0.6.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '13.0'
110
+ version: 0.6.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rspec
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -109,75 +123,75 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '3.9'
111
125
  - !ruby/object:Gem::Dependency
112
- name: rubocop
126
+ name: simplecov
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: 0.83.0
131
+ version: 0.21.2
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: 0.83.0
138
+ version: 0.21.2
125
139
  - !ruby/object:Gem::Dependency
126
- name: rubocop-performance
140
+ name: vcr
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '1.0'
145
+ version: '6.0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '1.0'
152
+ version: '6.0'
139
153
  - !ruby/object:Gem::Dependency
140
- name: rubocop-rspec
154
+ name: rubocop
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '1.0'
159
+ version: 1.32.0
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '1.0'
166
+ version: 1.32.0
153
167
  - !ruby/object:Gem::Dependency
154
- name: simplecov
168
+ name: rubocop-performance
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: 0.18.0
173
+ version: '1.0'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: 0.18.0
180
+ version: '1.0'
167
181
  - !ruby/object:Gem::Dependency
168
- name: vcr
182
+ name: rubocop-rspec
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: '5.1'
187
+ version: '2.0'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: '5.1'
194
+ version: '2.0'
181
195
  description: |
182
196
  Twitch authentication with OAuth 2.
183
197
  Result tokens can be used for API libraries, chat libraries
@@ -188,27 +202,22 @@ executables: []
188
202
  extensions: []
189
203
  extra_rdoc_files: []
190
204
  files:
191
- - ".cirrus.yml"
192
- - ".editorconfig"
193
- - ".gitignore"
194
- - ".rspec"
195
- - ".rubocop.yml"
196
- - Gemfile
205
+ - CHANGELOG.md
197
206
  - LICENSE.txt
198
207
  - README.md
199
- - Rakefile
200
208
  - lib/twitch_oauth2.rb
201
209
  - lib/twitch_oauth2/client.rb
202
210
  - lib/twitch_oauth2/error.rb
203
211
  - lib/twitch_oauth2/version.rb
204
- - twitch_oauth2.gemspec
205
212
  homepage: https://github.com/AlexWayfer/twitch_oauth2
206
213
  licenses:
207
214
  - MIT
208
215
  metadata:
209
216
  source_code_uri: https://github.com/AlexWayfer/twitch_oauth2
210
217
  homepage_uri: https://github.com/AlexWayfer/twitch_oauth2
211
- post_install_message:
218
+ changelog_uri: https://github.com/AlexWayfer/twitch_oauth2/blob/main/CHANGELOG.md
219
+ rubygems_mfa_required: 'true'
220
+ post_install_message:
212
221
  rdoc_options: []
213
222
  require_paths:
214
223
  - lib
@@ -216,15 +225,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
225
  requirements:
217
226
  - - ">="
218
227
  - !ruby/object:Gem::Version
219
- version: '2.5'
228
+ version: '2.6'
229
+ - - "<"
230
+ - !ruby/object:Gem::Version
231
+ version: '4'
220
232
  required_rubygems_version: !ruby/object:Gem::Requirement
221
233
  requirements:
222
234
  - - ">="
223
235
  - !ruby/object:Gem::Version
224
236
  version: '0'
225
237
  requirements: []
226
- rubygems_version: 3.1.2
227
- signing_key:
238
+ rubygems_version: 3.3.7
239
+ signing_key:
228
240
  specification_version: 4
229
241
  summary: Twitch authentication with OAuth 2.
230
242
  test_files: []
data/.cirrus.yml DELETED
@@ -1,32 +0,0 @@
1
- bundle_cache: &bundle_cache
2
- bundle_cache:
3
- folder: /usr/local/bundle
4
- fingerprint_script:
5
- - echo $CIRRUS_OS
6
- - ruby -v
7
- - cat Gemfile
8
- - cat *.gemspec
9
- install_script: bundle update
10
-
11
- test_task:
12
- container:
13
- matrix:
14
- image: ruby:2.5
15
- image: ruby:2.6
16
- image: ruby:2.7
17
- <<: *bundle_cache
18
- environment:
19
- CODECOV_TOKEN: ENCRYPTED[b26ecd3e49540f09f5c9bf830caa29f5daedaf6769d6b1ba1a650eb6e81432ffb857f19421aed8e8dfddf21724fb57b6]
20
- test_script: bundle exec rake
21
-
22
- rubocop_task:
23
- container:
24
- image: ruby:latest
25
- <<: *bundle_cache
26
- rubocop_script: bundle exec rubocop
27
-
28
- markdown_lint_task:
29
- container:
30
- image: ruby:latest
31
- <<: *bundle_cache
32
- rubocop_script: bundle exec mdl .
data/.editorconfig DELETED
@@ -1,17 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = tab
5
- indent_size = 2
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
11
- [*.y{a,}ml]
12
- indent_style = space
13
- indent_size = 2
14
-
15
- [*.md]
16
- indent_style = space
17
- indent_size = 4
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- Gemfile.lock
2
- /coverage/
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,47 +0,0 @@
1
- require:
2
- - rubocop-performance
3
- - rubocop-rspec
4
-
5
- Layout/IndentationStyle:
6
- EnforcedStyle: tabs
7
- IndentationWidth: 2
8
- Layout/IndentationWidth:
9
- Width: 1
10
- Layout/MultilineMethodCallIndentation:
11
- EnforcedStyle: indented
12
- Layout/ArgumentAlignment:
13
- EnforcedStyle: with_fixed_indentation
14
- Layout/SpaceAroundMethodCallOperator:
15
- Enabled: true
16
- Layout/EmptyLinesAroundAttributeAccessor:
17
- Enabled: true
18
-
19
- Lint/StructNewOverride:
20
- Enabled: true
21
- Lint/RaiseException:
22
- Enabled: true
23
-
24
- Style/HashEachMethods:
25
- Enabled: true
26
- Style/HashTransformKeys:
27
- Enabled: true
28
- Style/HashTransformValues:
29
- Enabled: true
30
- Style/ExponentialNotation:
31
- Enabled: true
32
- Style/SlicingWithRange:
33
- Enabled: true
34
-
35
- Metrics/BlockLength:
36
- Exclude:
37
- - '*.gemspec'
38
- - spec/**/*.rb
39
-
40
- AllCops:
41
- TargetRubyVersion: 2.5
42
-
43
- RSpec/FilePath:
44
- CustomTransform:
45
- TwitchOAuth2: twitch_oauth2
46
- RSpec/NestedGroups:
47
- Max: 4
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in twitch_oauth2.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/twitch_oauth2/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'twitch_oauth2'
7
- spec.version = TwitchOAuth2::VERSION
8
- spec.authors = ['Alexander Popov']
9
- spec.email = ['alex.wayfer@gmail.com']
10
-
11
- spec.summary = 'Twitch authentication with OAuth 2.'
12
- spec.description = <<~DESC
13
- Twitch authentication with OAuth 2.
14
- Result tokens can be used for API libraries, chat libraries
15
- or something else.
16
- DESC
17
- spec.license = 'MIT'
18
-
19
- spec.required_ruby_version = '>= 2.5'
20
-
21
- source_code_uri = 'https://github.com/AlexWayfer/twitch_oauth2'
22
-
23
- spec.homepage = source_code_uri
24
-
25
- spec.metadata['source_code_uri'] = source_code_uri
26
-
27
- spec.metadata['homepage_uri'] = spec.homepage
28
-
29
- # TODO: Put your gem's CHANGELOG.md URL here.
30
- # spec.metadata["changelog_uri"] = ""
31
-
32
- # Specify which files should be added to the gem when it is released.
33
- # The `git ls-files -z` loads the files in the RubyGem that have been added
34
- # into git.
35
- spec.files = Dir.chdir(__dir__) do
36
- `git ls-files -z`.split("\x0").reject do |file|
37
- file.match(%r{^(test|spec|features)/})
38
- end
39
- end
40
- spec.bindir = 'exe'
41
- spec.executables = spec.files.grep(%r{^exe/}) { |file| File.basename(file) }
42
- spec.require_paths = ['lib']
43
-
44
- spec.add_dependency 'faraday', '~> 1.0'
45
- spec.add_dependency 'faraday_middleware', '~> 1.0'
46
-
47
- spec.add_development_dependency 'codecov', '~> 0.1.0'
48
- spec.add_development_dependency 'mdl', '~> 0.9.0'
49
- spec.add_development_dependency 'pry-byebug', '~> 3.9'
50
- spec.add_development_dependency 'rake', '~> 13.0'
51
- spec.add_development_dependency 'rspec', '~> 3.9'
52
- spec.add_development_dependency 'rubocop', '~> 0.83.0'
53
- spec.add_development_dependency 'rubocop-performance', '~> 1.0'
54
- spec.add_development_dependency 'rubocop-rspec', '~> 1.0'
55
- spec.add_development_dependency 'simplecov', '~> 0.18.0'
56
- spec.add_development_dependency 'vcr', '~> 5.1'
57
- end