Skip to content

Commit

Permalink
[#6] Rename validate_result in valid_result?
Browse files Browse the repository at this point in the history
  • Loading branch information
malparty committed Jun 22, 2021
1 parent 7b60882 commit e59f520
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/services/google/client_service.rb
Expand Up @@ -15,7 +15,7 @@ def initialize(keyword:, lang: 'en')
def call
result = HTTParty.get(@uri, { headers: { 'User-Agent' => USER_AGENT } })

return false unless validate_result result
return false unless valid_result? result

result
rescue HTTParty::Error, Timeout::Error, SocketError => e
Expand All @@ -29,7 +29,7 @@ def call
# Inspect Http response status code
# Any non 200 response code will be logged
# response is set to nil in order to notify the error
def validate_result(result)
def valid_result?(result)
return result if result&.response&.code == '200'

Rails.logger.warn "Warning: Query Google with '#{@escaped_keyword}' return status code #{result.response.code}"
Expand Down

0 comments on commit e59f520

Please sign in to comment.