diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..4926653 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,51 @@ +version: 2.1 + +executors: + default: + working_directory: ~/sdk + docker: + - image: cimg/ruby:2.7 + +jobs: + build: + executor: default + steps: + - checkout + - run: + name: Install bundler & gems + command: | + gem install bundler + bundle install --jobs 4 --retry 3 + - run: + name: Rubocop + command: bundle exec rubocop --parallel + # - run: + # name: Run Tests + # command: bundle exec rake tests + publish: + executor: default + steps: + - checkout + - run: + name: Publish to RubyGems + command: | + mkdir -p ~/.gem + touch ~/.gem/credentials + chmod 0600 ~/.gem/credentials + printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > ~/.gem/credentials + gem build *.gemspec + gem push *.gem + environment: + GEM_HOST_API_KEY: $RUBYGEMS_AUTH_TOKEN + +workflows: + build_and_test: + jobs: + - build + publish: + jobs: + - publish: + filters: + branches: + only: + - master diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml deleted file mode 100644 index 0088a1b..0000000 --- a/.github/workflows/gem-push.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Ruby Gem - -on: - push: - branches: - - master -# pull_request: -# branches: [ master ] - -jobs: - build: -# needs: Ruby - name: Build + Publish - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 -# - name: Set up Ruby 2.6 -# uses: actions/setup-ruby@v1 -# with: -# ruby-version: 2.6.x - - - name: Publish to RubyGems - run: | - mkdir -p $HOME/.gem - touch $HOME/.gem/credentials - chmod 0600 $HOME/.gem/credentials - printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials - gem build *.gemspec - gem push *.gem - env: - GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}" diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml deleted file mode 100644 index bccb193..0000000 --- a/.github/workflows/ruby.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Ruby - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - name: Build and run Rubocop - run: | - gem install bundler - bundle install --jobs 4 --retry 3 - bundle exec rubocop --parallel - - name: Build and run tests - run: | - gem install bundler - bundle install --jobs 4 --retry 3 - bundle exec rake unit_tests diff --git a/lib/paymentrails/Client.rb b/lib/paymentrails/Client.rb index b1a24ab..901c69b 100644 --- a/lib/paymentrails/Client.rb +++ b/lib/paymentrails/Client.rb @@ -47,7 +47,7 @@ def send_request(endPoint, method, body = '') 'Authorization': generate_authorization(time, endPoint, method, body), 'Content-Type': 'application/json', 'Trolley-Source': "ruby-sdk_#{spec.version}"} - + if method === "GET" request = Net::HTTP::Get.new(uri.request_uri, headers) elsif method === "POST" diff --git a/lib/paymentrails/gateways/GatewayHelper.rb b/lib/paymentrails/gateways/GatewayHelper.rb index 15aa8d1..94d5ae0 100644 --- a/lib/paymentrails/gateways/GatewayHelper.rb +++ b/lib/paymentrails/gateways/GatewayHelper.rb @@ -1,5 +1,6 @@ module PaymentRails module GatewayHelper + # rubocop:disable Lint/SuppressedException def loosely_hydrate_model(klass_instance, attributes) attributes.each do |k, v| begin @@ -12,5 +13,6 @@ def loosely_hydrate_model(klass_instance, attributes) klass_instance end + # rubocop:enable Lint/SuppressedException end end diff --git a/paymentrails.gemspec b/paymentrails.gemspec index deb522d..cae9232 100644 --- a/paymentrails.gemspec +++ b/paymentrails.gemspec @@ -1,10 +1,10 @@ $:.push File.expand_path("../lib", __FILE__) Gem::Specification.new do |s| - s.name = "paymentrails" + s.name = "paymentrails-zero" s.summary = "Trolley Ruby SDK" s.description = "Ruby SDK for interacting with the Trolley API" - s.version = '0.2.13' + s.version = '0.2.14' s.homepage = 'https://trolley.com/' s.email = ['developer-tools@trolley.com'] s.license = "MIT" diff --git a/spec/integration/RecipientTest.rb b/spec/integration/RecipientTest.rb index d942d58..a2dd88c 100644 --- a/spec/integration/RecipientTest.rb +++ b/spec/integration/RecipientTest.rb @@ -49,6 +49,7 @@ def test_lifecycle assert_equal(recipient.status, 'archived') end + # rubocop:disable Metrics/MethodLength def test_account uuid = SecureRandom.uuid.to_s recipient = @client.recipient.create( @@ -88,4 +89,5 @@ def test_account accountList = @client.recipient_account.all(recipient.id) assert_equal(1, accountList.count) end + # rubocop:enable Metrics/MethodLength end