zohoho 0.2.1 → 0.2.2

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.
@@ -22,7 +22,7 @@ module Zohoho
22
22
  end
23
23
 
24
24
  def ticket
25
- @ticket = Regexp.last_match(1) if self.class.post(ticket_url).parsed_response =~ /TICKET=(\w+)/
25
+ Regexp.last_match(1) if self.class.post(ticket_url).parsed_response =~ /TICKET=(\w+)/
26
26
  end
27
27
 
28
28
  def call(entry, api_method, query = {}, http_method = :get)
@@ -19,8 +19,28 @@ module Zohoho
19
19
  "http://recruit.zoho.com/ats/private/#{type}/Candidates/getRecords?apikey=#{@conn.api_key}&ticket=#{@conn.ticket}"
20
20
  end
21
21
 
22
- def get_candidates(conditions = {:toIndex => 200})
23
- @type == 'json' ? JSON.parse(self.class.get(candidates_url, conditions)) : Nokogiri::XML.parse(self.class.get(candidates_url, conditions))
24
- end
22
+ def get_candidates(conditions = {})
23
+ (@type == 'json' ? JSON.parse(self.class.get(candidates_url, conditions)) : Nokogiri::XML.parse(self.class.get(candidates_url, conditions)))
24
+ end
25
+
26
+ def candidates(conditions = {})
27
+ @candidates ||= get_candidates
28
+ end
29
+
30
+ def get_parsed_candidates(conditions = {:toIndex => 200})
31
+ raw_candidates = candidates
32
+ @candidates = raw_candidates["response"]["result"]["Candidates"]["row"]
33
+
34
+ #extracts the relevant data
35
+ @candidates.collect! do |candidate|
36
+ @hash = {}
37
+ candidate["FL"].collect do |pair|
38
+ pair = pair.to_a
39
+ @hash[pair.last.last.to_sym] = pair.first.last
40
+ end
41
+ @hash
42
+ end
43
+ @candidates
44
+ end
25
45
  end
26
46
  end
data/zohoho.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{zohoho}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["KentonWhite", "Elland"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: zohoho
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - KentonWhite