Skip to content

Commit

Permalink
Update locations where Dry::Monads structure has changed (#133)
Browse files Browse the repository at this point in the history
Success and Failure are now part of `Dry::Monads::Result`
  • Loading branch information
geeosh authored Nov 20, 2023
1 parent 250c522 commit d7f226c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/uploadcare/client/conversion/base_conversion_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def extract_result(response_body)

parsed_body = JSON.parse(response_body, symbolize_names: true)
errors = parsed_body[:error] || parsed_body[:problems]
return Dry::Monads::Failure(errors) unless errors.nil? || errors.empty?
return Dry::Monads::Result::Failure.call(errors) unless errors.nil? || errors.empty?

Dry::Monads::Success(parsed_body)
Dry::Monads::Result::Success.call(parsed_body)
end

# Prepares body for convert_many method
Expand Down
2 changes: 1 addition & 1 deletion lib/uploadcare/client/rest_group_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def store(uuid)
end
end

Dry::Monads::Success(nil)
Dry::Monads::Result::Success.call(nil)
end

# Get a file group by its ID.
Expand Down
2 changes: 1 addition & 1 deletion lib/uploadcare/client/uploader_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def upload_from_url(url, options = {})
uploaded_response = poll_upload_response(token_response.success[:token])
return uploaded_response if uploaded_response.success[:status] == 'error'

Dry::Monads::Success(files: [uploaded_response.success])
Dry::Monads::Result::Success.call(files: [uploaded_response.success])
end

# Check upload status
Expand Down

0 comments on commit d7f226c

Please sign in to comment.