Skip to content
2 changes: 1 addition & 1 deletion .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby_version: ['2.7.5', '3.0.5', '3.1.4', '3.2.2']
ruby_version: ['3.1.4', '3.2.2', '3.4.7']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
114 changes: 62 additions & 52 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ PATH
specs:
event_source (0.5.8)
addressable (>= 2.8.0)
base64
bigdecimal
bunny (>= 2.14)
deep_merge (~> 1.2.0)
dry-configurable (~> 0.12)
Expand All @@ -14,10 +16,12 @@ PATH
dry-struct (~> 1.4)
dry-types (~> 1.5)
dry-validation (~> 1.6)
faraday (~> 1.4.1)
faraday_middleware (~> 1.0)
faraday (~> 2.14.1)
faraday-retry (~> 2.0)
faraday-typhoeus (~> 1.0)
logging (~> 2.3.0)
mime-types
mutex_m
nokogiri (>= 1.13.0)
oj (~> 3.11)
ox (~> 2.14)
Expand Down Expand Up @@ -89,14 +93,16 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
amq-protocol (2.3.2)
ast (2.4.2)
base64 (0.3.0)
bigdecimal (4.0.1)
bson (4.12.1)
builder (3.2.4)
bunny (2.19.0)
amq-protocol (~> 2.3, >= 2.3.1)
sorted_set (~> 1, >= 1.0.2)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.9)
concurrent-ruby (1.3.6)
crack (0.4.5)
rexml
crass (1.0.6)
Expand All @@ -108,84 +114,84 @@ GEM
database_cleaner-core (2.0.1)
deep_merge (1.2.1)
diff-lcs (1.4.4)
dry-configurable (0.12.1)
dry-configurable (0.16.1)
dry-core (~> 0.6)
zeitwerk (~> 2.6)
dry-container (0.11.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5.0)
dry-container (0.8.0)
dry-core (0.9.1)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.7.1)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
zeitwerk (~> 2.6)
dry-events (0.3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5)
dry-inflector (0.2.1)
dry-initializer (3.0.4)
dry-logic (1.2.0)
dry-inflector (0.3.0)
dry-initializer (3.2.0)
dry-logic (1.3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5)
dry-core (~> 0.9, >= 0.9)
zeitwerk (~> 2.6)
dry-monads (1.4.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.7)
dry-schema (1.6.2)
dry-schema (1.11.3)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.8, >= 0.8.3)
dry-core (~> 0.5, >= 0.5)
dry-configurable (~> 0.16, >= 0.16)
dry-core (~> 0.9, >= 0.9)
dry-initializer (~> 3.0)
dry-logic (~> 1.0)
dry-types (~> 1.5)
dry-logic (~> 1.3)
dry-types (~> 1.6)
zeitwerk (~> 2.6)
dry-struct (1.4.0)
dry-core (~> 0.5, >= 0.5)
dry-types (~> 1.5)
ice_nine (~> 0.11)
dry-types (1.5.1)
dry-types (1.6.1)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
dry-core (~> 0.5, >= 0.5)
dry-core (~> 0.9, >= 0.9)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
dry-validation (1.6.0)
dry-logic (~> 1.3, >= 1.3)
zeitwerk (~> 2.6)
dry-validation (1.9.0)
concurrent-ruby (~> 1.0)
dry-container (~> 0.7, >= 0.7.1)
dry-core (~> 0.4)
dry-equalizer (~> 0.2)
dry-core (~> 0.9, >= 0.9)
dry-initializer (~> 3.0)
dry-schema (~> 1.5, >= 1.5.2)
dry-schema (~> 1.11, >= 1.11.0)
zeitwerk (~> 2.6)
erubi (1.10.0)
ethon (0.15.0)
ffi (>= 1.15.0)
faker (2.18.0)
i18n (>= 1.6, < 2)
faraday (1.4.3)
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)
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.2.0)
faraday_middleware (1.2.0)
faraday (~> 1.0)
faraday (2.14.1)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.4.2)
net-http (~> 0.5)
faraday-retry (2.4.0)
faraday (~> 2.0)
faraday-typhoeus (1.1.0)
faraday (~> 2.0)
typhoeus (~> 1.4)
ffi (1.15.4)
globalid (0.5.2)
activesupport (>= 5.0)
hashdiff (1.0.1)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
json (2.18.1)
little-plugger (1.1.4)
logger (1.7.0)
logging (2.3.0)
little-plugger (~> 1.1)
multi_json (~> 1.14)
loofah (2.12.0)
loofah (2.25.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
nokogiri (>= 1.12.0)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.2)
Expand All @@ -194,18 +200,20 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0901)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
minitest (5.14.4)
mongo (2.14.0)
bson (>= 4.8.2, < 5.0.0)
mongoid (7.3.0)
activemodel (>= 5.1, < 6.2)
mongo (>= 2.10.5, < 3.0.0)
multi_json (1.15.0)
multipart-post (2.1.1)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
nio4r (2.5.8)
mutex_m (0.3.0)
net-http (0.9.1)
uri (>= 0.11.1)
nio4r (2.7.5)
racc (~> 1.4)
oj (3.13.9)
ox (2.14.5)
parallel (1.20.1)
Expand All @@ -218,7 +226,7 @@ GEM
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (4.0.6)
racc (1.6.2)
racc (1.8.1)
rack (2.2.3)
rack-protection (2.1.0)
rack
Expand All @@ -239,8 +247,9 @@ GEM
bundler (>= 1.15.0)
railties (= 6.1.4.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
Expand Down Expand Up @@ -284,7 +293,7 @@ GEM
rubocop-ast (1.7.0)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.4)
ruby2_keywords (0.0.5)
set (1.0.2)
sinatra (2.1.0)
mustermann (~> 1.0)
Expand All @@ -308,6 +317,7 @@ GEM
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.0.0)
uri (1.1.1)
webmock (3.13.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
Expand All @@ -316,7 +326,7 @@ GEM
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
yard (0.9.26)
zeitwerk (2.5.1)
zeitwerk (2.7.5)

PLATFORMS
ruby
Expand All @@ -336,4 +346,4 @@ DEPENDENCIES
yard

BUNDLED WITH
2.2.14
2.4.19
8 changes: 6 additions & 2 deletions event_source.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@ Gem::Specification.new do |spec|
spec.add_dependency 'dry-types', '~> 1.5'
spec.add_dependency 'dry-validation', '~> 1.6'
spec.add_dependency 'dry-schema', '~> 1.6'
spec.add_dependency 'faraday', '~> 1.4.1'
spec.add_dependency 'faraday_middleware', '~> 1.0'
spec.add_dependency 'faraday', '~> 2.14.1'
spec.add_dependency 'faraday-typhoeus', '~> 1.0'
spec.add_dependency 'faraday-retry', '~> 2.0'
spec.add_dependency 'logging', '~> 2.3.0'
spec.add_dependency 'nokogiri', '>= 1.13.0'
spec.add_dependency 'mime-types'
spec.add_dependency 'oj', '~> 3.11'
spec.add_dependency 'ox', '~> 2.14'
spec.add_dependency 'typhoeus', '~> 1.4.0'
spec.add_dependency 'bigdecimal'
spec.add_dependency 'base64'
spec.add_dependency 'mutex_m'

# TODO: Change to development dependency
spec.add_development_dependency 'database_cleaner'
Expand Down
2 changes: 1 addition & 1 deletion lib/event_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'forwardable'
require 'date'
require 'dry/types/type'
require 'dry-types'
require 'dry/monads'
require 'dry/monads/do'
require 'dry/monads/result'
Expand Down
12 changes: 6 additions & 6 deletions lib/event_source/protocols/http/faraday_connection_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def initialize(async_api_server, options = {})
def build_connection
request_middleware_params = construct_request_middleware
response_middleware_params = connection_params[:response_middleware_params]
# adapter = connection_params[:adapter]
adapter = connection_params[:adapter]

Faraday.new(
build_faraday_parameters(connection_params)
Expand All @@ -105,14 +105,14 @@ def build_connection

conn.response :logger, nil, { headers: true, bodies: true, log_level: :error }

# conn.adapter :http
# last middleware must be adapter
# adapter.each_pair do |component, options|
# conn.adapter component.to_s.to_sym, options || {}
# end
# Adapter must be last - required in Faraday 2.x
adapter.each_pair do |component, options|
conn.adapter component.to_sym, options || {}
end
end
end


def connection
@subject
end
Expand Down
5 changes: 2 additions & 3 deletions lib/event_source/protocols/http_protocol.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# frozen_string_literal: true

require 'faraday'
require 'faraday_middleware'
require 'typhoeus'
require 'typhoeus/adapters/faraday'
require 'faraday/retry'
require 'faraday/typhoeus'
require 'uri'

require_relative 'http/error'
Expand Down
10 changes: 2 additions & 8 deletions spec/event_source/example_services/ridp_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,7 @@
end

before :each do
stub_request(:post, "https://impl.hub.cms.gov/Imp1/RIDPService").with(
headers: {
'Accept'=>'*/*',
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'User-Agent' => 'Faraday v1.4.3'
}
)
stub_request(:post, "https://impl.hub.cms.gov/Imp1/RIDPService")
.with do |request|
puts request.body.inspect
xml = Nokogiri::XML(request.body)
Expand All @@ -70,7 +64,7 @@
)
u_token.present? && t_stamp.present?
end
.to_return(status: 200, body: "", headers: {})
.to_return(status: 200, body: "", headers: {})
end

it "responds to requests" do
Expand Down
2 changes: 1 addition & 1 deletion spec/event_source/operations/mime_encode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

context 'when payload cannot be converted to JSON' do
before do
allow(invalid_payload).to receive(:to_json).and_raise(JSON::GeneratorError)
allow(invalid_payload).to receive(:to_json).and_raise(JSON::GeneratorError.new('test error'))
end

it 'returns a failure with JSON::GeneratorError' do
Expand Down
Loading