resumator-client 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -27,15 +27,27 @@ module Resumator
27
27
  # @param [Hash] optional search parameters
28
28
  # @return [Mash] your data
29
29
  def get(object, options = {})
30
- if options[:id]
31
- resp = @connection.get "#{object}/#{options[:id]}"
32
- elsif options.size > 0
33
- resp = @connection.get "#{object}#{Client.parse_options(options)}"
30
+ if options[:all_pages]
31
+ options.delete(:all_pages)
32
+ options[:page] = 1
33
+ out = []
34
+ begin
35
+ data = get(object, options)
36
+ out = out | data
37
+ options[:page] += 1
38
+ end while data.count >= 100
39
+ return out
34
40
  else
35
- resp = @connection.get object
41
+ if options[:id]
42
+ resp = @connection.get "#{object}/#{options[:id]}"
43
+ elsif options.size > 0
44
+ resp = @connection.get "#{object}#{Client.parse_options(options)}"
45
+ else
46
+ resp = @connection.get object
47
+ end
48
+ raise "Bad response: #{resp.status}" unless resp.status == 200
49
+ Client.mash(JSON.parse(resp.body))
36
50
  end
37
- raise "Bad response: #{resp.status}" unless resp.status == 200
38
- Client.mash(JSON.parse(resp.body))
39
51
  end
40
52
 
41
53
  def applicants(options = {})
@@ -67,7 +79,7 @@ module Resumator
67
79
  if response.is_a? Array
68
80
  return response.map{|o| Hashie::Mash.new(o)}
69
81
  else
70
- return Hashie::Mash.new(response)
82
+ return [Hashie::Mash.new(response)]
71
83
  end
72
84
  end
73
85
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "resumator-client"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kurt Nelson"]
12
- s.date = "2012-10-30"
12
+ s.date = "2012-10-31"
13
13
  s.description = "Use the RESTful API found at resumatorapi.com"
14
14
  s.email = "kurtisnelson@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -23,22 +23,18 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json
25
25
  Date:
26
- - Tue, 30 Oct 2012 18:29:20 GMT
26
+ - Wed, 31 Oct 2012 14:55:48 GMT
27
27
  Server:
28
28
  - nginx/1.0.15
29
29
  X-Powered-By:
30
30
  - PHP/5.3.3
31
31
  Content-Length:
32
- - '752'
32
+ - '2'
33
33
  Connection:
34
34
  - keep-alive
35
35
  body:
36
36
  encoding: US-ASCII
37
- string: ! '[{"id":"activity_20120926143642_XAJ5GJI5PP6JH6QX","category":"resume_status","team_id":"","user_id":"usr_20110609133428_29RPHSXHAKEY2ZXG","object_id":"prospect_20120920202531_GLLJFJ5ES0WFOJFL","action":"Charles
38
- Quinn changed the status of applicant from \"Reviewed\" to \"Phone
39
- Screened\" for the job \"Web Application Developer\".","date":"2012-09-26","time":"14:36:42"},{"id":"activity_20120921192110_XR6TWCHZ2SEIUGO6","category":"resume_status","team_id":"","user_id":"usr_20110609133428_29RPHSXHAKEY2ZXG","object_id":"prospect_20120920202531_GLLJFJ5ES0WFOJFL","action":"Charles
40
- Quinn changed the status of applicant from \"New\" to \"Reviewed\"
41
- for the job \"Web Application Developer\".","date":"2012-09-21","time":"19:21:10"}]'
37
+ string: ! '[]'
42
38
  http_version:
43
- recorded_at: Tue, 30 Oct 2012 18:29:20 GMT
39
+ recorded_at: Wed, 31 Oct 2012 14:55:50 GMT
44
40
  recorded_with: VCR 2.2.5
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.resumatorapi.com/v1/jobs?apikey=BxO624TAeatcdZfsugE45vNtiMpW28vJ
5
+ uri: https://api.resumatorapi.com/v1/jobs?apikey=<RESUMATOR_API_KEY>
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -23,7 +23,7 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json
25
25
  Date:
26
- - Tue, 30 Oct 2012 16:13:36 GMT
26
+ - Wed, 31 Oct 2012 15:10:19 GMT
27
27
  Server:
28
28
  - nginx/1.0.15
29
29
  X-Powered-By:
@@ -38,10 +38,10 @@ http_interactions:
38
38
  Job","country_id":"C1","city":"Pittsburgh","state":"PA","zip":"O5212","minimum_salary":"C0000","maximum_salary":"C5000","notes":"I
39
39
  like turtles.","original_open_date":"D012-10-30","status":"O","send_to_job_boards":"N","hiring_lead":"usr_20121030151055_TNAW6JCZNH0SYEHE","board_code":"qugheP"}'
40
40
  http_version:
41
- recorded_at: Tue, 30 Oct 2012 16:13:48 GMT
41
+ recorded_at: Wed, 31 Oct 2012 15:10:22 GMT
42
42
  - request:
43
43
  method: get
44
- uri: https://api.resumatorapi.com/v1/jobs/job_20121030151055_ZK0WBF7NK8WXCWLA?apikey=BxO624TAeatcdZfsugE45vNtiMpW28vJ
44
+ uri: https://api.resumatorapi.com/v1/applicants/page/1?apikey=<RESUMATOR_API_KEY>
45
45
  body:
46
46
  encoding: US-ASCII
47
47
  string: ''
@@ -62,7 +62,45 @@ http_interactions:
62
62
  Content-Type:
63
63
  - application/json
64
64
  Date:
65
- - Tue, 30 Oct 2012 16:13:36 GMT
65
+ - Wed, 31 Oct 2012 15:10:19 GMT
66
+ Server:
67
+ - nginx/1.0.15
68
+ X-Powered-By:
69
+ - PHP/5.3.3
70
+ Content-Length:
71
+ - '221'
72
+ Connection:
73
+ - keep-alive
74
+ body:
75
+ encoding: US-ASCII
76
+ string: ! '{"id":"prospect_20121030151055_BKTQHUTGXV4FGQVS","first_name":"Neil","last_name":"Peart","prospect_phone":"1-888-353-0887","apply_date":"2012-10-30","job_id":"job_20121030151055_ZK0WBF7NK8WXCWLA","job_title":"Sample
77
+ Job"}'
78
+ http_version:
79
+ recorded_at: Wed, 31 Oct 2012 15:10:22 GMT
80
+ - request:
81
+ method: get
82
+ uri: https://api.resumatorapi.com/v1/jobs/job_20121030151055_ZK0WBF7NK8WXCWLA?apikey=<RESUMATOR_API_KEY>
83
+ body:
84
+ encoding: US-ASCII
85
+ string: ''
86
+ headers:
87
+ Accept-Encoding:
88
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
89
+ Accept:
90
+ - ! '*/*'
91
+ User-Agent:
92
+ - Ruby
93
+ response:
94
+ status:
95
+ code: 200
96
+ message: OK
97
+ headers:
98
+ Access-Control-Allow-Origin:
99
+ - ! '*'
100
+ Content-Type:
101
+ - application/json
102
+ Date:
103
+ - Wed, 31 Oct 2012 15:10:19 GMT
66
104
  Server:
67
105
  - nginx/1.0.15
68
106
  X-Powered-By:
@@ -81,10 +119,10 @@ http_interactions:
81
119
  like turtles.","original_open_date":"2012-10-30","status":"On Hold","send_to_job_boards":"No
82
120
  answer","hiring_lead":"usr_20121030151055_TNAW6JCZNH0SYEHE","board_code":"qugheP","job_applicants":{"prospect_id":"prospect_20121030151055_BKTQHUTGXV4FGQVS","apply_date":"2012-10-30"}}'
83
121
  http_version:
84
- recorded_at: Tue, 30 Oct 2012 16:13:48 GMT
122
+ recorded_at: Wed, 31 Oct 2012 15:10:22 GMT
85
123
  - request:
86
124
  method: get
