Skip to content

Conversation

@RemoteCTO
Copy link
Owner

No description provided.

io-endpoint (0.14.0)
io-event (1.7.3)
io-stream (0.6.1)
json (2.5.1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an older version of the json gem (2.5.1). More recent versions include security fixes and performance improvements. Should upgrade to latest stable version.

options[:debug_output] = $stdout if @debug

response = self.class.get @base_url, options
response = Sync do
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code uses 'Sync' which appears to be undefined. For async/await pattern in Ruby, it should be 'Async' (capital A) instead of 'Sync'. This is a common class provided by the async gem.


def with_fetch(params = {})
options = { headers: { 'User-Agent' => @user_agent } }
options[:query] = params if params&.any?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The safe navigation operator (&.) with any? could cause issues if params is not nil but also not a collection that responds to any?. Should check if params is a Hash first or use params.is_a?(Hash) && !params.empty?

response = self.class.get @base_url, options
response = Sync do
internet = Async::HTTP::Internet.new
internet.get @base_url, options
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Async::HTTP::Internet#get method expects headers to be passed directly, not nested in an options hash. The correct format should be internet.get(@base_url, headers: { 'User-Agent' => @user_agent })

spec.add_dependency 'async-http'

# Dev dependencies
spec.add_development_dependency 'simplecov', '< 0.18'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an upper bound version constraint ('< 0.18') without a lower bound can be problematic. It's better to specify a range with both lower and upper bounds (e.g. '>= 0.17.1, < 0.18') to ensure compatibility.


# Prod dependencies
spec.add_dependency 'httparty', '~> 0.18.1'
spec.add_dependency 'async-http'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency is specified without a version constraint. This can lead to compatibility issues if breaking changes are introduced in future versions. It's recommended to specify version constraints for all dependencies (e.g. '~> 1.0').

@RemoteCTO RemoteCTO closed this Jan 7, 2025
@RemoteCTO RemoteCTO deleted the httparty_to_async branch January 7, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants