diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9dd0150 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d1dcf75 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index ca4aa59..0d5cae5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - payjpv2 (0.0.1) + payjpv2 (1.0.0) typhoeus (~> 1.0, >= 1.0.1) GEM diff --git a/README.md b/README.md index 06c3132..2d270a7 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: diff --git a/lib/payjpv2/models/tax_rate_create_request.rb b/lib/payjpv2/models/tax_rate_create_request.rb index a9039e1..02a6856 100644 --- a/lib/payjpv2/models/tax_rate_create_request.rb +++ b/lib/payjpv2/models/tax_rate_create_request.rb @@ -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 diff --git a/lib/payjpv2/version.rb b/lib/payjpv2/version.rb index a962abe..ad37a60 100644 --- a/lib/payjpv2/version.rb +++ b/lib/payjpv2/version.rb @@ -11,5 +11,5 @@ =end module PAYJPv2 - VERSION = '0.0.1' + VERSION = '1.0.0' end diff --git a/payjpv2.gemspec b/payjpv2.gemspec index 30caa90..be497da 100644 --- a/payjpv2.gemspec +++ b/payjpv2.gemspec @@ -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'