Skip to content

Commit 552cab0

Browse files
committed
Update CI to ruby 3.1 and rails 7.0. Drop rails 5 and ruby 2.5.
1 parent 1ed0b9a commit 552cab0

File tree

8 files changed

+32
-58
lines changed

8 files changed

+32
-58
lines changed

.github/workflows/main.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
ruby-version:
12-
- 2.5
1312
- 2.6
1413
- 2.7
1514
- 3.0
15+
- 3.1
1616
gemfile:
17-
- rails_52.gemfile
1817
- rails_60.gemfile
1918
- rails_61.gemfile
19+
- rails_70.gemfile
2020
exclude:
21-
- ruby-version: [ 2.6, 2.7, 3.0 ]
22-
gemfile: rails_52.gemfile
2321
- ruby-version: 3.0
2422
gemfile: rails_60.gemfile
23+
- ruby-version: 3.1
24+
gemfile: rails_60.gemfile
25+
- ruby-version: 2.6
26+
gemfile: rails_70.gemfile
27+
- ruby-version: 2.7
28+
gemfile: rails_70.gemfile
2529
steps:
2630
- name: Install packages required for `curb` gem
2731
run: |
@@ -57,7 +61,7 @@ jobs:
5761
- name: Install Ruby
5862
uses: ruby/setup-ruby@v1
5963
with:
60-
ruby-version: 3.0
64+
ruby-version: 3.1
6165
bundler-cache: true
6266

6367
- name: Install required gems

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ inherit_from: .rubocop_todo.yml
22

33
AllCops:
44
NewCops: enable
5-
TargetRubyVersion: 2.5
5+
TargetRubyVersion: 2.6
66

77
Metrics/AbcSize:
88
Max: 28

.rubocop_todo.yml

+1-27
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2021-03-26 22:04:17 UTC using RuboCop version 1.12.0.
3+
# on 2022-03-17 08:35:06 UTC using RuboCop version 1.26.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 1
10-
# Cop supports --auto-correct.
11-
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12-
# Include: **/*.gemspec
13-
Gemspec/OrderedDependencies:
14-
Exclude:
15-
- 'api_auth.gemspec'
16-
179
# Offense count: 1
1810
# Configuration parameters: AllowSafeAssignment.
1911
Lint/AssignmentInCondition:
@@ -41,17 +33,6 @@ Lint/Void:
4133
- 'lib/api_auth/request_drivers/rack.rb'
4234
- 'lib/api_auth/request_drivers/rest_client.rb'
4335

44-
# Offense count: 1
45-
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
46-
Metrics/AbcSize:
47-
Max: 28
48-
49-
# Offense count: 1
50-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
51-
# IgnoredMethods: refine
52-
Metrics/BlockLength:
53-
Max: 27
54-
5536
# Offense count: 2
5637
# Configuration parameters: IgnoredMethods.
5738
Metrics/CyclomaticComplexity:
@@ -79,13 +60,6 @@ Naming/MethodParameterName:
7960
- 'lib/api_auth/base.rb'
8061
- 'spec/railtie_spec.rb'
8162

82-
# Offense count: 9
83-
# Cop supports --auto-correct.
84-
Style/CommentedKeyword:
85-
Exclude:
86-
- 'lib/api_auth/base.rb'
87-
- 'lib/api_auth/railtie.rb'
88-
8963
# Offense count: 3
9064
# Configuration parameters: AllowedConstants.
9165
Style/Documentation:

README.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Logins and passwords are for humans. Communication between applications need to
77
be protected through different means.
88

99
ApiAuth is a Ruby gem designed to be used both in your client and server
10-
HTTP-based applications. It implements the same authentication methods (HMAC-SHA1)
10+
HTTP-based applications. It implements the same authentication methods (HMAC-SHA2)
1111
used by Amazon Web Services.
1212

