yahoo_weatherForecast 0.9.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +44 -0
- data/lib/yahoo_weatherForecast/weather.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a646987232968aecd8dc1c9c8fea2dabc292d79
|
4
|
+
data.tar.gz: c74f3ed6e747709e5cf8b2e5e8c9c67497659626
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e794f2019055d3e4ea53fdf2b9c47b7dadcad429a32cb91072d8a895a29087d7710fd715ccc74ec56c69ca7ee9d85d91839e63c99e1eddb75edf8c24daa898d
|
7
|
+
data.tar.gz: a7504052bad7ab51c11b6eab1859be7833eeff2a22d6036734ffe83f4364b67450e730a6dbb2bcc540131b549c3d67934552a102562154c8c92fc09796b156b6
|
data/README.rdoc
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
=yahoo_weatherForcast
|
2
|
+
a little Ruby Gem for fetching weather's data from Yahoo! Weather API using YQL
|
3
|
+
|
4
|
+
---------------------------
|
5
|
+
|
6
|
+
==How to use?
|
7
|
+
|
8
|
+
first you should make an instance of Weather class:
|
9
|
+
|
10
|
+
#You can initialize this class with name of country & city that you want like example in below
|
11
|
+
YahooWeatherForecast::Weather.new(country: 'iran', city: 'tehran')
|
12
|
+
#or initialize this class with WOEID of location you want like example in below:
|
13
|
+
YahooWeatherForecast::Weather.new(woeid: '2251945')
|
14
|
+
|
15
|
+
both of these initialization ways give you an object that has several method
|
16
|
+
that provide you some useful data:
|
17
|
+
|
18
|
+
#first we initialize Weather class
|
19
|
+
holder = YahooWeatherForecast::Weather.new(country: 'iran', city: 'tehran')
|
20
|
+
|
21
|
+
#this returns a hash about location of object as structure in below:
|
22
|
+
#{"city"=>"Tehran", "country"=>"Iran", "region"=>" Tehran"}
|
23
|
+
holder.getLocation
|
24
|
+
|
25
|
+
#this returns a hash about wind blowing in that location as structure in below:
|
26
|
+
#{"chill"=>"88", "direction"=>"248", "speed"=>"11"}
|
27
|
+
holder.getWind
|
28
|
+
|
29
|
+
#this returns a hash about Atmosphere state in that location as structure in below:
|
30
|
+
#{"humidity"=>"25", "pressure"=>"867.0", "rising"=>"0", "visibility"=>"16.1"}
|
31
|
+
holder.getAtmosphere
|
32
|
+
|
33
|
+
#this returns a hash of sunrise & sunset times in that location as structure in below:
|
34
|
+
#{"sunrise"=>"5:54 am", "sunset"=>"8:24 pm"}
|
35
|
+
holder.getAstronomy
|
36
|
+
|
37
|
+
#this returns Publish Date of this data about that location as structure in below:
|
38
|
+
#"Mon, 04 Jul 2016 11:30 AM IRDT"
|
39
|
+
holder.getPublishDate
|
40
|
+
|
41
|
+
#this returns some general weather's data about that location at a 10 day period
|
42
|
+
#you can give it a day index between 0 to 9 (default day index is 0) and get data as structure in below:
|
43
|
+
#{"code"=>"32", "date"=>"06 Jul 2016", "day"=>"Wed", "high"=>"100", "low"=>"76", "text"=>"Sunny"}
|
44
|
+
holder.getForecast(2)
|
@@ -2,7 +2,7 @@ require 'open-uri'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
module YahooWeatherForecast
|
5
|
-
VERSION = "0.
|
5
|
+
VERSION = "1.0.0"
|
6
6
|
|
7
7
|
class Weather
|
8
8
|
attr_reader :fullData
|
@@ -47,7 +47,7 @@ module YahooWeatherForecast
|
|
47
47
|
if (0..9) === day
|
48
48
|
return fullData['item']['forecast'][day]
|
49
49
|
else
|
50
|
-
return "out of range"
|
50
|
+
return "entered day index is out of range"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yahoo_weatherForecast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amin Hadei
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- Gemfile
|
63
63
|
- LICENSE
|
64
|
+
- README.rdoc
|
64
65
|
- Rakefile
|
65
66
|
- bin/console
|
66
67
|
- bin/setup
|