Skip to content

Commit

Permalink
[NO-TICKET] upgrades to ruby/setup-ruby and actions/cache@v4 (#39)
Browse files Browse the repository at this point in the history
Co-authored-by: Olivier <[email protected]>
  • Loading branch information
lindseytruong and olimart authored Nov 26, 2024
1 parent 70631db commit 1599283
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 42 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [2.6]
ruby: ['3.3', '3.4.0-preview2']

steps:
- uses: actions/checkout@master

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

- name: Ruby gem cache
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand All @@ -27,7 +28,6 @@ jobs:
- name: Set up the environment
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
Expand All @@ -38,18 +38,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [2.6]
ruby: ['3.3', '3.4.0-preview2']

steps:
- uses: actions/checkout@master

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

- name: Ruby gem cache
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand All @@ -58,7 +59,6 @@ jobs:
- name: Set up the environment
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
Expand Down
85 changes: 67 additions & 18 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,87 @@
require: rubocop-rspec

Gemspec/RequiredRubyVersion:
Enabled: false

Layout/LineLength:
Max: 100
Enabled: false

Metrics/ParameterLists:
Max: 6
Layout/MultilineMethodCallIndentation:
Enabled: false

Metrics/MethodLength:
Max: 15
Lint/ConstantDefinitionInBlock:
Enabled: false

Style/StringLiterals:
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
ConsistentQuotesInMultiline: false
Lint/MissingSuper:
Enabled: false

Lint/NonDeterministicRequireOrder:
Enabled: false

Lint/SuppressedException:
Enabled: false

Lint/ToJSON:
Enabled: false

Lint/UselessMethodDefinition:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/BlockLength:
Severity: warning
Exclude:
- spec/**/*

Lint/SuppressedException:
Metrics/ClassLength:
Max: 200
Severity: warning

Metrics/ParameterLists:
Max: 6
MaxOptionalParameters: 6

Metrics/MethodLength:
Max: 15

Naming/BinaryOperatorParameterName:
Enabled: false

RSpec/ContextWording:
Enabled: false

RSpec/InstanceVariable:
Enabled: false

RSpec/LeakyConstantDeclaration:
Enabled: false

RSpec/MultipleExpectations:
Max: 3

Security/YAMLLoad:
RSpec/MessageSpies:
Enabled: false

Style/Documentation:
RSpec/NoExpectationExample:
Enabled: false

Layout/MultilineMethodCallIndentation:
RSpec/StubbedMock:
Enabled: false

RSpec/ExampleLength:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/Documentation:
Enabled: false

Style/NumericLiterals:
Enabled: false

Style/PercentLiteralDelimiters:
PreferredDelimiters:
default: ()
Expand All @@ -48,6 +91,12 @@ Style/PercentLiteralDelimiters:
'%w': '[]'
'%W': '[]'

Metrics/ClassLength:
Max: 200
Severity: warning
Style/StringLiterals:
EnforcedStyle: single_quotes
SupportedStyles:
- single_quotes
- double_quotes
ConsistentQuotesInMultiline: false

Security/YAMLLoad:
Enabled: false
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.6.5
ruby-3.3.6
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

module LightspeedRestaurantClient
class LightspeedRestaurantClientError < StandardError
attr_reader :message
attr_reader :http_status
attr_reader :http_body
attr_reader :http_headers
attr_reader :request_id
attr_reader :json_body
attr_reader :message, :http_status, :http_body, :http_headers, :request_id, :json_body

def initialize(message = nil, http_status = nil, http_body = nil, http_headers = nil)
@message = message
Expand Down
10 changes: 5 additions & 5 deletions lib/lightspeed_restaurant/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def initialize(base_uri, path, token, body = {}, query = {}, logger = nil)
@headers = { 'Content-Type' => 'application/json', 'X-Auth-Token' => token }
@body = body.to_json
@query = query
@path = '/PosServer' + path
@path = "/PosServer#{path}"
@connection = Excon.new(@base_uri)
@logger = logger || begin
require 'logger'
Expand Down Expand Up @@ -73,22 +73,22 @@ def not_found_error(response)

def response_object_error(response)
APIError.new("Invalid response object from API: #{JSON.parse(response.body)['description']}",
response.status, response.body, response.headers)
response.status, response.body, response.headers)
end

def invalid_request_error(response)
InvalidRequestError.new(JSON.parse(response.body)['description'],
response.status, response.body, response.headers)
response.status, response.body, response.headers)
end

def authentication_error(response)
AuthenticationError.new(JSON.parse(response.body)['description'],
response.status, response.body, response.headers)
response.status, response.body, response.headers)
end

def rate_limit_error(response)
RateLimitError.new(JSON.parse(response.body)['description'],
response.status, response.body, response.headers)
response.status, response.body, response.headers)
end
end
end
2 changes: 1 addition & 1 deletion spec/lightspeed_restaurant/operations/operation_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def ==(value)
end

def custom_configuration
@config ||= LightspeedRestaurantClient.default_configuration.with(api_token: 'CUSTOM-1234')
@custom_configuration ||= LightspeedRestaurantClient.default_configuration.with(api_token: 'CUSTOM-1234')
end
end
2 changes: 1 addition & 1 deletion spec/lightspeed_restaurant_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
subject(:client) { described_class }

it 'has a version number' do
expect(client::VERSION).not_to be nil
expect(client::VERSION).not_to be_nil
end

it 'uses global configuration' do
Expand Down

0 comments on commit 1599283

Please sign in to comment.