hawatel_search_jobs 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.
@@ -1,186 +1,186 @@
1
- require 'ostruct'
2
-
3
- module HawatelSearchJobs
4
- module Api
5
- ##
6
- # = Reed.co.uk API
7
- #
8
- # @see https://www.reed.co.uk/developers/Jobseeker
9
- module Reed
10
- class << self
11
- include HawatelSearchJobs::Helpers::Base
12
-
13
- DEFAULT = {
14
- :keywords => '',
15
- :location => '',
16
- }
17
-
18
- RESULT_LIMIT = 25
19
-
20
- # Search jobs by specific criteria
21
- # @param [Hash] args
22
- # @option args :settings [Hash] search criteria
23
- # - *:api* (String) - URL API (default: reed.co.uk/api)
24
- # - *:version* (String) - a version of API (default: 1.0)
25
- # - *:clientid* (String) - API Key (see https://www.reed.co.uk/developers/Jobseeker)
26
- # @option args :query [Hash] settings of API
27
- # - *:keywors* (String)
28
- # - *:location* (String)
29
- # @example
30
- # jobs = Reed.search({:settings => {
31
- # :api => 'reed.co.uk/api',
32
- # :version => '1.0',
33
- # :clientid => 'secret-code'},
34
- # :query => {
35
- # :keywords => 'ruby',
36
- # :location => 'London'})
37
- # @return [Hash] First page of the result (see constant RESULT_LIMIT)
38
- def search(args)
39
- args[:query] = DEFAULT.merge(args[:query]) if args[:query]
40
-
41
- if args[:query_key].nil?
42
- url_request = prepare_conn_string(args) + prepare_query(args)
43
- else
44
- url_request = args[:query_key]
45
- end
46
-
47
- response = api_request(url_request, args[:settings][:clientid])
48
- attributes = build_jobs_table(response, url_request)
49
- OpenStruct.new(attributes)
50
- end
51
-
52
- # Get a specific page result
53
- # At the beging you have to run {search} method and get :key from result and pass it to the argument :query_key
54
- # @param [Hash] args
55
- # @option args :settings [Hash] see {search}
56
- # @option args [Integer] :page page number counted from 0
57
- # @option args [String] :query_key
58
- # @example
59
- # jobs = Careerbuilder.page({:settings => {
60
- # :api => 'api.careerbuilder.com',
61
- # :version => 'v2',
62
- # :clientid => 'secret-code'},
63
- # :page => 5,
64
- # :query_key => 'value from :key returned by search method'})
65
- # @return [Hash] Job offers from specific page
66
- def page(args)
67
- page = args[:page].to_i || 0
68
- if args[:query_key]
69
- limit = result_limit(args[:query_key])
70
- url_request = args[:query_key].gsub(/&resultsToSkip=\d+/, '') << "&resultsToSkip=#{page * limit}"
71
- args[:query_key] = url_request
72
- search(args)
73
- end
74
- end
75
-
76
- private
77
-
78
- def build_jobs_table(response, url_request)
79
- attributes = Hash.new
80
- attributes[:code] = response.code.to_i
81
- attributes[:msg] = response.message
82
-
83
- attributes[:totalResults] = 0
84
- attributes[:page] = nil
85
- attributes[:last] = nil
86
- attributes[:key] = url_request
87
- attributes[:jobs] = nil
88
-
89
-
90
- if response.code.to_i == 200
91
- json_response = JSON.parse(response.body)
92
- begin
93
- if !json_response['results'].to_s.empty?
94
- attributes[:totalResults] = json_response['totalResults'] || 0
95
-
96
- page_info = paging_info(url_request, attributes[:totalResults])
97
- attributes[:page] = page_info.page
98
- attributes[:last] = page_info.last
99
-
100
- attributes[:key] = url_request
101
- attributes[:jobs] = parse_raw_data(json_response)
102
- end
103
- rescue
104
- raise "Something wrong with returned data: #{json_response}"
105
- end
106
- end
107
- attributes
108
- end
109
-
110
- def api_request(url, clientid = nil)
111
- opt = Hash.new
112
-
113
- if clientid
114
- opt = { :basic_auth => {
115
- :username => clientid,
116
- :password => ''
117
- }}
118
- end
119
-
120
- send_request(url, opt)
121
- end
122
-
123
- def prepare_query(args)
124
- "keywords=#{args[:query][:keywords]}&locationName=#{args[:query][:location]}"
125
- end
126
-
127
- def prepare_conn_string(args)
128
- conn_string = "https://#{args[:settings][:api]}/#{args[:settings][:version]}/search?resultsToTake=#{RESULT_LIMIT}&"
129
- conn_string
130
- end
131
-
132
- def parse_raw_data(data)
133
- jobs = Array.new
134
- data['results'].each do |offer|
135
- job = Hash.new
136
- job[:jobtitle] = offer['jobTitle'] if offer['jobTitle']
137
- job[:location] = "United Kingdom, #{offer['locationName']}"
138
- job[:company] = offer['employerName']
139
- job[:date] = convert_date_to_format(offer['date'],'%d/%m/%y')
140
- job[:url] = offer['jobUrl']
141
-
142
- job = convert_empty_to_nil(job)
143
-
144
- jobs << OpenStruct.new(job)
145
- end
146
- jobs
147
- rescue
148
- raise "Cannot parse raw data: #{data}"
149
- end
150
-
151
- def result_limit(url)
152
- result = url.match(/\resultsToTake=(\d+)/)
153
- result ? result[1].to_i : RESULT_LIMIT
154
- end
155
-
156
- def result_skip(url)
157
- result = url.match(/\&resultsToSkip=(\d+)/)
158
- result ? result[1].to_i : 0
159
- end
160
-
161
- def paging_info(url, total_result)
162
- return OpenStruct.new({:page => nil, :last => nil}) if total_result == 0
163
-
164
- result_limit = result_limit(url)
165
- result_skip = result_skip(url)
166
-
167
- if result_skip == 0 && total_result > 0
168
- page = 0
169
- else
170
- page = (result_skip / result_limit).to_i
171
- end
172
-
173
- mod = total_result.to_i % result_limit.to_i
174
- if mod == 0
175
- last = (total_result.to_i / result_limit.to_i) - 1
176
- else
177
- last = (total_result.to_i / result_limit.to_i).to_i
178
- end
179
-
180
- OpenStruct.new({:page => page, :last => last})
181
- end
182
-
183
- end
184
- end
185
- end
1
+ require 'ostruct'
2
+
3
+ module HawatelSearchJobs
4
+ module Api
5
+ ##
6
+ # = Reed.co.uk API
7
+ #
8
+ # @see https://www.reed.co.uk/developers/Jobseeker
9
+ module Reed
10
+ class << self
11
+ include HawatelSearchJobs::Helpers::Base
12
+
13
+ DEFAULT = {
14
+ :keywords => '',
15
+ :location => '',
16
+ }
17
+
18
+ RESULT_LIMIT = 25
19
+
20
+ # Search jobs by specific criteria
21
+ # @param [Hash] args
22
+ # @option args :settings [Hash] search criteria
23
+ # - *:api* (String) - URL API (default: reed.co.uk/api)
24
+ # - *:version* (String) - a version of API (default: 1.0)
25
+ # - *:clientid* (String) - API Key (see https://www.reed.co.uk/developers/Jobseeker)
26
+ # @option args :query [Hash] settings of API
27
+ # - *:keywors* (String)
28
+ # - *:location* (String)
29
+ # @example
30
+ # jobs = Reed.search({:settings => {
31
+ # :api => 'reed.co.uk/api',
32
+ # :version => '1.0',
33
+ # :clientid => 'secret-code'},
34
+ # :query => {
35
+ # :keywords => 'ruby',
36
+ # :location => 'London'})
37
+ # @return [Hash] First page of the result (see constant RESULT_LIMIT)
38
+ def search(args)
39
+ args[:query] = DEFAULT.merge(args[:query]) if args[:query]
40
+
41
+ if args[:query_key].nil?
42
+ url_request = prepare_conn_string(args) + prepare_query(args)
43
+ else
44
+ url_request = args[:query_key]
45
+ end
46
+
47
+ response = api_request(url_request, args[:settings][:clientid])
48
+ attributes = build_jobs_table(response, url_request)
49
+ OpenStruct.new(attributes)
50
+ end
51
+
52
+ # Get a specific page result
53
+ # At the beging you have to run {search} method and get :key from result and pass it to the argument :query_key
54
+ # @param [Hash] args
55
+ # @option args :settings [Hash] see {search}
56
+ # @option args [Integer] :page page number counted from 0
57
+ # @option args [String] :query_key
58
+ # @example
59
+ # jobs = Careerbuilder.page({:settings => {
60
+ # :api => 'api.careerbuilder.com',
61
+ # :version => 'v2',
62
+ # :clientid => 'secret-code'},
63
+ # :page => 5,
64
+ # :query_key => 'value from :key returned by search method'})
65
+ # @return [Hash] Job offers from specific page
66
+ def page(args)
67
+ page = args[:page].to_i || 0
68
+ if args[:query_key]
69
+ limit = result_limit(args[:query_key])
70
+ url_request = args[:query_key].gsub(/&resultsToSkip=\d+/, '') << "&resultsToSkip=#{page * limit}"
71
+ args[:query_key] = url_request
72
+ search(args)
73
+ end
74
+ end
75
+
76
+ private
77
+
78
+ def build_jobs_table(response, url_request)
79
+ attributes = Hash.new
80
+ attributes[:code] = response.code.to_i
81
+ attributes[:msg] = response.message
82
+
83
+ attributes[:totalResults] = 0
84
+ attributes[:page] = nil
85
+ attributes[:last] = nil
86
+ attributes[:key] = url_request
87
+ attributes[:jobs] = nil
88
+
89
+
90
+ if response.code.to_i == 200
91
+ json_response = JSON.parse(response.body)
92
+ begin
93
+ if !json_response['results'].to_s.empty?
94
+ attributes[:totalResults] = json_response['totalResults'] || 0
95
+
96
+ page_info = paging_info(url_request, attributes[:totalResults])
97
+ attributes[:page] = page_info.page
98
+ attributes[:last] = page_info.last
99
+
100
+ attributes[:key] = url_request
101
+ attributes[:jobs] = parse_raw_data(json_response)
102
+ end
103
+ rescue
104
+ raise "Something wrong with returned data: #{json_response}"
105
+ end
106
+ end
107
+ attributes
108
+ end
109
+
110
+ def api_request(url, clientid = nil)
111
+ opt = Hash.new
112
+
113
+ if clientid
114
+ opt = { :basic_auth => {
115
+ :username => clientid,
116
+ :password => ''
117
+ }}
118
+ end
119
+
120
+ send_request(url, opt)
121
+ end
122
+
123
+ def prepare_query(args)
124
+ "keywords=#{args[:query][:keywords]}&locationName=#{args[:query][:location]}"
125
+ end
126
+
127
+ def prepare_conn_string(args)
128
+ conn_string = "https://#{args[:settings][:api]}/#{args[:settings][:version]}/search?resultsToTake=#{RESULT_LIMIT}&"
129
+ conn_string
130
+ end
131
+
132
+ def parse_raw_data(data)
133
+ jobs = Array.new
134
+ data['results'].each do |offer|
135
+ job = Hash.new
136
+ job[:jobtitle] = offer['jobTitle'] if offer['jobTitle']
137
+ job[:location] = "United Kingdom, #{offer['locationName']}"
138
+ job[:company] = offer['employerName']
139
+ job[:date] = convert_date_to_format(offer['date'],'%d/%m/%y')
140
+ job[:url] = offer['jobUrl']
141
+
142
+ job = convert_empty_to_nil(job)
143
+
144
+ jobs << OpenStruct.new(job)
145
+ end
146
+ jobs
147
+ rescue
148
+ raise "Cannot parse raw data: #{data}"
149
+ end
150
+
151
+ def result_limit(url)
152
+ result = url.match(/\resultsToTake=(\d+)/)
153
+ result ? result[1].to_i : RESULT_LIMIT
154
+ end
155
+
156
+ def result_skip(url)
157
+ result = url.match(/\&resultsToSkip=(\d+)/)
158
+ result ? result[1].to_i : 0
159
+ end
160
+
161
+ def paging_info(url, total_result)
162
+ return OpenStruct.new({:page => nil, :last => nil}) if total_result == 0
163
+
164
+ result_limit = result_limit(url)
165
+ result_skip = result_skip(url)
166
+
167
+ if result_skip == 0 && total_result > 0
168
+ page = 0
169
+ else
170
+ page = (result_skip / result_limit).to_i
171
+ end
172
+
173
+ mod = total_result.to_i % result_limit.to_i
174
+ if mod == 0
175
+ last = (total_result.to_i / result_limit.to_i) - 1
176
+ else
177
+ last = (total_result.to_i / result_limit.to_i).to_i
178
+ end
179
+
180
+ OpenStruct.new({:page => page, :last => last})
181
+ end
182
+
183
+ end
184
+ end
185
+ end
186
186
  end
