google-map-weather-intregration 1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/weather_api.rb +53 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 40a2d1cfd32e04d903b11b5f267ef2b8e9a2914a
|
4
|
+
data.tar.gz: a43a20af39fe61ce745175be5afd51f3b31c37ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aeb563df20a9d949a826c8131e083a0cf0f6ca3e205949e6a7761f2f48adc59fd9d575ab5095fb57d48c2e2b4268229619d468bca1b5900fee9f14d94a049f45
|
7
|
+
data.tar.gz: 39168d23ae84173274a271725bc970059af25dba5c45e559a5a5fe6f3c41fdf6472582d4e945abaf86582c4fac131cba800f035100ed00e548b1d4335a4199b2
|
data/lib/weather_api.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
class WeatherApi
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'open-uri'
|
5
|
+
|
6
|
+
def initialize(key, lat, lng)
|
7
|
+
|
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)
|
11
|
+
end
|
12
|
+
|
13
|
+
def response
|
14
|
+
@response
|
15
|
+
end
|
16
|
+
|
17
|
+
def current
|
18
|
+
response['weather']['curren_weather']
|
19
|
+
end
|
20
|
+
|
21
|
+
def forecast
|
22
|
+
response['weather']['forecast']
|
23
|
+
end
|
24
|
+
|
25
|
+
def next_day
|
26
|
+
forecast.last
|
27
|
+
end
|
28
|
+
|
29
|
+
def day_max_temprature
|
30
|
+
"next_day['day_max_temp'] next_day['temp_unit']"
|
31
|
+
end
|
32
|
+
|
33
|
+
def day_type
|
34
|
+
next_day['weather_text']
|
35
|
+
end
|
36
|
+
|
37
|
+
def wind
|
38
|
+
next_day['day'][0]['wind']
|
39
|
+
end
|
40
|
+
|
41
|
+
def wind_direction
|
42
|
+
wind['dir']
|
43
|
+
end
|
44
|
+
|
45
|
+
def wind_degree
|
46
|
+
wind['dir_degree']
|
47
|
+
end
|
48
|
+
|
49
|
+
def wind_speed
|
50
|
+
"#{wind['speed']} #{wind['wind_unit']}"
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: google-map-weather-intregration
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Abhishek Sharma
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Gem to use weather api in google maps.
|
14
|
+
email: abhishek.sharma@medma.in
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/weather_api.rb
|
20
|
+
homepage: https://rubygems.org/gems/google-map-weather-intregration
|
21
|
+
licenses:
|
22
|
+
- NONE
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.3.0
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Hello! This is library to get the weather info from latitude and longitude.
|
44
|
+
test_files: []
|
45
|
+
has_rdoc:
|