1313
The gem will sign your requests on the client side and authenticate that
@@ -51,7 +51,7 @@ A cURL request would look like:
5151
curl -X POST --header 'Content-Type: application/json' --header "Date: Tue, 30 May 2017 03:51:43 GMT" --header "Authorization: ${AUTHORIZATION}" http://my-app.com/request_path`
5252
```
5353

54-
5. On the server side, the SHA1 HMAC is computed in the same way using the
54+
5. On the server side, the SHA2 HMAC is computed in the same way using the
5555
request headers and the client's secret key, which is known to only
5656
the client and the server but can be looked up on the server using the client's
5757
access id that was attached in the header. The access id can be any integer or
@@ -61,17 +61,13 @@ minutes in order to avoid replay attacks.
6161
## References
6262

6363
* [Hash functions](http://en.wikipedia.org/wiki/Cryptographic_hash_function)
64-
* [SHA-1 Hash function](http://en.wikipedia.org/wiki/SHA-1)
64+
* [SHA-2 Hash function](http://en.wikipedia.org/wiki/SHA-2)
6565
* [HMAC algorithm](http://en.wikipedia.org/wiki/HMAC)
6666
* [RFC 2104 (HMAC)](http://tools.ietf.org/html/rfc2104)
6767

6868
## Requirement
6969

70-
This gem require Ruby >= 2.5 and Rails >= 5.1 if you use rails.
71-
72-
For older version of Ruby or Rails, please use ApiAuth v2.1 and older.
73-
74-
**IMPORTANT: v2.0.0 is backwards incompatible with the default settings of v1.x to address a security vulnerability. See [CHANGELOG.md](/CHANGELOG.md) for security update information.**
70+
This gem require Ruby >= 2.6 and Rails >= 6.0 if you use rails.
7571

7672
## Install
7773

api_auth.gemspec

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ Gem::Specification.new do |s|
1414
'rubygems_mfa_required' => 'true'
1515
}
1616

17-
s.required_ruby_version = '>= 2.5.0'
17+
s.required_ruby_version = '>= 2.6.0'
1818

19-
s.add_development_dependency 'actionpack', '< 6.2', '> 5.0'
19+
s.add_development_dependency 'actionpack', '>= 6.0'
2020
s.add_development_dependency 'activeresource', '>= 4.0'
21-
s.add_development_dependency 'activesupport', '< 6.2', '> 5.0'
21+
s.add_development_dependency 'activesupport', '>= 6.0'
2222
s.add_development_dependency 'amatch'
2323
s.add_development_dependency 'appraisal'
2424
s.add_development_dependency 'curb', '~> 0.8'
2525
s.add_development_dependency 'faraday', '>= 1.1.0'
26+
s.add_development_dependency 'grape', '~> 1.1.0'
2627
s.add_development_dependency 'http'
2728
s.add_development_dependency 'httpi'
2829
s.add_development_dependency 'multipart-post', '~> 2.0'
2930
s.add_development_dependency 'pry'
3031
s.add_development_dependency 'rake'
3132
s.add_development_dependency 'rest-client', '~> 2.0'
32-
s.add_development_dependency 'grape', '~> 1.1.0'
33-
s.add_development_dependency 'rspec', '~> 3.4'
3433
s.add_development_dependency 'rexml'
34+
s.add_development_dependency 'rspec', '~> 3.4'
3535
s.add_development_dependency 'rubocop'
3636

3737
s.files = `git ls-files`.split("\n")

gemfiles/rails_52.gemfile gemfiles/rails_70.gemfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
source "https://rubygems.org"
44

5-
gem "actionpack", "~> 5.2"
6-
gem "activeresource", "~> 5.1"
7-
gem "activesupport", "~> 5.2"
5+
gem "actionpack", "~> 7.0"
6+
gem "activeresource", "~> 6.0"
7+
gem "activesupport", "~> 7.0"
88

99
gemspec path: "../"

lib/api_auth/base.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,5 @@ def auth_header(headers, access_id, secret_key, options)
118118
def parse_auth_header(auth_header)
119119
AUTH_HEADER_PATTERN.match(auth_header)
120120
end
121-
end # class methods
122-
end # ApiAuth
121+
end
122+
end

lib/api_auth/railtie.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def api_authenticated?(secret_key)
1818
ActionController::Base.include(ControllerMethods::InstanceMethods)
1919
end
2020
end
21-
end # ControllerMethods
21+
end
2222

2323
module ActiveResourceExtension # :nodoc:
2424
module ActiveResourceApiAuth # :nodoc:
@@ -51,11 +51,11 @@ def connection_with_auth(refresh = false)
5151
c.api_auth_options = api_auth_options
5252
c
5353
end
54-
end # class methods
54+
end
5555

5656
module InstanceMethods
5757
end
58-
end # BaseApiAuth
58+
end
5959

6060
module Connection
6161
def self.included(base)
@@ -82,14 +82,14 @@ def request_with_auth(method, path, *arguments)
8282

8383
request_without_auth(method, path, *arguments)
8484
end
85-
end # Connection
85+
end
8686

8787
if defined?(ActiveSupport)
8888
ActiveSupport.on_load(:active_resource) do
8989
ActiveResource::Base.include(ActiveResourceApiAuth)
9090
ActiveResource::Connection.include(Connection)
9191
end
9292
end
93-
end # ActiveResourceExtension
94-
end # Rails
95-
end # ApiAuth
93+
end
94+
end
95+
end

0 commit comments

Comments
 (0)