Skip to content

Commit

Permalink
[RIS-1225] Move to Ruby 3.0.x (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
trooney-himama authored Feb 6, 2024
1 parent 3435cbf commit 0f5019e
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 21 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
# Indent with 2 spaces
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
4 changes: 2 additions & 2 deletions .github/workflows/gempush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.0

- name: Publish to RubyGems
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.7', '3.0']
ruby: ['3.0', '3.1', '3.2', '3.3']
name: Ruby ${{ matrix.ruby }} Test
steps:
- uses: actions/checkout@master
Expand Down
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

Metrics/ClassLength:
Enabled: false
Expand Down Expand Up @@ -103,3 +103,6 @@ Security/YAMLLoad:

Style/RegexpLiteral:
Enabled: false

Naming/VariableNumber:
Enabled: false
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.7
3.0.5
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Unreleased (2023-12-01)
## 0.7.0 (2024-02-06)

- Drop support for Ruby 2
- Updating minimum Ruby version to Ruby 3.0.5
- Add test support for Ruby 3.1, 3.2, 3.3
- Updated Rubocop to enforce 3.0.x conventions
- Linting fixes
- Update `BatchReportResource#batch_report_body` to allow `sub merchant id` to be received from `Bambora::Client` or `elements`

## 0.6.0 (2023-05-02)
Expand Down
8 changes: 4 additions & 4 deletions bambora-client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.7.7'
spec.required_ruby_version = '>= 3.0.5'

spec.add_dependency 'faraday', '~> 2.0.1'
spec.add_dependency 'faraday-excon'
Expand All @@ -46,11 +46,11 @@ Gem::Specification.new do |spec|
spec.add_dependency 'multiparty', '~> 0'

spec.add_development_dependency 'bundler', '~> 2'
spec.add_development_dependency 'pry', '~> 0.12.0'
spec.add_development_dependency 'pry-byebug', '~> 3.7'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'pry-byebug'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
spec.add_development_dependency 'rubocop', '~> 0.74.0'
spec.add_development_dependency 'rubocop', '~> 1.12.0'
spec.add_development_dependency 'webmock', '~> 3.7'
end
2 changes: 1 addition & 1 deletion lib/bambora/adapters/query_string_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def to_h
parsed_response = super
return error_response if parsed_response.values.flatten.empty? # We didn't get a query string back.

parsed_response.each_with_object({}) { |(key, val), obj| obj[key] = val.length == 1 ? val.first : val }
parsed_response.transform_values { |val| val.length == 1 ? val.first : val }
end

private
Expand Down
4 changes: 2 additions & 2 deletions lib/bambora/bank/adapters/payment_profile_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def initialize(response)
end

def to_h
parsed_query_string.each_with_object({}) do |(key, val), obj|
obj[transform(key)] = val
parsed_query_string.transform_keys do |key|
transform(key)
end
end

Expand Down
6 changes: 2 additions & 4 deletions lib/bambora/bank/batch_report_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,14 @@ def show(report_data)
response = client.post(path: sub_path, body: batch_report_body(report_data))

response = ensure_record_key_exists(response)
response = add_messages_to_response(response)

response
add_messages_to_response(response)
end

private

def ensure_record_key_exists(response)
# bambora can return null or empty record results, fill it in for consistency
response.dig(:response)[:record] = [] if response.dig(:response, :record).nil?
response[:response][:record] = [] if response.dig(:response, :record).nil?

response
end
Expand Down
4 changes: 2 additions & 2 deletions lib/bambora/bank/builders/payment_profile_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class << self
#
# @params params [Hash]
def build(params)
params.each_with_object({}) do |(key, value), obj|
obj[transform_key(key)] = value
params.transform_keys do |key|
transform_key(key)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bambora/client/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Bambora
class Client
VERSION = '0.6.0'
VERSION = '0.7.0'
end
end
2 changes: 1 addition & 1 deletion lib/bambora/rest/json_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class JSONClient < Bambora::Rest::Client
# @param api_key [String] Indicating the API Key to be used with the request.
#
# @return [Hash] Indicating success or failure of the operation.
def get(path:, params: nil, api_key:)
def get(path:, api_key:, params: nil)
parse_response_body(
super(path: path, params: params, headers: build_headers(api_key: api_key)),
).to_h
Expand Down

0 comments on commit 0f5019e

Please sign in to comment.