87
- uri: https://api.resumatorapi.com/v1/jobs/city/Pittsburgh?apikey=BxO624TAeatcdZfsugE45vNtiMpW28vJ
125
+ uri: https://api.resumatorapi.com/v1/jobs/city/Pittsburgh?apikey=<RESUMATOR_API_KEY>
88
126
  body:
89
127
  encoding: US-ASCII
90
128
  string: ''
@@ -105,7 +143,7 @@ http_interactions:
105
143
  Content-Type:
106
144
  - application/json
107
145
  Date:
108
- - Tue, 30 Oct 2012 16:13:36 GMT
146
+ - Wed, 31 Oct 2012 15:10:20 GMT
109
147
  Server:
110
148
  - nginx/1.0.15
111
149
  X-Powered-By:
@@ -120,5 +158,5 @@ http_interactions:
120
158
  Job","country_id":"C1","city":"Pittsburgh","state":"PA","zip":"O5212","minimum_salary":"C0000","maximum_salary":"C5000","notes":"I
121
159
  like turtles.","original_open_date":"D012-10-30","status":"O","send_to_job_boards":"N","hiring_lead":"usr_20121030151055_TNAW6JCZNH0SYEHE","board_code":"qugheP"}'
122
160
  http_version:
123
- recorded_at: Tue, 30 Oct 2012 16:13:48 GMT
161
+ recorded_at: Wed, 31 Oct 2012 15:10:22 GMT
124
162
  recorded_with: VCR 2.2.5
@@ -19,18 +19,23 @@ describe Resumator::Client do
19
19
  describe "#get" do
20
20
  it "gets objects" do
21
21
  data = client.get "jobs"
22
- data.count.should > 1
22
+ data.count.should >= 1
23
+ end
24
+
25
+ it "gets all the pages" do
26
+ data = client.get "applicants", all_pages: true
27
+ data.count.should >= 1
23
28
  end
24
29
 
25
30
  it "gets specific job" do
26
31
  ID = "job_20121030151055_ZK0WBF7NK8WXCWLA"
27
32
  data = client.get "jobs", {id: ID}
28
- data.id.should eq ID
33
+ data.first.id.should eq ID
29
34
  end
30
35
 
31
36
  it "searches by options" do
32
37
  data = client.get "jobs", {city: "Pittsburgh"}
33
- data.city.should eq "Pittsburgh"
38
+ data.first.city.should eq "Pittsburgh"
34
39
  end
35
40
  end
36
41
  end
@@ -11,9 +11,11 @@ describe Resumator::Activities do
11
11
  subject{Resumator::Activities.new(Resumator::Client.new(ENV['RESUMATOR_TEST_KEY']))}
12
12
  describe "#status_history" do
13
13
  it "doesn't explode" do
14
- data = subject.status_history("prospect_20120920202531_GLLJFJ5ES0WFOJFL")
14
+ data = subject.status_history("prospect_20120920202531_GLLJFJ5ES0WFOJFL")
15
+ if data.count > 0
15
16
  data.first.from.should_not be nil
16
17
  data.first.to.should_not be nil
18
+ end
17
19
  end
18
20
 
19
21
  it "can handle an empty response" do
@@ -6,11 +6,11 @@ describe Resumator::Client do
6
6
  Resumator::Client.parse_options(options).should eq("/city/Atlanta/state/GA")
7
7
  end
8
8
 
9
- it "turns a single hash into a mash" do
9
+ it "turns a single hash into a mash array" do
10
10
  data = {id: 1, name: "Bob"}
11
11
  mash = Resumator::Client.mash(data)
12
- mash.id.should eq 1
13
- mash.name.should eq "Bob"
12
+ mash.first.id.should eq 1
13
+ mash.first.name.should eq "Bob"
14
14
  end
15
15
 
16
16
  it "turns an array of hashes into a mash array" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resumator-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-30 00:00:00.000000000 Z
12
+ date: 2012-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -212,7 +212,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
212
  version: '0'
213
213
  segments:
214
214
  - 0
215
- hash: 2670977623812130506
215
+ hash: -1186413782945592174
216
216
  required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  none: false
218
218
  requirements: