Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]
# Lets the release workflow gate publishing on this same matrix.
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ["3.2", "3.3", "3.4"]

name: Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v5

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run the test suite
run: bundle exec rake spec

- name: Build the gem
run: bundle exec rake build
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release

# Cut a release by bumping lib/omniauth-shipbob/version.rb, committing, then:
# git tag -a v0.1.0 -m "v0.1.0" && git push origin master --tags
on:
push:
tags: ["v*"]

jobs:
# Never publish a version that has not passed the matrix.
test:
uses: ./.github/workflows/ci.yml

push:
name: Push gem to RubyGems.org
needs: test
runs-on: ubuntu-latest

# Publishing uses RubyGems trusted publishing (OIDC), so there is no API key
# secret to rotate and it works with the gemspec's `rubygems_mfa_required`.
#
# One-time setup on rubygems.org: open the gem -> "Trusted publishers" ->
# "Create", with owner `dropstream`, repository `omniauth-shipbob`,
# workflow `release.yml`, and environment `release`.
environment: release

permissions:
id-token: write # mandatory for trusted publishing
contents: write # `rake release` pushes the tag; `gh` creates the release

steps:
- uses: actions/checkout@v5
with:
# rubygems/release-gem installs its own short-lived git credentials.
persist-credentials: false

- uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true

# `rake release` builds whatever version.rb says, regardless of the tag. If the
# two disagree it would publish one version and tag another, so stop here first.
- name: Verify the tag matches the gem version
run: |
gem_version="$(ruby -r./lib/omniauth-shipbob/version -e 'print Omniauth::Shipbob::VERSION')"
tag_version="${GITHUB_REF_NAME#v}"
if [ "$gem_version" != "$tag_version" ]; then
echo "::error::Tag ${GITHUB_REF_NAME} does not match lib/omniauth-shipbob/version.rb (${gem_version})."
exit 1
fi
echo "Releasing omniauth-shipbob ${gem_version}"

# Builds the gem and runs `gem push` against the gemspec's allowed_push_host.
# The tag already exists, so bundler skips its own tag-and-push step.
- name: Push to RubyGems.org
uses: rubygems/release-gem@v1

- name: Create the GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
notes="$(awk -v v="${GITHUB_REF_NAME#v}" '
$0 ~ "^## \\[" v "\\]" { flag = 1; next }
flag && /^## \[/ { exit }
flag { print }
' CHANGELOG.md)"

if [ -n "$(printf '%s' "$notes" | tr -d '[:space:]')" ]; then
printf '%s\n' "$notes" > release-notes.md
gh release create "$GITHUB_REF_NAME" --verify-tag \
--title "$GITHUB_REF_NAME" --notes-file release-notes.md
else
echo "No CHANGELOG.md section for ${GITHUB_REF_NAME}; generating notes from commits."
gh release create "$GITHUB_REF_NAME" --verify-tag \
--title "$GITHUB_REF_NAME" --generate-notes
fi
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.4
3.4.8
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Changelog

All notable changes to this project are documented in this file.

## [0.1.0] - 2026-08-19

### Changed

- **Breaking:** requires `omniauth ~> 2.0` and `omniauth-oauth2 ~> 1.9` (previously
unpinned, which resolved to `omniauth 1.9` / `oauth2 1.4`). Host applications must
upgrade to OmniAuth 2.x; Rails apps also need
[`omniauth-rails_csrf_protection`](https://github.com/cookpad/omniauth-rails_csrf_protection)
because OmniAuth 2 only accepts `POST` for the request phase.
- Pinned the token endpoint to `auth_scheme: :request_body`. `oauth2 2.0` changed its
default to `:basic_auth`, which would have moved `client_id`/`client_secret` out of
the token request body and changed what ShipBob receives.
- Requires Ruby >= 3.2 (the modern `oauth2` dependency chain requires it).
- Development toolchain: Bundler 4.x, `rake ~> 13.0`, `rspec ~> 3.13`.
- Replaced Travis CI with GitHub Actions, testing Ruby 3.2 through 3.4.
- Releases are now cut by pushing a `v*` tag: the `Release` workflow reruns the matrix,
checks the tag against `version.rb`, publishes to RubyGems.org via trusted publishing
(OIDC, no stored API key), and opens a GitHub release from this changelog.

### Added

- `LICENSE.txt` (MIT), now declared in the gemspec.
- `channel_url`, which builds the channel endpoint from `api_url` and tolerates a
trailing slash on the configured value.
- Integration specs covering the request phase, the token exchange, the `redirect_uri`
override and the auth hash (including `channel_id`), against both the production and
sandbox hosts.

### Fixed

- Channel lookup failures are now logged instead of being silently discarded.
- `bin/console` required a non-existent `omniauth/fdc` file.
- Development scripts in `bin/` are no longer packaged as gem executables.

## [0.0.3]

- `api_url` is now a strategy option, defaulting to `https://api.shipbob.com/1.0`, so
the channel lookup can point at ShipBob's sandbox (#10).
- `callback_url` is overridden so query params from a configured `redirect_uri` are not
sent to ShipBob (#7).

## [0.0.2]

- Initial published strategy.
11 changes: 10 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# frozen_string_literal: true

source "https://rubygems.org"

# Specify your gem's dependencies in omniauth-fdc.gemspec
# Specify your gem's dependencies in omniauth-shipbob.gemspec
gemspec

group :development, :test do
gem "rack-test", "~> 2.2"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.13"
gem "webmock", "~> 3.25"
end
158 changes: 121 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,56 +1,140 @@
PATH
remote: .
specs:
omniauth-shipbob (0.0.1)
omniauth-oauth2
omniauth-shipbob (0.1.0)
omniauth (~> 2.0)
omniauth-oauth2 (~> 1.9)

GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.3)
faraday (1.0.1)
multipart-post (>= 1.2, < 3)
hashie (4.1.0)
jwt (2.2.1)
multi_json (1.14.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
oauth2 (1.4.4)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
anonymous_loader (0.1.3)
version_gem (~> 1.1, >= 1.1.14)
auth-sanitizer (0.2.3)
version_gem (~> 1.1, >= 1.1.14)
base64 (0.3.0)
bigdecimal (4.1.2)
crack (1.0.1)
bigdecimal
rexml
diff-lcs (1.6.2)
faraday (2.14.3)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.4.4)
net-http (~> 0.5)
hashdiff (1.2.1)
hashie (5.1.0)
logger
json (2.21.2)
jwt (3.2.0)
base64
logger (1.7.0)
multi_xml (0.9.1)
bigdecimal (>= 3.1, < 5)
net-http (0.9.1)
uri (>= 0.11.1)
oauth2 (2.0.25)
anonymous_loader (~> 0.1, >= 0.1.3)
auth-sanitizer (~> 0.2, >= 0.2.3)
faraday (>= 0.17.3, < 4.0)
jwt (>= 1.0, < 4.0)
logger (~> 1.2)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.9.1)
rack (>= 1.2, < 4)
snaky_hash (~> 2.0, >= 2.0.7)
version_gem (~> 1.1, >= 1.1.14)
omniauth (2.1.4)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
omniauth-oauth2 (1.6.0)
oauth2 (~> 1.1)
omniauth (~> 1.9)
rack (2.2.2)
rake (10.5.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.0)
rspec-support (~> 3.9.0)
rspec-expectations (3.9.0)
logger
rack (>= 2.2.3)
rack-protection
omniauth-oauth2 (1.9.0)
oauth2 (>= 2.0.2, < 3)
omniauth (~> 2.0)
public_suffix (7.0.5)
rack (3.2.7)
rack-protection (4.2.1)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-test (2.2.0)
rack (>= 1.3)
rake (13.4.2)
rexml (3.4.4)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.8)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.7)
snaky_hash (2.0.7)
hashie (>= 0.1.0, < 6)
version_gem (~> 1.1, >= 1.1.14)
uri (1.1.1)
version_gem (1.1.15)
webmock (3.26.2)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.16)
omniauth-shipbob!
rake (~> 10.0)
rspec (~> 3.0)
rack-test (~> 2.2)
rake (~> 13.0)
rspec (~> 3.13)
webmock (~> 3.25)

CHECKSUMS
addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af
anonymous_loader (0.1.3) sha256=084a18e2439144d955447dc11dfc982f41fcd1583ad32d4d55151325dc44cb55
auth-sanitizer (0.2.3) sha256=db10aac92cfbe4c64ab637eebcbe1d67395d1694798041362173370f59933e3c
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
bundler (4.0.18) sha256=02d9a17429de1847b4e0c9f27a9ee4b20c0a74c0a641b4e77195d6019e3618ac
crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
faraday (2.14.3) sha256=1882247e6766615c8220b4392bf1d27f6ebb63d8e28267587cef1fb0bf37f278
faraday-net_http (3.4.4) sha256=0e78af151747ed1b00f33e25973b4bc220d7f16c00c39676817c8b12331eb588
hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1
hashie (5.1.0) sha256=c266471896f323c446ea8207f8ffac985d2718df0a0ba98651a3057096ca3870
json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
jwt (3.2.0) sha256=5419b1fe37b1da0982bd07051f573a8b8789ab724c2aa7e785e4784a3ed217d7
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
multi_xml (0.9.1) sha256=7ce766b59c17241ed62976caeae1fae9b2431b263398c35396239a68c4a64e57
net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996
oauth2 (2.0.25) sha256=2f736a2f93c2caa67c1b08dc3c9889bb907d62643f3183fefaa1723cba6a82ac
omniauth (2.1.4) sha256=42a05b0496f0d22e1dd85d42aaf602f064e36bb47a6826a27ab55e5ba608763c
omniauth-oauth2 (1.9.0) sha256=ed15f6d9d20991807ce114cc5b9c1453bce3645b64e51c68c90cff5ff153fee8
omniauth-shipbob (0.1.0)
public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
rack (3.2.7) sha256=93e13e1c24f93556671d85d2d79fa228c3485815c50d7e2f265b5330c6528fb7
rack-protection (4.2.1) sha256=cf6e2842df8c55f5e4d1a4be015e603e19e9bc3a7178bae58949ccbb58558bac
rack-test (2.2.0) sha256=005a36692c306ac0b4a9350355ee080fd09ddef1148a5f8b2ac636c720f5c463
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
snaky_hash (2.0.7) sha256=7d02c70012a3f932e48860cd024577908300c9aa615e0cb9b450aaa749cbcb4d
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
version_gem (1.1.15) sha256=a73241587b29252e3567e0c818ded80730eb754d43b508f6ce4db22ca9ba27d0
webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90

BUNDLED WITH
1.17.3
4.0.18
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019-2026 Dropstream

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading