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

FI-2330: Change store_request to use keyword params #414

Merged
merged 1 commit into from
Dec 5, 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: 3 additions & 3 deletions lib/inferno/dsl/fhir_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def fhir_search(
# @param tags [Array<String>] a list of tags to assign to the request
# @return [Inferno::Entities::Request]
def fhir_delete(resource_type, id, client: :default, name: nil, tags: [])
store_request('outgoing', name, tags) do
store_request('outgoing', name:, tags:) do
tcp_exception_handler do
fhir_client(client).destroy(fhir_class_from_resource_type(resource_type), id)
end
Expand All @@ -319,7 +319,7 @@ def fhir_delete(resource_type, id, client: :default, name: nil, tags: [])
# @param tags [Array<String>] a list of tags to assign to the request
# @return [Inferno::Entities::Request]
def fhir_transaction(bundle = nil, client: :default, name: nil, tags: [])
store_request('outgoing', name, tags) do
store_request('outgoing', name:, tags:) do
tcp_exception_handler do
fhir_client(client).transaction_bundle = bundle if bundle.present?
fhir_client(client).end_transaction
Expand All @@ -339,7 +339,7 @@ def fhir_class_from_resource_type(resource_type)
# request methods don't have to be wrapped twice.
# @private
def store_request_and_refresh_token(client, name, tags, &block)
store_request('outgoing', name, tags) do
store_request('outgoing', name:, tags:) do
perform_refresh(client) if client.need_to_refresh? && client.able_to_refresh?
block.call
end
Expand Down
8 changes: 4 additions & 4 deletions lib/inferno/dsl/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def http_clients
# @param tags [Array<String>] a list of tags to assign to the request
# @return [Inferno::Entities::Request]
def get(url = '', client: :default, name: nil, headers: nil, tags: [])
store_request('outgoing', name, tags) do
store_request('outgoing', name:, tags:) do
tcp_exception_handler do
client = http_client(client)

Expand Down Expand Up @@ -107,7 +107,7 @@ def connection
# @param tags [Array<String>] a list of tags to assign to the request
# @return [Inferno::Entities::Request]
def post(url = '', body: nil, client: :default, name: nil, headers: nil, tags: [])
store_request('outgoing', name, tags) do
store_request('outgoing', name:, tags:) do
tcp_exception_handler do
client = http_client(client)

Expand All @@ -134,7 +134,7 @@ def post(url = '', body: nil, client: :default, name: nil, headers: nil, tags: [
# @param tags [Array<String>] a list of tags to assign to the request
# @return [Inferno::Entities::Request]
def delete(url = '', client: :default, name: :nil, headers: nil, tags: [])
store_request('outgoing', name, tags) do
store_request('outgoing', name:, tags:) do
tcp_exception_handler do
client = http_client(client)

Expand Down Expand Up @@ -173,7 +173,7 @@ def stream(block, url = '', limit = 100, client: :default, name: nil, headers: n
block.call(chunk, bytes)
end

store_request('outgoing', name, tags) do
store_request('outgoing', name:, tags:) do
tcp_exception_handler do
client = http_client(client)

Expand Down
2 changes: 1 addition & 1 deletion lib/inferno/dsl/request_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def named_request(name)
end

# @private
def store_request(direction, name, tags, &block)
def store_request(direction, name: nil, tags: [], &block)
response = block.call

name = self.class.config.request_name(name)
Expand Down
Loading