Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Ruby-3.2 and Faraday-2 #45

Merged
merged 4 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.1', '3.0', '2.7', '2.6']
ruby-version: ['3.2', '3.1', '3.0', '2.7', '2.6']

steps:
- uses: actions/checkout@v3
- name: Install apt dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev # needed by faraday-patron gem

- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}

Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.2
3.2.2
10 changes: 9 additions & 1 deletion ipinfo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ Gem::Specification.new do |spec|
spec.description = ' This is a ruby wrapper for http://ipinfo.io. '
spec.homepage = 'https://ipinfo.io'

spec.add_runtime_dependency 'faraday', '~> 1.0'
spec.add_runtime_dependency 'faraday', '~> 2.0'
# add development dependency to test against faraday adapters that are been moved out the gem
spec.add_development_dependency 'async-http-faraday'
spec.add_development_dependency 'faraday-net_http_persistent', '~> 2.0'
spec.add_development_dependency 'faraday-typhoeus', '~> 1.0'
spec.add_development_dependency 'faraday-patron', '~> 2.0'
spec.add_development_dependency 'faraday-httpclient', '~> 2.0'
spec.add_development_dependency 'faraday-excon', '~> 2.1'

spec.add_runtime_dependency 'json', '~> 2.1'
spec.add_runtime_dependency 'lru_redux', '~> 1.1'

Expand Down
2 changes: 1 addition & 1 deletion lib/ipinfo/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def connection(adapter)

def default_headers
headers = {
'User-Agent' => 'IPinfoClient/Ruby/2.0.0',
'User-Agent' => 'IPinfoClient/Ruby/2.1.0',
'Accept' => 'application/json'
}
headers['Authorization'] = "Bearer #{CGI.escape(token)}" if token
Expand Down
2 changes: 1 addition & 1 deletion lib/ipinfo/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module IPinfo
VERSION = '2.0.0'
VERSION = '2.1.0'
end
2 changes: 1 addition & 1 deletion test/ipinfo_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def assert_ip4(resp)
resp.abuse,
{
"address": 'US, CA, Mountain View, ' \
'1600 Amphitheatre Parkway, 94043',
'1600 Amphitheatre Parkway, 94043',
"country": 'US',
"email": '[email protected]',
"name": 'Abuse',
Expand Down
8 changes: 6 additions & 2 deletions test/lib/adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
require 'test_helper'
require_relative '../../lib/ipinfo/adapter'

require 'faraday/net_http_persistent'
require 'faraday/typhoeus'
require 'faraday/patron'
require 'faraday/httpclient'
require 'faraday/excon'

class IPinfo::AdapterTest < Minitest::Test
def test_default
adapter = IPinfo::Adapter.new
Expand All @@ -17,8 +23,6 @@ def test_default
net_http_persistent: Faraday::Adapter::NetHttpPersistent,
typhoeus: Faraday::Adapter::Typhoeus,
patron: Faraday::Adapter::Patron,
em_synchrony: Faraday::Adapter::EMSynchrony,
em_http: Faraday::Adapter::EMHttp,
excon: Faraday::Adapter::Excon,
httpclient: Faraday::Adapter::HTTPClient
}.freeze
Expand Down