futures_pipeline 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/Gemfile +0 -4
- data/README.md +4 -0
- data/Rakefile +2 -0
- data/futures_pipeline.gemspec +13 -12
- data/lib/futures_pipeline/client.rb +13 -0
- data/lib/futures_pipeline/version.rb +1 -1
- data/spec/faraday/response_spec.rb +6 -1
- data/spec/fixtures/search.json +1 -0
- data/spec/futures_pipeline/client_spec.rb +48 -5
- data/spec/helper.rb +41 -0
- metadata +43 -78
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -64,6 +64,10 @@ Submitting a Pull Request
|
|
64
64
|
8. Commit and push your changes.
|
65
65
|
9. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
|
66
66
|
|
67
|
+
Credits
|
68
|
+
-------
|
69
|
+
Futures, Inc. REST API developed by [Tom Harris](https://github.com/tomharris).
|
70
|
+
|
67
71
|
Copyright
|
68
72
|
---------
|
69
73
|
Copyright (c) 2011 Code for America.
|
data/Rakefile
CHANGED
data/futures_pipeline.gemspec
CHANGED
@@ -2,18 +2,19 @@
|
|
2
2
|
require File.expand_path('../lib/futures_pipeline/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.add_development_dependency
|
6
|
-
gem.add_development_dependency
|
7
|
-
gem.add_development_dependency
|
8
|
-
gem.add_development_dependency
|
9
|
-
gem.add_development_dependency
|
10
|
-
|
11
|
-
gem.
|
12
|
-
gem.add_runtime_dependency
|
13
|
-
gem.add_runtime_dependency
|
14
|
-
gem.add_runtime_dependency
|
15
|
-
gem.add_runtime_dependency
|
16
|
-
gem.add_runtime_dependency
|
5
|
+
gem.add_development_dependency 'ZenTest', '~> 4.5'
|
6
|
+
gem.add_development_dependency 'maruku', '~> 0.6'
|
7
|
+
gem.add_development_dependency 'rake', '~> 0.9'
|
8
|
+
gem.add_development_dependency 'rspec', '~> 2.6'
|
9
|
+
gem.add_development_dependency 'simplecov', '~> 0.4'
|
10
|
+
gem.add_development_dependency 'webmock', '~> 1.6'
|
11
|
+
gem.add_development_dependency 'yard', '~> 0.7'
|
12
|
+
gem.add_runtime_dependency 'faraday', '~> 0.6.1'
|
13
|
+
gem.add_runtime_dependency 'faraday_middleware', '~> 0.6.3'
|
14
|
+
gem.add_runtime_dependency 'hashie', '~> 1.0.0'
|
15
|
+
gem.add_runtime_dependency 'json', '~> 1.5.1'
|
16
|
+
gem.add_runtime_dependency 'multi_json', '~> 1.0.2'
|
17
|
+
gem.add_runtime_dependency 'rash', '~> 0.3.0'
|
17
18
|
gem.authors = ["Erik Michaels-Ober", "Ryan Resella"]
|
18
19
|
gem.description = %q{Ruby wrapper for the Futures, Inc. US Military Pipeline API}
|
19
20
|
gem.email = ['erik@codeforamerica.org', 'ryan@codeforamerica.org']
|
@@ -31,5 +31,18 @@ module FuturesPipeline
|
|
31
31
|
api_safe_onet_soc_code = onet_soc_code.tr(".", "-")
|
32
32
|
get("/api/v1/careers/#{api_safe_onet_soc_code}.json", options)
|
33
33
|
end
|
34
|
+
|
35
|
+
# Search for careers by MOC code. Returns a list of careers related to the MOC.
|
36
|
+
#
|
37
|
+
# @param moc [String] The MOC
|
38
|
+
# @param options [Hash] A customizable set of options.
|
39
|
+
# @return [Hashie::Mash]
|
40
|
+
# @example
|
41
|
+
# @client = FuturesPipeline.new
|
42
|
+
# @client.search("11b")
|
43
|
+
def search(moc, options={})
|
44
|
+
get("/api/v1/careers/search.json?moc=#{moc}", options)
|
45
|
+
end
|
46
|
+
|
34
47
|
end
|
35
48
|
end
|
@@ -18,10 +18,15 @@ describe Faraday::Response do
|
|
18
18
|
}.each do |status, exception|
|
19
19
|
context "when HTTP status is #{status}" do
|
20
20
|
|
21
|
+
before do
|
22
|
+
stub_get("api/v1/careers/11-1011-01.json").
|
23
|
+
to_return(:status => status, :body => fixture("career.json"))
|
24
|
+
end
|
25
|
+
|
21
26
|
it "should raise #{exception.name} error" do
|
22
27
|
lambda do
|
23
28
|
@client.career("11-1011.01")
|
24
|
-
end.should raise_error
|
29
|
+
end.should raise_error exception
|
25
30
|
end
|
26
31
|
end
|
27
32
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"onet_soc_code":"13-1073.00","api_safe_onet_soc_code":"13-1073-00","title":"Training and Development Specialists","link":"http://militarydemo.pipelinenc.com/careers/89-training-and-development-specialists","average_national_salary":47830},{"onet_soc_code":"33-9032.00","api_safe_onet_soc_code":"33-9032-00","title":"Security Guards","link":"http://militarydemo.pipelinenc.com/careers/586-security-guards","average_national_salary":21530}]
|
@@ -6,25 +6,68 @@ describe FuturesPipeline::Client do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "#careers" do
|
9
|
+
before do
|
10
|
+
stub_get("api/v1/careers.json").
|
11
|
+
to_return(:status => 200, :body => fixture("careers.json"))
|
12
|
+
end
|
13
|
+
|
9
14
|
it "should fetch all careers" do
|
10
15
|
careers = @client.careers
|
11
16
|
careers.first.title.should == "Chief Executives"
|
12
17
|
end
|
13
18
|
end
|
14
|
-
|
15
|
-
describe "#career" do
|
19
|
+
|
20
|
+
describe "#career" do
|
16
21
|
context "with API-safe O*NET code" do
|
22
|
+
before do
|
23
|
+
stub_get("api/v1/careers/11-1011-00.json").
|
24
|
+
to_return(:status => 200, :body => fixture("career.json"))
|
25
|
+
end
|
26
|
+
|
17
27
|
it "should fetch one career" do
|
18
28
|
career = @client.career("11-1011-00")
|
19
29
|
career.title.should == "Chief Executives"
|
20
30
|
end
|
21
31
|
end
|
32
|
+
|
22
33
|
context "with O*NET status code" do
|
34
|
+
before do
|
35
|
+
stub_get("api/v1/careers/11-1011-00.json").
|
36
|
+
to_return(:status => 200, :body => fixture("career.json"))
|
37
|
+
end
|
38
|
+
|
23
39
|
it "should fetch one career" do
|
24
|
-
|
25
|
-
|
40
|
+
career = @client.career("11-1011.00")
|
41
|
+
career.title.should == "Chief Executives"
|
26
42
|
end
|
27
43
|
end
|
28
44
|
end
|
29
|
-
|
45
|
+
|
46
|
+
describe "#search" do
|
47
|
+
context "with no paramaters" do
|
48
|
+
before do
|
49
|
+
stub_get("api/v1/careers/search.json").
|
50
|
+
to_return(:status => 200, :body => fixture("search.json"))
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return a search of careers" do
|
54
|
+
lambda do
|
55
|
+
@client.search
|
56
|
+
end.should raise_error ArgumentError
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context "with MOC parameter" do
|
61
|
+
before do
|
62
|
+
stub_get("api/v1/careers/search.json?moc=11b").
|
63
|
+
to_return(:status => 200, :body => fixture("search.json"))
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should return one career related to the MOC" do
|
67
|
+
search = @client.search("11b")
|
68
|
+
search.first.title.should == "Training and Development Specialists"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
30
73
|
end
|
data/spec/helper.rb
CHANGED
@@ -1,4 +1,45 @@
|
|
1
1
|
require 'simplecov'
|
2
2
|
SimpleCov.start
|
3
3
|
require 'rspec'
|
4
|
+
require 'webmock/rspec'
|
4
5
|
require 'futures_pipeline'
|
6
|
+
|
7
|
+
def a_delete(path)
|
8
|
+
a_request(:delete, 'http://militarydemo.pipelinenc.com/' + path)
|
9
|
+
end
|
10
|
+
|
11
|
+
def a_get(path)
|
12
|
+
a_request(:get, 'http://militarydemo.pipelinenc.com/' + path)
|
13
|
+
end
|
14
|
+
|
15
|
+
def a_post(path)
|
16
|
+
a_request(:post, 'http://militarydemo.pipelinenc.com/' + path)
|
17
|
+
end
|
18
|
+
|
19
|
+
def a_put(path)
|
20
|
+
a_request(:put, 'http://militarydemo.pipelinenc.com/' + path)
|
21
|
+
end
|
22
|
+
|
23
|
+
def stub_delete(path)
|
24
|
+
stub_request(:delete, 'http://militarydemo.pipelinenc.com/' + path)
|
25
|
+
end
|
26
|
+
|
27
|
+
def stub_get(path)
|
28
|
+
stub_request(:get, 'http://militarydemo.pipelinenc.com/' + path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def stub_post(path)
|
32
|
+
stub_request(:post, 'http://militarydemo.pipelinenc.com/' + path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def stub_put(path)
|
36
|
+
stub_request(:put, 'http://militarydemo.pipelinenc.com/' + path)
|
37
|
+
end
|
38
|
+
|
39
|
+
def fixture_path
|
40
|
+
File.expand_path('../fixtures', __FILE__)
|
41
|
+
end
|
42
|
+
|
43
|
+
def fixture(file)
|
44
|
+
File.new(fixture_path + '/' + file)
|
45
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: futures_pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
5
|
+
version: 0.0.3
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Erik Michaels-Ober
|
@@ -16,7 +11,8 @@ autorequire:
|
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
13
|
|
19
|
-
date: 2011-05-
|
14
|
+
date: 2011-05-23 00:00:00 -07:00
|
15
|
+
default_executable:
|
20
16
|
dependencies:
|
21
17
|
- !ruby/object:Gem::Dependency
|
22
18
|
name: ZenTest
|
@@ -26,10 +22,6 @@ dependencies:
|
|
26
22
|
requirements:
|
27
23
|
- - ~>
|
28
24
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 17
|
30
|
-
segments:
|
31
|
-
- 4
|
32
|
-
- 5
|
33
25
|
version: "4.5"
|
34
26
|
type: :development
|
35
27
|
version_requirements: *id001
|
@@ -41,10 +33,6 @@ dependencies:
|
|
41
33
|
requirements:
|
42
34
|
- - ~>
|
43
35
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 7
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 6
|
48
36
|
version: "0.6"
|
49
37
|
type: :development
|
50
38
|
version_requirements: *id002
|
@@ -56,11 +44,7 @@ dependencies:
|
|
56
44
|
requirements:
|
57
45
|
- - ~>
|
58
46
|
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
- 8
|
63
|
-
version: "0.8"
|
47
|
+
version: "0.9"
|
64
48
|
type: :development
|
65
49
|
version_requirements: *id003
|
66
50
|
- !ruby/object:Gem::Dependency
|
@@ -71,10 +55,6 @@ dependencies:
|
|
71
55
|
requirements:
|
72
56
|
- - ~>
|
73
57
|
- !ruby/object:Gem::Version
|
74
|
-
hash: 15
|
75
|
-
segments:
|
76
|
-
- 2
|
77
|
-
- 6
|
78
58
|
version: "2.6"
|
79
59
|
type: :development
|
80
60
|
version_requirements: *id004
|
@@ -86,109 +66,97 @@ dependencies:
|
|
86
66
|
requirements:
|
87
67
|
- - ~>
|
88
68
|
- !ruby/object:Gem::Version
|
89
|
-
hash: 3
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
- 4
|
93
69
|
version: "0.4"
|
94
70
|
type: :development
|
95
71
|
version_requirements: *id005
|
96
72
|
- !ruby/object:Gem::Dependency
|
97
|
-
name:
|
73
|
+
name: webmock
|
98
74
|
prerelease: false
|
99
75
|
requirement: &id006 !ruby/object:Gem::Requirement
|
100
76
|
none: false
|
101
77
|
requirements:
|
102
78
|
- - ~>
|
103
79
|
- !ruby/object:Gem::Version
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
80
|
+
version: "1.6"
|
81
|
+
type: :development
|
82
|
+
version_requirements: *id006
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
prerelease: false
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ~>
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0.7"
|
92
|
+
type: :development
|
93
|
+
version_requirements: *id007
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: faraday
|
96
|
+
prerelease: false
|
97
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ~>
|
101
|
+
- !ruby/object:Gem::Version
|
109
102
|
version: 0.6.1
|
110
103
|
type: :runtime
|
111
|
-
version_requirements: *
|
104
|
+
version_requirements: *id008
|
112
105
|
- !ruby/object:Gem::Dependency
|
113
106
|
name: faraday_middleware
|
114
107
|
prerelease: false
|
115
|
-
requirement: &
|
108
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
116
109
|
none: false
|
117
110
|
requirements:
|
118
111
|
- - ~>
|
119
112
|
- !ruby/object:Gem::Version
|
120
|
-
hash: 1
|
121
|
-
segments:
|
122
|
-
- 0
|
123
|
-
- 6
|
124
|
-
- 3
|
125
113
|
version: 0.6.3
|
126
114
|
type: :runtime
|
127
|
-
version_requirements: *
|
115
|
+
version_requirements: *id009
|
128
116
|
- !ruby/object:Gem::Dependency
|
129
117
|
name: hashie
|
130
118
|
prerelease: false
|
131
|
-
requirement: &
|
119
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
132
120
|
none: false
|
133
121
|
requirements:
|
134
122
|
- - ~>
|
135
123
|
- !ruby/object:Gem::Version
|
136
|
-
hash: 23
|
137
|
-
segments:
|
138
|
-
- 1
|
139
|
-
- 0
|
140
|
-
- 0
|
141
124
|
version: 1.0.0
|
142
125
|
type: :runtime
|
143
|
-
version_requirements: *
|
126
|
+
version_requirements: *id010
|
144
127
|
- !ruby/object:Gem::Dependency
|
145
128
|
name: json
|
146
129
|
prerelease: false
|
147
|
-
requirement: &
|
130
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
148
131
|
none: false
|
149
132
|
requirements:
|
150
133
|
- - ~>
|
151
134
|
- !ruby/object:Gem::Version
|
152
|
-
hash: 1
|
153
|
-
segments:
|
154
|
-
- 1
|
155
|
-
- 5
|
156
|
-
- 1
|
157
135
|
version: 1.5.1
|
158
136
|
type: :runtime
|
159
|
-
version_requirements: *
|
137
|
+
version_requirements: *id011
|
160
138
|
- !ruby/object:Gem::Dependency
|
161
139
|
name: multi_json
|
162
140
|
prerelease: false
|
163
|
-
requirement: &
|
141
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
164
142
|
none: false
|
165
143
|
requirements:
|
166
144
|
- - ~>
|
167
145
|
- !ruby/object:Gem::Version
|
168
|
-
|
169
|
-
segments:
|
170
|
-
- 1
|
171
|
-
- 0
|
172
|
-
- 1
|
173
|
-
version: 1.0.1
|
146
|
+
version: 1.0.2
|
174
147
|
type: :runtime
|
175
|
-
version_requirements: *
|
148
|
+
version_requirements: *id012
|
176
149
|
- !ruby/object:Gem::Dependency
|
177
150
|
name: rash
|
178
151
|
prerelease: false
|
179
|
-
requirement: &
|
152
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
180
153
|
none: false
|
181
154
|
requirements:
|
182
155
|
- - ~>
|
183
156
|
- !ruby/object:Gem::Version
|
184
|
-
hash: 19
|
185
|
-
segments:
|
186
|
-
- 0
|
187
|
-
- 3
|
188
|
-
- 0
|
189
157
|
version: 0.3.0
|
190
158
|
type: :runtime
|
191
|
-
version_requirements: *
|
159
|
+
version_requirements: *id013
|
192
160
|
description: Ruby wrapper for the Futures, Inc. US Military Pipeline API
|
193
161
|
email:
|
194
162
|
- erik@codeforamerica.org
|
@@ -219,9 +187,11 @@ files:
|
|
219
187
|
- spec/fixtures/career.json
|
220
188
|
- spec/fixtures/careers.json
|
221
189
|
- spec/fixtures/not_found.json
|
190
|
+
- spec/fixtures/search.json
|
222
191
|
- spec/futures_pipeline/client_spec.rb
|
223
192
|
- spec/futures_pipeline_spec.rb
|
224
193
|
- spec/helper.rb
|
194
|
+
has_rdoc: true
|
225
195
|
homepage: https://github.com/codeforamerica/futures_pipeline
|
226
196
|
licenses: []
|
227
197
|
|
@@ -235,23 +205,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
235
205
|
requirements:
|
236
206
|
- - ">="
|
237
207
|
- !ruby/object:Gem::Version
|
238
|
-
hash: 3
|
239
|
-
segments:
|
240
|
-
- 0
|
241
208
|
version: "0"
|
242
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
210
|
none: false
|
244
211
|
requirements:
|
245
212
|
- - ">="
|
246
213
|
- !ruby/object:Gem::Version
|
247
|
-
hash: 3
|
248
|
-
segments:
|
249
|
-
- 0
|
250
214
|
version: "0"
|
251
215
|
requirements: []
|
252
216
|
|
253
217
|
rubyforge_project:
|
254
|
-
rubygems_version: 1.
|
218
|
+
rubygems_version: 1.6.2
|
255
219
|
signing_key:
|
256
220
|
specification_version: 3
|
257
221
|
summary: Ruby wrapper for the Futures, Inc. US Military Pipeline API
|
@@ -260,6 +224,7 @@ test_files:
|
|
260
224
|
- spec/fixtures/career.json
|
261
225
|
- spec/fixtures/careers.json
|
262
226
|
- spec/fixtures/not_found.json
|
227
|
+
- spec/fixtures/search.json
|
263
228
|
- spec/futures_pipeline/client_spec.rb
|
264
229
|
- spec/futures_pipeline_spec.rb
|
265
230
|
- spec/helper.rb
|