Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Compatible faraday v2 #44

Merged
merged 2 commits into from
Nov 11, 2022
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
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ jobs:
- 2.7
- '3.0' # Quoted, to avoid YAML float 3.0 interplated to "3"
- 3.1

gemfile:
- faraday_0
- faraday_1
- faraday_2
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
Expand Down
136 changes: 66 additions & 70 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,127 +2,123 @@ PATH
remote: .
specs:
kiji (0.2.2)
faraday
faraday (< 3)
nokogiri

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.0)
byebug (11.0.1)
coderay (1.1.2)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
byebug (11.1.3)
coderay (1.1.3)
crack (0.4.5)
rexml
diff-lcs (1.3)
dotenv (2.7.5)
faraday (1.4.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
multipart-post (>= 1.2, < 3)
diff-lcs (1.5.0)
dotenv (2.8.1)
faraday (2.6.0)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.1.0)
ffi (1.14.2)
formatador (0.2.5)
guard (2.16.1)
faraday-net_http (3.0.1)
ffi (1.15.5)
formatador (1.1.0)
guard (2.18.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
pry (>= 0.13.0)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-bundler (2.2.1)
bundler (>= 1.3.0, < 3)
guard-bundler (3.0.0)
bundler (>= 2.1, < 3)
guard (~> 2.2)
guard-compat (~> 1.1)
guard-compat (1.2.1)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
guard-rubocop (1.3.0)
guard-rubocop (1.5.0)
guard (~> 2.0)
rubocop (~> 0.20)
rubocop (< 2.0)
hashdiff (1.0.1)
jaro_winkler (1.5.4)
listen (3.4.1)
json (2.6.2)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.0.13)
method_source (0.9.2)
lumberjack (1.2.8)
method_source (1.0.0)
mini_portile2 (2.8.0)
multipart-post (2.1.1)
nenv (0.3.0)
nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
parallel (1.19.1)
parser (2.6.5.0)
ast (~> 2.4.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (4.0.6)
pry (>= 0.13, < 0.15)
public_suffix (5.0.0)
racc (1.6.0)
rainbow (3.0.0)
rake (13.0.1)
rb-fsevent (0.10.4)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (2.6.0)
rexml (3.2.5)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.0)
rspec-support (~> 3.9.0)
rspec-expectations (3.9.0)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
rubocop (0.77.0)
jaro_winkler (~> 1.5.1)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.38.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 2.6)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
ruby2_keywords (0.0.4)
rubyzip (2.0.0)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
shellany (0.0.1)
thor (0.20.3)
unicode-display_width (1.6.0)
vcr (6.0.0)
webmock (3.11.2)
addressable (>= 2.3.6)
thor (1.2.1)
unicode-display_width (2.3.0)
vcr (6.1.0)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.8)
bundler
dotenv
guard
guard-bundler
Expand All @@ -138,4 +134,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.2.32
2.3.25
5 changes: 5 additions & 0 deletions gemfiles/faraday_0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem "faraday", "~> 0"

eval_gemfile File.expand_path("../Gemfile", __dir__)
5 changes: 5 additions & 0 deletions gemfiles/faraday_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem "faraday", "~> 1"

eval_gemfile File.expand_path("../Gemfile", __dir__)
5 changes: 5 additions & 0 deletions gemfiles/faraday_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem "faraday", "~> 2"

eval_gemfile File.expand_path("../Gemfile", __dir__)
4 changes: 2 additions & 2 deletions kiji.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_development_dependency 'bundler', '~> 1.8'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'dotenv'
spec.add_development_dependency 'guard'
spec.add_development_dependency 'guard-bundler'
Expand All @@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'webmock'

# spec.add_runtime_dependency 'signer'
spec.add_runtime_dependency 'faraday'
spec.add_runtime_dependency 'faraday', '< 3'
spec.add_runtime_dependency 'nokogiri'
end
10 changes: 9 additions & 1 deletion lib/kiji/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@ def connection
Faraday.new(url: @api_end_point) do |c|
# c.response :logger
c.adapter Faraday.default_adapter
c.basic_auth(@basic_auth_id, @basic_auth_password) unless @basic_auth_id.nil?
c.request(*authentication_middleware_keys, @basic_auth_id, @basic_auth_password) unless @basic_auth_id.nil?
c.headers['User-Agent'] = 'SmartHR v0.0.1'
c.headers['x-eGovAPI-SoftwareID'] = software_id
c.headers['x-eGovAPI-AccessKey'] = access_key unless access_key.nil?
end
end

def authentication_middleware_keys
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0.0')
%i[authorization basic]
else
[:basic_auth]
end
end

def sign(appl_data)
raise 'Please specify cert & private_key' if cert.nil? || private_key.nil?

Expand Down