oodler 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/oodler/client.rb +14 -3
- data/lib/oodler/web_client.rb +1 -0
- data/test/client_test.rb +6 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/oodler/client.rb
CHANGED
@@ -15,6 +15,7 @@ module Oodler
|
|
15
15
|
|
16
16
|
def get(path, options={})
|
17
17
|
path = "/listings#{path}"
|
18
|
+
delete_empty_keys(options)
|
18
19
|
validate_parameters(options)
|
19
20
|
response = web_client.get(path, options)
|
20
21
|
raise_errors(response)
|
@@ -36,9 +37,10 @@ module Oodler
|
|
36
37
|
end
|
37
38
|
|
38
39
|
#specify the :location key for city search, i.e :location=>"Houston, Tx"
|
40
|
+
#allow job specializaton, i.e. job/tech
|
39
41
|
def usa_job_search(options)
|
40
42
|
options.merge!({:region => "usa"})
|
41
|
-
options.merge!({:category => "job"})
|
43
|
+
options.merge!({:category => "job"}) unless options && options[:category]
|
42
44
|
self.listing(options)
|
43
45
|
end
|
44
46
|
|
@@ -72,12 +74,17 @@ module Oodler
|
|
72
74
|
|
73
75
|
def validate_parameters(options)
|
74
76
|
|
77
|
+
|
78
|
+
if options.empty?
|
79
|
+
raise OodleArgumentError, 'Missing region and category parameter. Visit http://developer.oodle.com/regions-list/ for possible regions.'
|
80
|
+
end
|
81
|
+
|
75
82
|
params = options[:query]
|
76
83
|
|
77
|
-
unless params[:region]
|
84
|
+
unless params.nil? || params[:region]
|
78
85
|
raise OodleArgumentError, 'Missing region parameter. Visit http://developer.oodle.com/regions-list/ for possible regions.'
|
79
86
|
end
|
80
|
-
unless
|
87
|
+
unless params[:category] || params[:q]
|
81
88
|
raise OodleArgumentError, 'You must supply a category or query parameter. Visit http://developer.oodle.com/categories-list/ for possible categories.'
|
82
89
|
end
|
83
90
|
end
|
@@ -90,6 +97,10 @@ module Oodler
|
|
90
97
|
|
91
98
|
end
|
92
99
|
|
100
|
+
def delete_empty_keys(options)
|
101
|
+
options.delete_if{|key,value| value.empty?}
|
102
|
+
end
|
103
|
+
|
93
104
|
|
94
105
|
|
95
106
|
end
|
data/lib/oodler/web_client.rb
CHANGED
data/test/client_test.rb
CHANGED
@@ -16,6 +16,12 @@ class ClientTest < Test::Unit::TestCase
|
|
16
16
|
@oodler.web_client.should == wc
|
17
17
|
|
18
18
|
end
|
19
|
+
context "and using the usa_jobs conv method" do
|
20
|
+
should " allow you to override the category param" do
|
21
|
+
stub_get("/api/v2/listings?region=usa&category=job%2Ftech&key=key", "listings.xml")
|
22
|
+
@oodler.usa_job_search(:category => "job/tech")
|
23
|
+
end
|
24
|
+
end
|
19
25
|
|
20
26
|
context "and a region is not provided" do
|
21
27
|
should "throw an error" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oodler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Hagedorn
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-04-
|
12
|
+
date: 2010-04-22 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|