Skip to content

Commit

Permalink
README: we forgot to update classname of excetptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmail committed Jan 22, 2025
1 parent e825637 commit ffacb5e
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ubuntu-24.04]
# https://www.ruby-lang.org/en/downloads/branches/
ruby: ["3.1", "3.2", "3.3"]
ruby: ["3.1", "3.2", "3.3", "3.4"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 3 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
require:
- rubocop-rake
- rubocop-rspec
- rubocop-performance
AllCops:
TargetRubyVersion: 3.0
NewCops: disable
SuggestExtensions: false
Metrics/BlockLength:
Max: 100
Layout/LineLength:
Expand All @@ -19,4 +20,4 @@ Style/HashTransformKeys:
Style/HashTransformValues:
Enabled: true
RSpec/MultipleExpectations:
Max: 10
Max: 10
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.2.1 - Mon Jan 20 2025
===============================================================
- Documentation: With 3.0 we changed the classname of exceptions
- test suite: test against Ruby 3.4
- various Ruby gem updates

3.2.0 - Mon Jun 10 2024
===============================================================
- Ruby 2.x no longer supported
Expand Down
7 changes: 6 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ source 'https://rubygems.org'
gemspec

group :development, :test do
gem 'activesupport', '~> 7.2' # 8.x requires Ruby 3.2
gem 'async'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'rubocop-rake'
gem 'rubocop-capybara'
gem 'rubocop-factory_bot'
gem 'rubocop-performance'
gem 'rubocop-rails' # shouldn't be needed, https://github.com/rubocop/rubocop/issues/10893
gem 'rubocop-rspec'
gem 'rubocop-rspec_rails'
gem 'vcr'
gem 'webmock'
end
117 changes: 77 additions & 40 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,98 +6,135 @@ PATH
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
activesupport (7.2.2.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
async (2.19.0)
async (2.21.1)
console (~> 1.29)
fiber-annotation
io-event (~> 1.6, >= 1.6.5)
bigdecimal (3.1.8)
console (1.29.0)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.9)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
console (1.29.2)
fiber-annotation
fiber-local (~> 1.1)
json
crack (1.0.0)
bigdecimal
rexml
diff-lcs (1.5.1)
drb (2.2.1)
fiber-annotation (0.2.0)
fiber-local (1.1.0)
fiber-storage
fiber-storage (1.0.0)
hashdiff (1.1.0)
io-event (1.7.3)
json (2.7.2)
hashdiff (1.1.2)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-event (1.7.5)
json (2.9.1)
language_server-protocol (3.17.0.3)
parallel (1.25.1)
parser (3.3.2.0)
logger (1.6.5)
minitest (5.25.4)
parallel (1.26.3)
parser (3.3.7.0)
ast (~> 2.4.1)
racc
public_suffix (5.0.5)
racc (1.8.0)
public_suffix (6.0.1)
racc (1.8.1)
rack (3.1.8)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.3.9)
regexp_parser (2.10.0)
rexml (3.4.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.64.1)
rspec-support (3.13.2)
rubocop (1.70.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.26.0)
rubocop (~> 1.41)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.31.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.29.0)
rubocop (~> 1.40)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.29.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.4.0)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
ruby-progressbar (1.13.0)
unicode-display_width (2.5.0)
vcr (6.2.0)
webmock (3.23.1)
securerandom (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
vcr (6.3.1)
base64
webmock (3.24.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
ruby
arm64-darwin-24
x86_64-linux

DEPENDENCIES
activesupport (~> 7.2)
async
opencage-geocoder!
rake
rspec
rubocop
rubocop-rake
rubocop-capybara
rubocop-factory_bot
rubocop-performance
rubocop-rails
rubocop-rspec
rubocop-rspec_rails
vcr
webmock

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ begin
# Invalid API key
geocoder = OpenCage::Geocoder.new(api_key: 'invalid-api-key')
geocoder.geocode('Manchester')
rescue OpenCage::Geocoder::AuthenticationError => e
rescue OpenCage::Error::AuthenticationError => e
p 'invalid apikey'
rescue OpenCage::Geocoder::QuotaExceeded => e
rescue OpenCage::Error::QuotaExceeded => e
p 'over quota'
rescue StandardError => e
p 'other error: ' + e.message
end

# Using strings instead of numbers for reverse geocoding
geocoder.reverse_geocode('51.5019951', '-0.0698806')
# raises OpenCage::Geocoder::InvalidRequest (not valid numeric coordinates: "51.5019951", "-0.0698806")
# raises OpenCage::Error::InvalidRequest (not valid numeric coordinates: "51.5019951", "-0.0698806")

begin

Expand Down Expand Up @@ -147,7 +147,7 @@ File.foreach('queries.txt') do |line|
# there is an invalid line in the queries.txt file
result = geocoder.reverse_geocode(Float(latitude), Float(longitude))
results.push(result)
rescue ArgumentError, OpenCage::Geocoder::GeocodingError => error
rescue ArgumentError, OpenCage::Error::GeocodingError => error
# Stop looping through the queries if there is an error
puts "Error: #{error.message}"
break
Expand Down
2 changes: 1 addition & 1 deletion spec/open_cage/geocoder/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:api_key) { '1111222233334444' }

it 'creates a URI instance' do
expect(described_class.new(api_key, 'New York').url).to be_kind_of(URI::HTTPS)
expect(described_class.new(api_key, 'New York').url).to be_a(URI::HTTPS)
end

it 'forward' do
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'Ruby linting', type: :feature do
it 'run rubocop' do
expect do
system('bundle exec rubocop --format simple 2>&1')
system('bundle exec rubocop --no-color --format simple 2>&1')
end.to output(/no offenses detect/).to_stdout_from_any_process
end
end

0 comments on commit ffacb5e

Please sign in to comment.