Skip to content
Closed
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
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ["3.2", "3.3", "3.4", "4.0"]

steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: bundle install

- name: Run RSpec tests
run: bundle exec rake spec

- name: Run RuboCop
run: bundle exec rubocop --parallel
continue-on-error: true
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: release

on:
release:
types: [published]

jobs:
publish-rubygems:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true

- name: Install dependencies
run: bundle install

- name: Run tests
run: bundle exec rake spec

- name: Build gem
run: gem build payjpv2.gemspec

- name: Get version from release tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Verify gem version matches tag
run: |
GEM_VERSION=$(ruby -r ./lib/payjpv2/version -e "puts PAYJPv2::VERSION")
TAG_VERSION=${{ steps.version.outputs.version }}
if [ "$GEM_VERSION" != "$TAG_VERSION" ]; then
echo "Error: Gem version ($GEM_VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi

- name: Configure RubyGems credentials
run: |
mkdir -p ~/.gem
echo -e "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials
chmod 0600 ~/.gem/credentials

- name: Publish to RubyGems
run: gem push payjpv2-${{ steps.version.outputs.version }}.gem

- name: Cleanup credentials
if: always()
run: rm -f ~/.gem/credentials
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
payjpv2 (0.0.1)
payjpv2 (1.0.0)
typhoeus (~> 1.0, >= 1.0.1)

GEM
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A Ruby client library for the PAY.JP v2 API. This SDK provides a convenient way
This Ruby gem is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 2.0.0
- Package version: 0.0.1
- Package version: 1.0.0
- Generator version: 7.14.0
- Build package: org.openapitools.codegen.languages.RubyClientCodegen

Expand All @@ -26,7 +26,7 @@ gem install payjpv2
Add this line to your application's Gemfile:

```ruby
gem 'payjpv2', '~> 0.0.1'
gem 'payjpv2', '~> 1.0.0'
```

Then execute:
Expand Down
8 changes: 8 additions & 0 deletions lib/payjpv2/models/tax_rate_create_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ def percentage=(percentage)
raise ArgumentError, 'percentage cannot be nil'
end

if percentage > 100.0
raise ArgumentError, 'invalid value for "percentage", must be smaller than or equal to 100.0.'
end

if percentage < 0.0
raise ArgumentError, 'invalid value for "percentage", must be greater than or equal to 0.0.'
end

@percentage = percentage
end

Expand Down
2 changes: 1 addition & 1 deletion lib/payjpv2/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
=end

module PAYJPv2
VERSION = '0.0.1'
VERSION = '1.0.0'
end
8 changes: 7 additions & 1 deletion payjpv2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ Gem::Specification.new do |s|
s.description = "A Ruby client library for the PAY.JP v2 API"
s.license = "MIT"
s.required_ruby_version = ">= 3.2"
s.metadata = {}
s.metadata = {
"homepage_uri" => "https://github.com/payjp/payjpv2-ruby",
"source_code_uri" => "https://github.com/payjp/payjpv2-ruby",
"changelog_uri" => "https://github.com/payjp/payjpv2-ruby/releases",
"bug_tracker_uri" => "https://github.com/payjp/payjpv2-ruby/issues",
"rubygems_mfa_required" => "true"
}

s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'

Expand Down
Loading