module Accuweather

Constants

VERSION

Public Class Methods

get_conditions(location_id:, metric: false) click to toggle source
# File lib/accuweather.rb, line 32
def self.get_conditions(location_id:, metric: false)
  metric_value = metric ? '1' : '0'
  response = Net::HTTP.get('samsungmobile.accu-weather.com',
                           "/widget/samsungmobile/weather-data.asp?metric=#{metric_value}&location=#{location_id}")

  Accuweather::Conditions::Parser.new(response)
rescue StandardError => e
  raise Accuweather::Error.new("#{e.class}: #{e.message}")
end