Skip to content

Commit

Permalink
[BUGFIX] Surfline wasn't accepting false for get_all_spots
Browse files Browse the repository at this point in the history
  • Loading branch information
swrobel committed Jan 15, 2018
1 parent 62412dd commit 46db04e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/forecast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def parse_response(spot, request, responses)
end

def api_pull(spot, get_all_spots = nil)
api_url = get_all_spots.present? ? api_url(spot, get_all_spots) : api_url(spot)
api_url = get_all_spots.nil? ? api_url(spot) : api_url(spot, get_all_spots)
return false unless (result = api_get(api_url))
parse_response(spot, result.request, result.response)
true
Expand Down
2 changes: 1 addition & 1 deletion lib/api_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module ApiMethods
def api_get(url)
response = JSON.parse(open(url).read, object_class: OpenStruct)
response = JSON.parse(open(url, "User-Agent" => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0.2 Safari/604.4.7').read, object_class: OpenStruct)
request = ApiRequest.create(request: url, response: response, success: true)
return OpenStruct.new(request: request, response: response)
rescue OpenURI::HTTPError => e
Expand Down

0 comments on commit 46db04e

Please sign in to comment.