@@ -1,165 +1,172 @@
1
- module HawatelSearchJobs
2
- ##
3
- # = Client for a jobs search engine
4
- #
5
- # @!attribute [rw] indeed
6
- # @return [Hash] settings of API
7
- # @!attribute [rw] xing
8
- # @return [Hash] settings of API
9
- # @!attribute [rw] reed
10
- # @return [Hash] settings of API
11
- # @!attribute [rw] careerbuilder
12
- # @return [Hash] settings of API
13
- # @!attribute [rw] careerjet
14
- # @return [Hash] settings of API
15
- class Client
16
- include HawatelSearchJobs::Api
17
-
18
- # Values have to be the same name like module name of usesd APIs (HawatelSearchJobs::Api::[ApiName])
19
- APIS = ['Indeed', 'Xing', 'Reed', 'Careerbuilder', 'CareerJet']
20
-
21
- attr_reader :jobs_table
22
-
23
- DEFAULT = {
24
- :keywords => '',
25
- :location => '',
26
- :company => '',
27
- }
28
-
29
- def initialize
30
- APIS.each do |api|
31
- metaclasses.send(:attr_reader, api.downcase.to_sym)
32
- instance_variable_set("@#{api.downcase}", HawatelSearchJobs.instance_variable_get("@"+api.downcase))
33
- end
34
- end
35
-
36
- def metaclasses
37
- class << self; self; end
38
- end
39
-
40
- # Search Jobs by specific criteria
41
- # @param query [Hash]
42
- # @option query [String] :keywords
43
- # @option query [String] :location
44
- # @option query [String] :company not working in Reed API
45
- # @example
46
- # HawatelSearchJobs.configure do |config|
47
- # config.indeed[:activated] = true
48
- # config.indeed[:api] = 'api.indeed.com'
49
- # config.indeed[:version] = '2'
50
- # config.indeed[:publisher] = 'secret-key'
51
- #
52
- # config.xing[:activated] = true
53
- # config.xing[:consumer_key] = 'secret-key'
54
- # config.xing[:consumer_secret] = 'secret-key'
55
- # config.xing[:oauth_token] = 'secret-key'
56
- # config.xing[:oauth_token_secret] = 'secret-key'
57
- #
58
- # config.reed[:activated] = true
59
- # config.reed[:api] = 'reed.co.uk/api'
60
- # config.reed[:clientid] = 'secret-key'
61
- # config.reed[:version] = '1.0'
62
- #
63
- # config.careerbuilder[:activated] = true
64
- # config.careerbuilder[:api] = 'api.careerbuilder.com'
65
- # config.careerbuilder[:clientid] = 'secret-key'
66
- # config.careerbuilder[:version] = 'v2'
67
- #
68
- # config.careerjet[:activated] = true
69
- # config.careerjet[:api] = 'public.api.careerjet.net'
70
- # end
71
- #
72
- # client = HawatelSearchJobs::Client.new
73
- # client.search_jobs({:keywords => 'ruby'})
74
- #
75
- # p client.jobs_table[:indeed]
76
- # p client.jobs_table[:xing]
77
- # p client.jobs_table[:reed]
78
- # p client.jobs_table[:careerbuilder]
79
- # p client.jobs_table[:careerjet]
80
- #
81
- # client.next
82
- # @return [Hash] First page of result for all providers (default maximum 25 records for each page)
83
- def search_jobs(query = {})
84
- query = DEFAULT.merge(query)
85
-
86
- @jobs_table = Hash.new
87
-
88
- APIS.each do |api|
89
- api_module_name = Object.const_get('HawatelSearchJobs').const_get('Api').const_get(api)
90
- api_inst_var = instance_variable_get("@"+api.downcase)
91
- @jobs_table[api.downcase.to_sym] = api_module_name.search({:settings => api_inst_var, :query => query}) if api_inst_var[:activated]
92
- end
93
-
94
- @jobs_table
95
- end
96
-
97
- # Get next page of result
98
- # @example
99
- # p client.next
100
- # p client.jobs_table
101
- # @return [Hash] Next page of result for all providers (default maximum 25 records for each)
102
- def next
103
- next_result = Hash.new
104
- APIS.each do |api|
105
- api_module_name = Object.const_get('HawatelSearchJobs').const_get('Api').const_get(api)
106
- api_inst_var = instance_variable_get("@"+api.downcase)
107
- api_sym_name = api.downcase.to_sym
108
-
109
- if api_inst_var[:activated] && next_result?(api_sym_name)
110
- next_result[api_sym_name] = api_module_name.page({:settings => api_inst_var,
111
- :page => @jobs_table[api_sym_name].page + 1,
112
- :query_key => @jobs_table[api_sym_name].key})
113
- end
114
- end
115
-
116
- return nil if next_result.empty?
117
-
118
- @jobs_table = next_result
119
- end
120
-
121
-
122
- # Sum jobs offers from specified api or count all
123
- #
124
- # @param args [Hash]
125
- # @option args [String] :api name
126
- # @example
127
- # p client.count
128
- # p client.count('indeed')
129
- #
130
- # @return [Integer]
131
- def count(api = nil)
132
- sum = 0
133
-
134
- if api
135
- api = api.downcase
136
- api_inst_var = instance_variable_get("@"+api)
137
- if api_inst_var[:activated]
138
- sum = @jobs_table[:"#{api}"].totalResults if @jobs_table[:"#{api}"].totalResults
139
- end
140
- else
141
- APIS.each do |provider|
142
- api_inst_var = instance_variable_get("@"+provider.downcase)
143
- if api_inst_var[:activated]
144
- provider = provider.downcase
145
- sum += @jobs_table[:"#{provider}"].totalResults if @jobs_table[:"#{provider}"].totalResults
146
- end
147
- end
148
- end
149
- return sum
150
- end
151
-
152
- private
153
- def next_result?(provider)
154
- if @jobs_table[provider] && @jobs_table[provider].page && @jobs_table[provider].last &&
155
- @jobs_table[provider].page < @jobs_table[provider].last
156
- true
157
- else
158
- false
159
- end
160
-
161
- end
162
-
163
- end
164
- end
165
-
1
+ module HawatelSearchJobs
2
+ ##
3
+ # = Client for a jobs search engine
4
+ #
5
+ # @!attribute [rw] indeed
6
+ # @return [Hash] settings of API
7
+ # @!attribute [rw] xing
8
+ # @return [Hash] settings of API
9
+ # @!attribute [rw] reed
10
+ # @return [Hash] settings of API
11
+ # @!attribute [rw] careerbuilder
12
+ # @return [Hash] settings of API
13
+ # @!attribute [rw] careerjet
14
+ # @return [Hash] settings of API
15
+ class Client
16
+ include HawatelSearchJobs::Api
17
+
18
+ # Values have to be the same name like module name of usesd APIs (HawatelSearchJobs::Api::[ApiName])
19
+ APIS = ['Indeed', 'Xing', 'Reed', 'Careerbuilder', 'CareerJet']
20
+
21
+ attr_reader :jobs_table
22
+
23
+ DEFAULT = {
24
+ :keywords => '',
25
+ :location => '',
26
+ :company => '',
27
+ }
28
+
29
+ def initialize
30
+ APIS.each do |api|
31
+ metaclasses.send(:attr_reader, api.downcase.to_sym)
32
+ api_conf = HawatelSearchJobs.instance_variable_get("@"+api.downcase)
33
+
34
+ if api_conf.nil?
35
+ HawatelSearchJobs.configure
36
+ api_conf = HawatelSearchJobs.instance_variable_get("@"+api.downcase)
37
+ end
38
+
39
+ instance_variable_set("@#{api.downcase}", api_conf.dup)
40
+ end
41
+ end
42
+
43
+ def metaclasses
44
+ class << self; self; end
45
+ end
46
+
47
+ # Search Jobs by specific criteria
48
+ # @param query [Hash]
49
+ # @option query [String] :keywords
50
+ # @option query [String] :location
51
+ # @option query [String] :company not working in Reed API
52
+ # @example
53
+ # HawatelSearchJobs.configure do |config|
54
+ # config.indeed[:activated] = true
55
+ # config.indeed[:api] = 'api.indeed.com'
56
+ # config.indeed[:version] = '2'
57
+ # config.indeed[:publisher] = 'secret-key'
58
+ #
59
+ # config.xing[:activated] = true
60
+ # config.xing[:consumer_key] = 'secret-key'
61
+ # config.xing[:consumer_secret] = 'secret-key'
62
+ # config.xing[:oauth_token] = 'secret-key'
63
+ # config.xing[:oauth_token_secret] = 'secret-key'
64
+ #
65
+ # config.reed[:activated] = true
66
+ # config.reed[:api] = 'reed.co.uk/api'
67
+ # config.reed[:clientid] = 'secret-key'
68
+ # config.reed[:version] = '1.0'
69
+ #
70
+ # config.careerbuilder[:activated] = true
71
+ # config.careerbuilder[:api] = 'api.careerbuilder.com'
72
+ # config.careerbuilder[:clientid] = 'secret-key'
73
+ # config.careerbuilder[:version] = 'v2'
74
+ #
75
+ # config.careerjet[:activated] = true
76
+ # config.careerjet[:api] = 'public.api.careerjet.net'
77
+ # end
78
+ #
79
+ # client = HawatelSearchJobs::Client.new
80
+ # client.search_jobs({:keywords => 'ruby'})
81
+ #
82
+ # p client.jobs_table[:indeed]
83
+ # p client.jobs_table[:xing]
84
+ # p client.jobs_table[:reed]
85
+ # p client.jobs_table[:careerbuilder]
86
+ # p client.jobs_table[:careerjet]
87
+ #
88
+ # client.next
89
+ # @return [Hash] First page of result for all providers (default maximum 25 records for each page)
90
+ def search_jobs(query = {})
91
+ query = DEFAULT.merge(query)
92
+
93
+ @jobs_table = Hash.new
94
+
95
+ APIS.each do |api|
96
+ api_module_name = Object.const_get('HawatelSearchJobs').const_get('Api').const_get(api)
97
+ api_inst_var = instance_variable_get("@"+api.downcase)
98
+ @jobs_table[api.downcase.to_sym] = api_module_name.search({:settings => api_inst_var, :query => query}) if api_inst_var[:activated]
99
+ end
100
+
101
+ @jobs_table
102
+ end
103
+
104
+ # Get next page of result
105
+ # @example
106
+ # p client.next
107
+ # p client.jobs_table
108
+ # @return [Hash] Next page of result for all providers (default maximum 25 records for each)
109
+ def next
110
+ next_result = Hash.new
111
+ APIS.each do |api|
112
+ api_module_name = Object.const_get('HawatelSearchJobs').const_get('Api').const_get(api)
113
+ api_inst_var = instance_variable_get("@"+api.downcase)
114
+ api_sym_name = api.downcase.to_sym
115
+
116
+ if api_inst_var[:activated] && next_result?(api_sym_name)
117
+ next_result[api_sym_name] = api_module_name.page({:settings => api_inst_var,
118
+ :page => @jobs_table[api_sym_name].page + 1,
119
+ :query_key => @jobs_table[api_sym_name].key})
120
+ end
121
+ end
122
+
123
+ return nil if next_result.empty?
124
+
125
+ @jobs_table = next_result
126
+ end
127
+
128
+
129
+ # Sum jobs offers from specified api or count all
130
+ #
131
+ # @param args [Hash]
132
+ # @option args [String] :api name
133
+ # @example
134
+ # p client.count
135
+ # p client.count('indeed')
136
+ #
137
+ # @return [Integer]
138
+ def count(api = nil)
139
+ sum = 0
140
+
141
+ if api
142
+ api = api.downcase
143
+ api_inst_var = instance_variable_get("@"+api)
144
+ if api_inst_var[:activated]
145
+ sum = @jobs_table[:"#{api}"].totalResults if @jobs_table[:"#{api}"].totalResults
146
+ end
147
+ else
148
+ APIS.each do |provider|
149
+ api_inst_var = instance_variable_get("@"+provider.downcase)
150
+ if api_inst_var[:activated]
151
+ provider = provider.downcase
152
+ sum += @jobs_table[:"#{provider}"].totalResults if @jobs_table[:"#{provider}"].totalResults
153
+ end
154
+ end
155
+ end
156
+ return sum
157
+ end
158
+
159
+ private
160
+ def next_result?(provider)
161
+ if @jobs_table[provider] && @jobs_table[provider].page && @jobs_table[provider].last &&
162
+ @jobs_table[provider].page < @jobs_table[provider].last
163
+ true
164
+ else
165
+ false
166
+ end
167
+
168
+ end
169
+
170
+ end
171
+ end
172
+