indeed 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/indeed.gemspec +3 -4
- data/lib/indeed.rb +5 -1
- data/spec/indeed_spec.rb +16 -0
- metadata +15 -15
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/indeed.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{indeed}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bogdan Gusiev"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-09}
|
13
13
|
s.description = %q{Simple wrapper for JSON api provided by indeed.
|
14
14
|
Original documentation at:
|
15
15
|
http://www.indeed.com/jsp/apiinfo.jsp (Require authorization)
|
@@ -29,7 +29,7 @@ Support search jobs API 2.0 and get jobs API
|
|
29
29
|
]
|
30
30
|
s.homepage = %q{http://github.com/railsware/indeed}
|
31
31
|
s.require_paths = ["lib"]
|
32
|
-
s.rubygems_version = %q{1.
|
32
|
+
s.rubygems_version = %q{1.6.2}
|
33
33
|
s.summary = %q{Api wrap from Indeed service http://indeed.com}
|
34
34
|
s.test_files = [
|
35
35
|
"spec/indeed_spec.rb",
|
@@ -37,7 +37,6 @@ Support search jobs API 2.0 and get jobs API
|
|
37
37
|
]
|
38
38
|
|
39
39
|
if s.respond_to? :specification_version then
|
40
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
41
40
|
s.specification_version = 3
|
42
41
|
|
43
42
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/indeed.rb
CHANGED
@@ -70,8 +70,12 @@ class Indeed
|
|
70
70
|
def http_get(domain, path, params = {})
|
71
71
|
log("Indeed query", params.inspect)
|
72
72
|
query = "#{path}?#{params.collect { |k,v| "#{k}=#{CGI::escape(v.to_s)}" }.join('&')}"
|
73
|
-
|
73
|
+
begin
|
74
74
|
data = Yajl::Parser.parse(Net::HTTP.get(domain, query))
|
75
|
+
rescue Yajl::ParseError
|
76
|
+
raise IndeedError, 'Did not get a valid JSON response from Indeed'
|
77
|
+
end
|
78
|
+
|
75
79
|
if error = data["error"]
|
76
80
|
raise IndeedError, error
|
77
81
|
end
|
data/spec/indeed_spec.rb
CHANGED
@@ -58,4 +58,20 @@ describe Indeed do
|
|
58
58
|
it { should be_a(Array) }
|
59
59
|
it {should_not be_empty }
|
60
60
|
end
|
61
|
+
|
62
|
+
context "when Indeed returns html instead of json" do
|
63
|
+
before(:each) do
|
64
|
+
|
65
|
+
Net::HTTP.stubs(:get).returns(<<-HTML)
|
66
|
+
<h1>Internal Error</h1>
|
67
|
+
HTML
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should raise exception" do
|
71
|
+
lambda {
|
72
|
+
Indeed.search({})
|
73
|
+
}.should raise_error(IndeedError)
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
61
77
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indeed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bogdan Gusiev
|
@@ -15,11 +15,12 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-09 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
24
|
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
@@ -28,12 +29,12 @@ dependencies:
|
|
28
29
|
segments:
|
29
30
|
- 0
|
30
31
|
version: "0"
|
31
|
-
requirement: *id001
|
32
32
|
type: :runtime
|
33
33
|
name: rake
|
34
|
-
|
34
|
+
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
38
|
none: false
|
38
39
|
requirements:
|
39
40
|
- - ">="
|
@@ -42,12 +43,12 @@ dependencies:
|
|
42
43
|
segments:
|
43
44
|
- 0
|
44
45
|
version: "0"
|
45
|
-
requirement: *id002
|
46
46
|
type: :runtime
|
47
47
|
name: yajl-ruby
|
48
|
-
|
48
|
+
version_requirements: *id002
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
52
|
none: false
|
52
53
|
requirements:
|
53
54
|
- - ">="
|
@@ -56,10 +57,9 @@ dependencies:
|
|
56
57
|
segments:
|
57
58
|
- 0
|
58
59
|
version: "0"
|
59
|
-
requirement: *id003
|
60
60
|
type: :development
|
61
61
|
name: jeweler
|
62
|
-
|
62
|
+
version_requirements: *id003
|
63
63
|
description: |
|
64
64
|
Simple wrapper for JSON api provided by indeed.
|
65
65
|
Original documentation at:
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements: []
|
114
114
|
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 1.
|
116
|
+
rubygems_version: 1.6.2
|
117
117
|
signing_key:
|
118
118
|
specification_version: 3
|
119
119
|
summary: Api wrap from Indeed service http://indeed.com
|