weatherbug 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,9 @@ module WeatherBug
16
16
 
17
17
  API_URL = 'datafeed.weatherbug.com'
18
18
 
19
+ Error = Class.new(RuntimeError)
20
+ NoSuchStation = Class.new(Error)
21
+
19
22
  # Set your application's partner ID
20
23
  def self.partner_id=(partner_id)
21
24
  @partner_id = partner_id
@@ -125,7 +128,7 @@ module WeatherBug
125
128
  params['RequestType'] = method
126
129
  params['PartnerId'] = @partner_id
127
130
  data = open("http://#{API_URL}/GetXml.aspx?#{params.map { |k, v| "#{k}=#{v}" }.join('&')}")
128
- raise Exception.new("Unexpected exception - empty response") unless data
131
+ raise Error.new("Unexpected exception - empty response") unless data
129
132
  Nokogiri::XML(data)
130
133
  end
131
134
 
@@ -20,7 +20,7 @@ module WeatherBug
20
20
 
21
21
  def self.from_document(document)
22
22
  lops = super
23
- raise ArgumentError.new('No such station') if lops.station_id.empty?
23
+ raise NoSuchStation, 'No such station' if lops.station_id.empty?
24
24
  lops
25
25
  end
26
26
 
@@ -16,7 +16,7 @@ module WeatherBug
16
16
 
17
17
  def self.from_document(document)
18
18
  station = super
19
- raise ArgumentError.new('No such station') if station.station_id.empty?
19
+ raise NoSuchStation, 'No such station' if station.station_id.empty?
20
20
  station
21
21
  end
22
22
 
@@ -1,6 +1,6 @@
1
1
  module WeatherBug
2
2
 
3
- VERSION = [0, 0, 9]
3
+ VERSION = [0, 0, 10]
4
4
 
5
5
  def self.version
6
6
  VERSION.join('.')
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weatherbug
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 9
10
- version: 0.0.9
5
+ version: 0.0.10
11
6
  platform: ruby
12
7
  authors:
13
8
  - John Crepezzi
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-04-22 00:00:00 -04:00
13
+ date: 2011-06-19 00:00:00 -04:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,9 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
24
  version: "0"
33
25
  type: :development
34
26
  version_requirements: *id001
@@ -40,9 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
35
  version: "0"
47
36
  type: :runtime
48
37
  version_requirements: *id002
@@ -78,23 +67,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
67
  requirements:
79
68
  - - ">="
80
69
  - !ruby/object:Gem::Version
81
- hash: 3
82
- segments:
83
- - 0
84
70
  version: "0"
85
71
  required_rubygems_version: !ruby/object:Gem::Requirement
86
72
  none: false
87
73
  requirements:
88
74
  - - ">="
89
75
  - !ruby/object:Gem::Version
90
- hash: 3
91
- segments:
92
- - 0
93
76
  version: "0"
94
77
  requirements: []
95
78
 
96
79
  rubyforge_project: weatherbug
97
- rubygems_version: 1.4.1
80
+ rubygems_version: 1.6.2
98
81
  signing_key:
99
82
  specification_version: 3
100
83
  summary: Ruby WeatherBug partner API