Skip to content

Commit 96f451b

Browse files
authored
chore!: modernize gem for v5.0.0 (#45)
* chore!: modernize gem for v5.0.0 Drop Ruby < 3.2, migrate CI from Travis to GitHub Actions, update all dev dependencies to latest versions (RuboCop 1.84, SimpleCov 0.22, WebMock 3.26), modernize gemspec with MFA metadata, move dev deps to Gemfile, add community files (CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, issue/PR templates), rewrite CHANGELOG in Keep a Changelog format, and apply RuboCop auto-fixes from the 0.80 → 1.84 upgrade. BREAKING CHANGE: minimum Ruby version raised from 2.5 to 3.2 * refactor!: replace hash options with kwargs, clean up internals - Switch constructor and request methods to keyword arguments, giving ArgumentError on typos for free and removing UnknownKeyError/Util - Replace fragile const_get lookups with frozen hash tables (HTTP_METHODS, HEADERS_FOR_REQUEST_TYPE) - Inline Util.query_to_hash/hash_to_query as direct URI calls, delete util.rb - Rename private methods: set_* → apply_*, get_response → perform_request - Add write_timeout to connection setup - Fix AJAX_JSON_HEADER to use merge instead of dup.merge! * test: add missing unit tests and integration suite for 100% coverage Cover previously untested code paths: multipart form data, string body, verify_cert: false, PUT with body, and constructor kwargs. Add WEBrick-based integration tests exercising real HTTP/HTTPS requests including redirects, cookies, headers, and basic auth. * docs: fix stale README references Remove nonexistent SOAP methods, fix HTTPWrapper typo, update UnknownKeyError → ArgumentError to match kwargs behavior. * docs: rewrite 5.0.0 changelog for accuracy and user-facing focus
1 parent d0432af commit 96f451b

26 files changed

Lines changed: 889 additions & 387 deletions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug to help improve HTTPWrapper
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Environment
10+
11+
- **http_wrapper version:**
12+
- **Ruby version:**
13+
- **OS:**
14+
15+
## Description
16+
17+
A clear description of the bug.
18+
19+
## Steps to Reproduce
20+
21+
```ruby
22+
require 'http_wrapper'
23+
24+
# Minimal code to reproduce the issue
25+
```
26+
27+
## Expected Behavior
28+
29+
What you expected to happen.
30+
31+
## Actual Behavior
32+
33+
What actually happened. Include any error messages or stack traces.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for HTTPWrapper
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem
10+
11+
A clear description of the problem you're trying to solve.
12+
13+
## Proposed Solution
14+
15+
Describe how you'd like it to work.
16+
17+
## Alternatives Considered
18+
19+
Any alternative solutions or workarounds you've considered.
20+
21+
## Additional Context
22+
23+
Any other context, references, or examples.

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "bundler" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/pull_request_template.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Description
2+
3+
Brief description of what this PR does.
4+
5+
## Type of Change
6+
7+
- [ ] Bug fix
8+
- [ ] New feature
9+
- [ ] Refactoring (no behavior change)
10+
- [ ] Documentation update
11+
- [ ] Other: <!-- describe -->
12+
13+
## Checklist
14+
15+
- [ ] Tests pass (`bundle exec rspec`)
16+
- [ ] RuboCop clean (`bundle exec rubocop`)
17+
- [ ] CHANGELOG.md updated (under `[Unreleased]`)
18+
- [ ] Documentation updated (if public API changed)
19+
- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches: ["master"]
10+
pull_request:
11+
branches: ["master"]
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
name: Ruby ${{ matrix.ruby_version }}
20+
strategy:
21+
matrix:
22+
ruby_version: [ruby-head, '4.0', '3.4', '3.3', '3.2']
23+
24+
env:
25+
COVERAGE: true
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- uses: ruby/setup-ruby@v1
31+
with:
32+
ruby-version: ${{ matrix.ruby_version }}
33+
bundler-cache: true
34+
continue-on-error: ${{ matrix.ruby_version == 'ruby-head' }}
35+
36+
- run: bundle exec rake
37+
continue-on-error: ${{ matrix.ruby_version == 'ruby-head' }}
38+
39+
- name: Upload coverage reports to Codecov
40+
uses: codecov/codecov-action@v5
41+
with:
42+
token: ${{ secrets.CODECOV_TOKEN }}
43+
slug: svyatov/http_wrapper
44+
# Only upload coverage for the latest stable Ruby version
45+
if: ${{ matrix.ruby_version == '3.4' }}

.gitignore

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
*.gem
2-
*.rbc
3-
.bundle
4-
.config
5-
pkg
6-
rdoc
7-
tmp
8-
.idea/
9-
coverage/
10-
Gemfile.lock
1+
/.bundle/
2+
/Gemfile.lock
3+
/.yardoc
4+
/_yardoc/
5+
/coverage/
6+
/doc/
7+
/pkg/
8+
/spec/reports/
9+
/tmp/
10+
11+
# rspec failure tracking
12+
.rspec_status

.rubocop.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
require:
1+
plugins:
22
- 'rubocop-rspec'
33
- 'rubocop-performance'
44

55
AllCops:
6-
TargetRubyVersion: 2.5
6+
TargetRubyVersion: 3.2
7+
NewCops: enable
8+
SuggestExtensions: false
79

810
DisplayCopNames: true
911
DisplayStyleGuide: true
@@ -14,28 +16,25 @@ Layout/LineLength:
1416

1517
Metrics/BlockLength:
1618
Exclude:
17-
- 'spec/http_wrapper_spec.rb'
19+
- 'spec/**/*'
1820

1921
Metrics/MethodLength:
2022
Max: 15
2123

24+
Metrics/ParameterLists:
25+
CountKeywordArgs: false
26+
2227
Style/Documentation:
2328
Enabled: false
2429

2530
Style/NumericPredicate:
2631
Enabled: false
2732

28-
Style/HashEachMethods:
29-
Enabled: true
30-
31-
Style/HashTransformKeys:
32-
Enabled: true
33-
34-
Style/HashTransformValues:
35-
Enabled: true
36-
3733
RSpec/ExampleLength:
3834
Enabled: false
3935

4036
RSpec/MultipleExpectations:
4137
Enabled: false
38+
39+
RSpec/NoExpectationExample:
40+
Enabled: false

.travis.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)