federal_register 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{federal_register}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Carpenter"]
12
- s.date = %q{2011-08-15}
12
+ s.date = %q{2011-08-17}
13
13
  s.description = %q{Ruby API Client for FederalRegister.gov that handles searching articles and getting information about agencies}
14
14
  s.email = %q{andrew@criticaljuncture.org}
15
15
  s.extra_rdoc_files = [
@@ -41,14 +41,13 @@ Gem::Specification.new do |s|
41
41
  s.homepage = %q{http://github.com/criticaljuncture/federal_register}
42
42
  s.licenses = ["MIT"]
43
43
  s.require_paths = ["lib"]
44
- s.rubygems_version = %q{1.3.6}
44
+ s.rubygems_version = %q{1.5.2}
45
45
  s.summary = %q{Ruby API Client for FederalRegister.gov}
46
46
 
47
47
  if s.respond_to? :specification_version then
48
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
48
  s.specification_version = 3
50
49
 
51
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
51
  s.add_runtime_dependency(%q<httparty>, [">= 0.7.0"])
53
52
  s.add_development_dependency(%q<shoulda>, [">= 0"])
54
53
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -21,7 +21,7 @@ class FederalRegister::Article < FederalRegister::Base
21
21
  :volume,
22
22
  :docket_id,
23
23
  :regulation_id_numbers,
24
- :cfr_refernces,
24
+ :cfr_references,
25
25
  :json_url
26
26
  ]
27
27
 
@@ -1,4 +1,6 @@
1
1
  class FederalRegister::ResultSet < FederalRegister::Client
2
+ include Enumerable
3
+
2
4
  attr_reader :count, :total_pages, :results, :errors
3
5
 
4
6
  def initialize(attributes, result_class)
@@ -25,4 +27,8 @@ class FederalRegister::ResultSet < FederalRegister::Client
25
27
  response = get(url, options)
26
28
  new(response, result_class)
27
29
  end
30
+
31
+ def each
32
+ @results.each {|result| yield result }
33
+ end
28
34
  end
@@ -7,4 +7,47 @@ describe FederalRegister::ResultSet do
7
7
  FederalRegister::ResultSet.new({'next_page_url' => 'http://www.federalregister.gov/api/v1/fishes?page=2'}, FederalRegister::Article).next.count.should == 24
8
8
  end
9
9
  end
10
+
11
+ describe "enumerability" do
12
+ it "responds to #each" do
13
+ FederalRegister::ResultSet.new({}, FederalRegister::Article).should respond_to(:each)
14
+ end
15
+
16
+ it "includes Enumerable" do
17
+ FederalRegister::ResultSet.should include(Enumerable)
18
+ end
19
+
20
+ context "given an empty result set" do
21
+ it "never invokes the block" do
22
+ results = FederalRegister::ResultSet.new({}, FederalRegister::Article)
23
+ lambda {
24
+ results.each {|i| fail i }
25
+ }.should_not raise_error
26
+ end
27
+ end
28
+
29
+ context "given a non-empty result set" do
30
+ before(:each) do
31
+ @results = FederalRegister::ResultSet.new({'results' => [
32
+ {'panda' => 'bamboo'},
33
+ {'curry' => 'noodle'},
34
+ {'soup' => 'tree'}
35
+ ]}, FederalRegister::Article)
36
+ end
37
+
38
+ it "doesn't yields nil to a block" do
39
+ @results.each do |result|
40
+ result.should_not be_nil
41
+ end
42
+ end
43
+
44
+ it "invokes the block once for each result" do
45
+ @results.map {|result| result }.should == @results.results
46
+ end
47
+
48
+ it "yields the proper elements to the block" do
49
+ @results.map {|r| r }.should == @results.results
50
+ end
51
+ end
52
+ end
10
53
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: federal_register
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 23
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
- - 1
8
+ - 2
8
9
  - 0
9
- version: 0.1.0
10
+ version: 0.2.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Andrew Carpenter
@@ -14,127 +15,145 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-08-15 00:00:00 -07:00
18
+ date: 2011-08-17 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- prerelease: false
22
22
  type: :runtime
23
- name: httparty
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
+ hash: 3
28
29
  segments:
29
30
  - 0
30
31
  - 7
31
32
  - 0
32
33
  version: 0.7.0
33
- requirement: *id001
34
- - !ruby/object:Gem::Dependency
34
+ name: httparty
35
+ version_requirements: *id001
35
36
  prerelease: false
37
+ - !ruby/object:Gem::Dependency
36
38
  type: :development
37
- name: shoulda
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
39
41
  requirements:
40
42
  - - ">="
41
43
  - !ruby/object:Gem::Version
44
+ hash: 3
42
45
  segments:
43
46
  - 0
44
47
  version: "0"
45
- requirement: *id002
46
- - !ruby/object:Gem::Dependency
48
+ name: shoulda
49
+ version_requirements: *id002
47
50
  prerelease: false
51
+ - !ruby/object:Gem::Dependency
48
52
  type: :development
49
- name: bundler
50
- version_requirements: &id003 !ruby/object:Gem::Requirement
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
51
55
  requirements:
52
56
  - - ~>
53
57
  - !ruby/object:Gem::Version
58
+ hash: 23
54
59
  segments:
55
60
  - 1
56
61
  - 0
57
62
  - 0
58
63
  version: 1.0.0
59
- requirement: *id003
60
- - !ruby/object:Gem::Dependency
64
+ name: bundler
65
+ version_requirements: *id003
61
66
  prerelease: false
67
+ - !ruby/object:Gem::Dependency
62
68
  type: :development
63
- name: jeweler
64
- version_requirements: &id004 !ruby/object:Gem::Requirement
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
65
71
  requirements:
66
72
  - - ~>
67
73
  - !ruby/object:Gem::Version
74
+ hash: 15
68
75
  segments:
69
76
  - 1
70
77
  - 6
71
78
  - 0
72
79
  version: 1.6.0
73
- requirement: *id004
74
- - !ruby/object:Gem::Dependency
80
+ name: jeweler
81
+ version_requirements: *id004
75
82
  prerelease: false
83
+ - !ruby/object:Gem::Dependency
76
84
  type: :development
77
- name: rcov
78
- version_requirements: &id005 !ruby/object:Gem::Requirement
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
79
87
  requirements:
80
88
  - - ">="
81
89
  - !ruby/object:Gem::Version
90
+ hash: 3
82
91
  segments:
83
92
  - 0
84
93
  version: "0"
85
- requirement: *id005
86
- - !ruby/object:Gem::Dependency
94
+ name: rcov
95
+ version_requirements: *id005
87
96
  prerelease: false
97
+ - !ruby/object:Gem::Dependency
88
98
  type: :development
89
- name: rspec
90
- version_requirements: &id006 !ruby/object:Gem::Requirement
99
+ requirement: &id006 !ruby/object:Gem::Requirement
100
+ none: false
91
101
  requirements:
92
102
  - - ~>
93
103
  - !ruby/object:Gem::Version
104
+ hash: 15
94
105
  segments:
95
106
  - 2
96
107
  - 6
97
108
  version: "2.6"
98
- requirement: *id006
99
- - !ruby/object:Gem::Dependency
109
+ name: rspec
110
+ version_requirements: *id006
100
111
  prerelease: false
112
+ - !ruby/object:Gem::Dependency
101
113
  type: :development
102
- name: rspec
103
- version_requirements: &id007 !ruby/object:Gem::Requirement
114
+ requirement: &id007 !ruby/object:Gem::Requirement
115
+ none: false
104
116
  requirements:
105
117
  - - ~>
106
118
  - !ruby/object:Gem::Version
119
+ hash: 15
107
120
  segments:
108
121
  - 2
109
122
  - 6
110
123
  version: "2.6"
111
- requirement: *id007
112
- - !ruby/object:Gem::Dependency
124
+ name: rspec
125
+ version_requirements: *id007
113
126
  prerelease: false
127
+ - !ruby/object:Gem::Dependency
114
128
  type: :development
115
- name: activesupport
116
- version_requirements: &id008 !ruby/object:Gem::Requirement
129
+ requirement: &id008 !ruby/object:Gem::Requirement
130
+ none: false
117
131
  requirements:
118
132
  - - ~>
119
133
  - !ruby/object:Gem::Version
134
+ hash: 5
120
135
  segments:
121
136
  - 3
122
137
  version: "3"
123
- requirement: *id008
124
- - !ruby/object:Gem::Dependency
138
+ name: activesupport
139
+ version_requirements: *id008
125
140
  prerelease: false
141
+ - !ruby/object:Gem::Dependency
126
142
  type: :development
127
- name: fakeweb
128
- version_requirements: &id009 !ruby/object:Gem::Requirement
143
+ requirement: &id009 !ruby/object:Gem::Requirement
144
+ none: false
129
145
  requirements:
130
146
  - - ~>
131
147
  - !ruby/object:Gem::Version
148
+ hash: 27
132
149
  segments:
133
150
  - 1
134
151
  - 3
135
152
  - 0
136
153
  version: 1.3.0
137
- requirement: *id009
154
+ name: fakeweb
155
+ version_requirements: *id009
156
+ prerelease: false
138
157
  description: Ruby API Client for FederalRegister.gov that handles searching articles and getting information about agencies
139
158
  email: andrew@criticaljuncture.org
140
159
  executables: []
@@ -175,23 +194,27 @@ rdoc_options: []
175
194
  require_paths:
176
195
  - lib
177
196
  required_ruby_version: !ruby/object:Gem::Requirement
197
+ none: false
178
198
  requirements:
179
199
  - - ">="
180
200
  - !ruby/object:Gem::Version
201
+ hash: 3
181
202
  segments:
182
203
  - 0
183
204
  version: "0"
184
205
  required_rubygems_version: !ruby/object:Gem::Requirement
206
+ none: false
185
207
  requirements:
186
208
  - - ">="
187
209
  - !ruby/object:Gem::Version
210
+ hash: 3
188
211
  segments:
189
212
  - 0
190
213
  version: "0"
191
214
  requirements: []
192
215
 
193
216
  rubyforge_project:
194
- rubygems_version: 1.3.6
217
+ rubygems_version: 1.5.2
195
218
  signing_key:
196
219
  specification_version: 3
197
220
  summary: Ruby API Client for FederalRegister.gov