Skip to content
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
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: ['3.1.4', '3.2.2', '3.4.7']
ruby_version: ['2.7.5', '3.0.5', '3.1.4', '3.2.2']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
114 changes: 52 additions & 62 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ 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 @@ -16,12 +14,10 @@ PATH
dry-struct (~> 1.4)
dry-types (~> 1.5)
dry-validation (~> 1.6)
faraday (~> 2.14.1)
faraday-retry (~> 2.0)
faraday-typhoeus (~> 1.0)
faraday (~> 1.4.1)
faraday_middleware (~> 1.0)
logging (~> 2.3.0)
mime-types
mutex_m
nokogiri (>= 1.13.0)
oj (~> 3.11)
ox (~> 2.14)
Expand Down Expand Up @@ -93,16 +89,14 @@ 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.3.6)
concurrent-ruby (1.1.9)
crack (0.4.5)
rexml
crass (1.0.6)
Expand All @@ -114,84 +108,84 @@ GEM
database_cleaner-core (2.0.1)
deep_merge (1.2.1)
diff-lcs (1.4.4)
dry-configurable (0.16.1)
dry-core (~> 0.6)
zeitwerk (~> 2.6)
dry-container (0.11.0)
dry-configurable (0.12.1)
concurrent-ruby (~> 1.0)
dry-core (0.9.1)
dry-core (~> 0.5, >= 0.5.0)
dry-container (0.8.0)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.7.1)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-events (0.3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5)
dry-inflector (0.3.0)
dry-initializer (3.2.0)
dry-logic (1.3.0)
dry-inflector (0.2.1)
dry-initializer (3.0.4)
dry-logic (1.2.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.9, >= 0.9)
zeitwerk (~> 2.6)
dry-core (~> 0.5, >= 0.5)
dry-monads (1.4.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.7)
dry-schema (1.11.3)
dry-schema (1.6.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.16, >= 0.16)
dry-core (~> 0.9, >= 0.9)
dry-configurable (~> 0.8, >= 0.8.3)
dry-core (~> 0.5, >= 0.5)
dry-initializer (~> 3.0)
dry-logic (~> 1.3)
dry-types (~> 1.6)
zeitwerk (~> 2.6)
dry-logic (~> 1.0)
dry-types (~> 1.5)
dry-struct (1.4.0)
dry-core (~> 0.5, >= 0.5)
dry-types (~> 1.5)
ice_nine (~> 0.11)
dry-types (1.6.1)
dry-types (1.5.1)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
dry-core (~> 0.9, >= 0.9)
dry-core (~> 0.5, >= 0.5)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.3, >= 1.3)
zeitwerk (~> 2.6)
dry-validation (1.9.0)
dry-logic (~> 1.0, >= 1.0.2)
dry-validation (1.6.0)
concurrent-ruby (~> 1.0)
dry-container (~> 0.7, >= 0.7.1)
dry-core (~> 0.9, >= 0.9)
dry-core (~> 0.4)
dry-equalizer (~> 0.2)
dry-initializer (~> 3.0)
dry-schema (~> 1.11, >= 1.11.0)
zeitwerk (~> 2.6)
dry-schema (~> 1.5, >= 1.5.2)
erubi (1.10.0)
ethon (0.15.0)
ffi (>= 1.15.0)
faker (2.18.0)
i18n (>= 1.6, < 2)
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)
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)
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.25.0)
loofah (2.12.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.2)
Expand All @@ -200,20 +194,18 @@ 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)
mutex_m (0.3.0)
net-http (0.9.1)
uri (>= 0.11.1)
nio4r (2.7.5)
racc (~> 1.4)
nio4r (2.5.8)
oj (3.13.9)
ox (2.14.5)
parallel (1.20.1)
Expand All @@ -226,7 +218,7 @@ GEM
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (4.0.6)
racc (1.8.1)
racc (1.6.2)
rack (2.2.3)
rack-protection (2.1.0)
rack
Expand All @@ -247,9 +239,8 @@ GEM
bundler (>= 1.15.0)
railties (= 6.1.4.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
Expand Down Expand Up @@ -293,7 +284,7 @@ GEM
rubocop-ast (1.7.0)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
ruby2_keywords (0.0.4)
set (1.0.2)
sinatra (2.1.0)
mustermann (~> 1.0)
Expand All @@ -317,7 +308,6 @@ 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 @@ -326,7 +316,7 @@ GEM
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
yard (0.9.26)
zeitwerk (2.7.5)
zeitwerk (2.5.1)

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

BUNDLED WITH
2.4.19
2.2.14
8 changes: 2 additions & 6 deletions event_source.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,14 @@ 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', '~> 2.14.1'
spec.add_dependency 'faraday-typhoeus', '~> 1.0'
spec.add_dependency 'faraday-retry', '~> 2.0'
spec.add_dependency 'faraday', '~> 1.4.1'
spec.add_dependency 'faraday_middleware', '~> 1.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'
require 'dry/types/type'
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 }

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


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

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

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

before :each do
stub_request(:post, "https://impl.hub.cms.gov/Imp1/RIDPService")
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'
}
)
.with do |request|
puts request.body.inspect
xml = Nokogiri::XML(request.body)
Expand All @@ -64,7 +70,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.new('test error'))
allow(invalid_payload).to receive(:to_json).and_raise(JSON::GeneratorError)
end

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