Module: Accuweather
- Defined in:
- lib/accuweather.rb,
lib/accuweather/version.rb,
lib/accuweather/location/city.rb,
lib/accuweather/location/parser.rb,
lib/accuweather/conditions/local.rb,
lib/accuweather/conditions/units.rb,
lib/accuweather/conditions/parser.rb,
lib/accuweather/conditions/current.rb
Defined Under Namespace
Modules: Conditions, Location
Constant Summary
collapse
- VERSION =
'0.1.3'
Class Method Summary
collapse
Class Method Details
.city_search(name:) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/accuweather.rb', line 13
def self.city_search(name:)
response = Net::HTTP.get('samsungmobile.accu-weather.com',
"/widget/samsungmobile/city-find.asp?returnGeoPosition=1&location=#{name}")
Accuweather::Location::Parser.new(response).cities
rescue StandardError
[]
end
|
.get_conditions(location_id:, metric: false) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/accuweather.rb', line 22
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
nil
end
|