google-map-weather-intregration 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/weather_api.rb +8 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19d9ae435a81612aca4be8e7d6c10745f02b37db
|
4
|
+
data.tar.gz: f68d379457ffb5c0002aacbdfe0fb0252b2450ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9cda7c7b78bdd67767efce129dd3cf79179d084e9d4daa67bb735d377352a70d673e5f25a5ac002a577f941829d3287429ecd52092fcf9f8a058658170a1878
|
7
|
+
data.tar.gz: 3c8f7a21db50db6265043ab7d7b57340cf650b587669d7606ffed572e0f3c09ca641e0b358755fa31a8ea45ca4f6005247d725358b13ac432c55159d0cacd733
|
data/lib/weather_api.rb
CHANGED
@@ -2,12 +2,17 @@ class WeatherApi
|
|
2
2
|
|
3
3
|
require 'nokogiri'
|
4
4
|
require 'open-uri'
|
5
|
-
|
5
|
+
require 'json'
|
6
6
|
def initialize(key, lat, lng)
|
7
7
|
|
8
8
|
url = 'http://www.myweather2.com/developer/forecast.ashx?output=json'
|
9
|
-
uri = URI.parse(url+"&uac=#{key}&query=#{
|
10
|
-
|
9
|
+
uri = URI.parse(url+"&uac=#{key}&query=#{lat},#{lng}")
|
10
|
+
result = open(uri).read
|
11
|
+
unless result == "Unable to find any matching weather location to the query submitted!"
|
12
|
+
@response = JSON.parse(result)
|
13
|
+
else
|
14
|
+
puts "Invalid Location"
|
15
|
+
end
|
11
16
|
end
|
12
17
|
|
13
18
|
def response
|