simple_weather 0.0.4 → 0.0.5

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.
Files changed (2) hide show
  1. data/lib/simple_weather.rb +14 -13
  2. metadata +1 -1
@@ -2,23 +2,26 @@ require 'rubygems'
2
2
  require 'json'
3
3
  require 'net/http'
4
4
 
5
- # api key from wunderground: 7b1e71b12f5535c0
6
- module SimpleWeather
5
+ '7b1e71b12f5535c0'
6
+ module SimpleWeather::Weather
7
+
8
+ def self.start_new
9
+ Weather.start_new
10
+ end
11
+
7
12
  class Weather
8
13
  def initialize
9
- @last_update = Time.now
10
14
  @conditions = {}
11
15
  end
12
-
13
- def included(base)
14
- SimpleWeather.configure { |c| nil }
15
- base.extend ClassMethods
16
- base.send :include, InstanceMethods
16
+
17
+ def self.start_new
18
+ w = self.new
19
+ w
17
20
  end
18
21
 
19
22
  def updateWeather(city = 'MD/College Park')
20
23
  base_url = 'http://api.wunderground.com/api/'
21
- api_key = '7b1e71b12f5535c0'
24
+ API_KEY = '7b1e71b12f5535c0'
22
25
  query = '/conditions/q/'
23
26
  format = '.json'
24
27
 
@@ -31,8 +34,8 @@ module SimpleWeather
31
34
  if @conditions.has_key? 'error'
32
35
  raise 'Web service error'
33
36
  end
34
- end
35
-
37
+ end
38
+
36
39
  def getImageUrl
37
40
  @conditions['current_observation']['icon_url']
38
41
  end
@@ -54,5 +57,3 @@ module SimpleWeather
54
57
  end
55
58
  end
56
59
  end
57
-
58
- ActionView::Base.send(:include, SimpleWeather) if defined?(ActionView::Base)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_weather
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: