Skip to content

Conversation

FrankCRoth
Copy link

Please let me know if you need additional changes. Thx.

http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
keys = JSON.parse(response.body)['keys']
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is duplicated. I think that it's better to create a private function like this:

def make_get_request(url)
  uri = URI(url)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  request = Net::HTTP::Get.new(uri.request_uri)
  response = http.request(request)
  JSON.parse(response.body)
end

rescue => error
Rails.logger.info(error) if defined? Rails
end

Copy link
Contributor

Choose a reason for hiding this comment

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

Restore this line please. We always put empty line before and after a block.

uri = URI.parse(config_uri)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that you can pass uri directly: request = Net::HTTP::Get.new(uri)

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