weather-mg 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/weather +6 -0
  3. data/lib/weather.rb +17 -0
  4. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34fa0665e993d144133df381dd777e392ff68e81
4
+ data.tar.gz: 66ae899b38b7500d97136315f286bc43f20ad2c9
5
+ SHA512:
6
+ metadata.gz: d1079c9d076c06bf80fe3f732532a432350af2b021865497baad6b03648839820a8f9d66f632c9e28e1eb59c2a1639e12aa264800934737f56b59ab5bbc67749
7
+ data.tar.gz: 74586ca8b4e0a1dd00331da64dcb396bafa934f70de4ff3a8a304ceedd25176cb3584ea39cae38106ce14813f179187ee3ad2ce951a6ce64e560854db640c255
data/bin/weather ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'weather'
4
+
5
+ puts Weather.new.query(ARGV[0])
6
+
data/lib/weather.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+
4
+ class Weather
5
+ def initialize
6
+
7
+ end
8
+
9
+ def query(location)
10
+ "Now in #{location} the weather is: " + openweather_situation(location)['weather'][0]['description']
11
+ end
12
+
13
+ private def openweather_situation(location)
14
+ @situation ||= JSON.load(open("http://api.openweathermap.org/data/2.5/weather?q=#{location}"))
15
+ end
16
+ end
17
+
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: weather-mg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matteo Giaccone
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Weather command line application
14
+ email: matteo.giaccone@acmos.net
15
+ executables:
16
+ - weather
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/weather
21
+ - lib/weather.rb
22
+ homepage: http://rubygems.org/gems/weather-mg
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.2.0
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Weather
46
+ test_files: []
47
+ has_rdoc: