buoy_data 1.0.0.beta.3 → 1.0.0.beta.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'jeweler'
4
+
5
+ # Specify your gem's dependencies in buoy_data.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ buoy_data (1.0.0.beta.5)
5
+ buoy_data
6
+ httparty
7
+ jeweler
8
+ json
9
+ nokogiri
10
+
11
+ GEM
12
+ remote: http://rubygems.org/
13
+ specs:
14
+ crack (0.1.8)
15
+ diff-lcs (1.1.2)
16
+ git (1.2.5)
17
+ httparty (0.7.8)
18
+ crack (= 0.1.8)
19
+ jeweler (1.6.4)
20
+ bundler (~> 1.0)
21
+ git (>= 1.2.5)
22
+ rake
23
+ json (1.5.3)
24
+ nokogiri (1.5.0)
25
+ rake (0.9.2)
26
+ rspec (2.6.0)
27
+ rspec-core (~> 2.6.0)
28
+ rspec-expectations (~> 2.6.0)
29
+ rspec-mocks (~> 2.6.0)
30
+ rspec-core (2.6.3)
31
+ rspec-expectations (2.6.0)
32
+ diff-lcs (~> 1.1.2)
33
+ rspec-mocks (2.6.0)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ buoy_data!
40
+ jeweler
41
+ rspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.beta.3
1
+ 1.0.0.beta.6
data/buoy_data.gemspec CHANGED
@@ -1,75 +1,79 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{buoy_data}
8
- s.version = "1.0.0.beta.3"
8
+ s.version = "1.0.0.beta.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Adam Weller"]
12
- s.date = %q{2011-05-12}
12
+ s.date = %q{2011-07-10}
13
13
  s.description = %q{The goal of this gem is to provide marine buoy data from a variety of sources}
14
14
  s.email = %q{minch@trazzler.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.markdown"
17
+ "README.markdown"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.markdown",
24
- "Rakefile",
25
- "VERSION",
26
- "buoy_data.gemspec",
27
- "lib/buoy_data.rb",
28
- "lib/buoy_data/buoy_list.rb",
29
- "lib/buoy_data/buoy_reading.rb",
30
- "lib/buoy_data/field_map.rb",
31
- "lib/buoy_data/noaa.rb",
32
- "lib/buoy_data/noaa_buoy_forecast.rb",
33
- "lib/buoy_data/noaa_buoy_list.rb",
34
- "lib/buoy_data/noaa_buoy_observation.rb",
35
- "lib/buoy_data/noaa_buoy_reading.rb",
36
- "lib/buoy_data/noaa_field_map.rb",
37
- "lib/buoy_data/noaa_station.rb",
38
- "spec/noaa_buoy_forecast_spec.rb",
39
- "spec/noaa_buoy_list_spec.rb",
40
- "spec/noaa_buoy_observation_spec.rb",
41
- "spec/noaa_station_spec.rb",
42
- "spec/spec_helper.rb"
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE",
24
+ "README.markdown",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "buoy_data.gemspec",
28
+ "lib/buoy_data.rb",
29
+ "lib/buoy_data/buoy_list.rb",
30
+ "lib/buoy_data/buoy_reading.rb",
31
+ "lib/buoy_data/field_map.rb",
32
+ "lib/buoy_data/noaa.rb",
33
+ "lib/buoy_data/noaa_buoy_forecast.rb",
34
+ "lib/buoy_data/noaa_buoy_list.rb",
35
+ "lib/buoy_data/noaa_buoy_observation.rb",
36
+ "lib/buoy_data/noaa_buoy_reading.rb",
37
+ "lib/buoy_data/noaa_field_map.rb",
38
+ "lib/buoy_data/noaa_station.rb",
39
+ "spec/noaa_buoy_forecast_spec.rb",
40
+ "spec/noaa_buoy_list_spec.rb",
41
+ "spec/noaa_buoy_observation_spec.rb",
42
+ "spec/noaa_station_spec.rb",
43
+ "spec/spec_helper.rb"
43
44
  ]
44
45
  s.homepage = %q{http://github.com/minch/buoy_data}
45
- s.rdoc_options = ["--charset=UTF-8"]
46
46
  s.require_paths = ["lib"]
47
- s.rubygems_version = %q{1.3.7}
47
+ s.rubygems_version = %q{1.6.2}
48
48
  s.summary = %q{Fetch marine buoy data from various sources}
49
- s.test_files = [
50
- "spec/noaa_buoy_forecast_spec.rb",
51
- "spec/noaa_buoy_list_spec.rb",
52
- "spec/noaa_buoy_observation_spec.rb",
53
- "spec/noaa_station_spec.rb",
54
- "spec/spec_helper.rb"
55
- ]
56
49
 
57
50
  if s.respond_to? :specification_version then
58
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
59
51
  s.specification_version = 3
60
52
 
61
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
55
+ s.add_runtime_dependency(%q<buoy_data>, [">= 0"])
56
+ s.add_development_dependency(%q<rspec>, [">= 0"])
57
+ s.add_development_dependency(%q<rspec>, [">= 0"])
62
58
  s.add_development_dependency(%q<rspec>, [">= 0"])
63
59
  s.add_runtime_dependency(%q<httparty>, [">= 0"])
64
60
  s.add_runtime_dependency(%q<json>, [">= 0"])
65
61
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
66
62
  else
63
+ s.add_dependency(%q<jeweler>, [">= 0"])
64
+ s.add_dependency(%q<buoy_data>, [">= 0"])
65
+ s.add_dependency(%q<rspec>, [">= 0"])
66
+ s.add_dependency(%q<rspec>, [">= 0"])
67
67
  s.add_dependency(%q<rspec>, [">= 0"])
68
68
  s.add_dependency(%q<httparty>, [">= 0"])
69
69
  s.add_dependency(%q<json>, [">= 0"])
70
70
  s.add_dependency(%q<nokogiri>, [">= 0"])
71
71
  end
72
72
  else
73
+ s.add_dependency(%q<jeweler>, [">= 0"])
74
+ s.add_dependency(%q<buoy_data>, [">= 0"])
75
+ s.add_dependency(%q<rspec>, [">= 0"])
76
+ s.add_dependency(%q<rspec>, [">= 0"])
73
77
  s.add_dependency(%q<rspec>, [">= 0"])
74
78
  s.add_dependency(%q<httparty>, [">= 0"])
75
79
  s.add_dependency(%q<json>, [">= 0"])
@@ -3,7 +3,14 @@ module BuoyData
3
3
  require 'nokogiri'
4
4
 
5
5
  class BuoyList
6
- def get(limit = 0)
6
+ def get(options = {})
7
+ default_options = {
8
+ :limit => 0,
9
+ :id => nil,
10
+ :verbose => true
11
+ }
12
+ options = default_options.merge options
13
+
7
14
  stats = {
8
15
  :stations => [],
9
16
  :station_count => 0,
@@ -13,13 +20,15 @@ module BuoyData
13
20
  @doc = doc
14
21
  @station_list = stations doc
15
22
 
16
- # Only relevant for testing
17
- @station_list = @station_list[0..limit] if limit > 0
23
+ # Probably only relevant for testing
24
+ @station_list = @station_list[0..options[:limit]-1] if options[:limit] > 0
25
+ @station_list = [ url_by_id(options[:id]) ] if options[:id]
18
26
 
19
27
  @station_list.each do |station_url|
20
28
  #p station_url
21
29
 
22
30
  #begin
31
+ puts "scraping --> #{station_url}" if options[:verbose]
23
32
  h = scrape_station(station_url)
24
33
  stats[:stations].push h
25
34
  stats[:station_count] += 1
@@ -32,10 +41,8 @@ module BuoyData
32
41
  stats
33
42
  end
34
43
 
35
- def url
36
- end
37
-
38
- def base_url
44
+ def url_by_id(id)
45
+ "station_page.php?station=#{id}"
39
46
  end
40
47
 
41
48
  def doc
@@ -133,7 +133,11 @@ module BuoyData
133
133
  # E.g., there are two model runs for the northern atlantic:
134
134
  #"http://polar.ncep.noaa.gov/waves/latest_run/nah.#{buoy_id}.bull"
135
135
 
136
- "http://polar.ncep.noaa.gov/waves/latest_run/wna.#{buoy_id}.bull"
136
+ #
137
+ #"http://polar.ncep.noaa.gov/waves/latest_run/wna.#{buoy_id}.bull"
138
+ #
139
+
140
+ "http://polar.ncep.noaa.gov/waves/WEB_P/multi_1.latest_run/plots/multi_1.#{buoy_id}.bull"
137
141
  end
138
142
 
139
143
  # The header is the first 7 lines
metadata CHANGED
@@ -1,14 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buoy_data
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
5
- segments:
6
- - 1
7
- - 0
8
- - 0
9
- - beta
10
- - 3
11
- version: 1.0.0.beta.3
4
+ prerelease: 6
5
+ version: 1.0.0.beta.6
12
6
  platform: ruby
13
7
  authors:
14
8
  - Adam Weller
@@ -16,61 +10,97 @@ autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
12
 
19
- date: 2011-05-12 00:00:00 -04:00
13
+ date: 2011-07-10 00:00:00 -04:00
20
14
  default_executable:
21
15
  dependencies:
22
16
  - !ruby/object:Gem::Dependency
23
- name: rspec
24
- prerelease: false
17
+ name: jeweler
25
18
  requirement: &id001 !ruby/object:Gem::Requirement
26
19
  none: false
27
20
  requirements:
28
21
  - - ">="
29
22
  - !ruby/object:Gem::Version
30
- segments:
31
- - 0
32
23
  version: "0"
33
- type: :development
24
+ type: :runtime
25
+ prerelease: false
34
26
  version_requirements: *id001
35
27
  - !ruby/object:Gem::Dependency
36
- name: httparty
37
- prerelease: false
28
+ name: buoy_data
38
29
  requirement: &id002 !ruby/object:Gem::Requirement
39
30
  none: false
40
31
  requirements:
41
32
  - - ">="
42
33
  - !ruby/object:Gem::Version
43
- segments:
44
- - 0
45
34
  version: "0"
46
35
  type: :runtime
36
+ prerelease: false
47
37
  version_requirements: *id002
48
38
  - !ruby/object:Gem::Dependency
49
- name: json
50
- prerelease: false
39
+ name: rspec
51
40
  requirement: &id003 !ruby/object:Gem::Requirement
52
41
  none: false
53
42
  requirements:
54
43
  - - ">="
55
44
  - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
45
  version: "0"
59
- type: :runtime
46
+ type: :development
47
+ prerelease: false
60
48
  version_requirements: *id003
61
49
  - !ruby/object:Gem::Dependency
62
- name: nokogiri
63
- prerelease: false
50
+ name: rspec
64
51
  requirement: &id004 !ruby/object:Gem::Requirement
65
52
  none: false
66
53
  requirements:
67
54
  - - ">="
68
55
  - !ruby/object:Gem::Version
69
- segments:
70
- - 0
71
56
  version: "0"
72
- type: :runtime
57
+ type: :development
58
+ prerelease: false
73
59
  version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: rspec
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: httparty
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
+ name: json
84
+ requirement: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
94
+ name: nokogiri
95
+ requirement: &id008 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ type: :runtime
102
+ prerelease: false
103
+ version_requirements: *id008
74
104
  description: The goal of this gem is to provide marine buoy data from a variety of sources
75
105
  email: minch@trazzler.com
76
106
  executables: []
@@ -82,7 +112,8 @@ extra_rdoc_files:
82
112
  - README.markdown
83
113
  files:
84
114
  - .document
85
- - .gitignore
115
+ - Gemfile
116
+ - Gemfile.lock
86
117
  - LICENSE
87
118
  - README.markdown
88
119
  - Rakefile
@@ -109,8 +140,8 @@ homepage: http://github.com/minch/buoy_data
109
140
  licenses: []
110
141
 
111
142
  post_install_message:
112
- rdoc_options:
113
- - --charset=UTF-8
143
+ rdoc_options: []
144
+
114
145
  require_paths:
115
146
  - lib
116
147
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -118,29 +149,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
149
  requirements:
119
150
  - - ">="
120
151
  - !ruby/object:Gem::Version
121
- segments:
122
- - 0
123
152
  version: "0"
124
153
  required_rubygems_version: !ruby/object:Gem::Requirement
125
154
  none: false
126
155
  requirements:
127
156
  - - ">"
128
157
  - !ruby/object:Gem::Version
129
- segments:
130
- - 1
131
- - 3
132
- - 1
133
158
  version: 1.3.1
134
159
  requirements: []
135
160
 
136
161
  rubyforge_project:
137
- rubygems_version: 1.3.7
162
+ rubygems_version: 1.6.2
138
163
  signing_key:
139
164
  specification_version: 3
140
165
  summary: Fetch marine buoy data from various sources
141
- test_files:
142
- - spec/noaa_buoy_forecast_spec.rb
143
- - spec/noaa_buoy_list_spec.rb
144
- - spec/noaa_buoy_observation_spec.rb
145
- - spec/noaa_station_spec.rb
146
- - spec/spec_helper.rb
166
+ test_files: []
167
+
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC