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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weather_api.rb +8 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40a2d1cfd32e04d903b11b5f267ef2b8e9a2914a
4
- data.tar.gz: a43a20af39fe61ce745175be5afd51f3b31c37ff
3
+ metadata.gz: 19d9ae435a81612aca4be8e7d6c10745f02b37db
4
+ data.tar.gz: f68d379457ffb5c0002aacbdfe0fb0252b2450ce
5
5
  SHA512:
6
- metadata.gz: aeb563df20a9d949a826c8131e083a0cf0f6ca3e205949e6a7761f2f48adc59fd9d575ab5095fb57d48c2e2b4268229619d468bca1b5900fee9f14d94a049f45
7
- data.tar.gz: 39168d23ae84173274a271725bc970059af25dba5c45e559a5a5fe6f3c41fdf6472582d4e945abaf86582c4fac131cba800f035100ed00e548b1d4335a4199b2
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=#{@lat},#{@lng}")
10
- @response = JSON.parse(open(uri).read)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-map-weather-intregration
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhishek Sharma