hawatel_search_jobs 0.2.1 → 0.3.0

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.
@@ -12,11 +12,13 @@ module HawatelSearchJobs
12
12
  # @return [Hash] settings of API
13
13
  # @!attribute [rw] careerjet
14
14
  # @return [Hash] settings of API
15
+ # @!attribute [rw] upwork
16
+ # @return [Hash] settings of API
15
17
  class Client
16
18
  include HawatelSearchJobs::Api
17
19
 
18
20
  # Values have to be the same name like module name of usesd APIs (HawatelSearchJobs::Api::[ApiName])
19
- APIS = ['Indeed', 'Xing', 'Reed', 'Careerbuilder', 'CareerJet']
21
+ APIS = ['Indeed', 'Xing', 'Reed', 'Careerbuilder', 'CareerJet', 'Upwork']
20
22
 
21
23
  attr_reader :jobs_table
22
24
 
@@ -79,6 +81,11 @@ module HawatelSearchJobs
79
81
  # config.careerjet[:activated] = true
80
82
  # config.careerjet[:api] = 'public.api.careerjet.net'
81
83
  # config.careerjet[:page_size] = 25 # allowed range <1,99>
84
+ #
85
+ # config.upwork[:activated] = true
86
+ # config.upwork[:consumer_key] = 'secret-key'
87
+ # config.upwork[:consumer_secret] = 'secret-key'
88
+ # config.upwork[:page_size] = 25 # allowed range <1,100>
82
89
  # end
83
90
  #
84
91
  # client = HawatelSearchJobs::Client.new
@@ -89,6 +96,7 @@ module HawatelSearchJobs
89
96
  # p client.jobs_table[:reed]
90
97
  # p client.jobs_table[:careerbuilder]
91
98
  # p client.jobs_table[:careerjet]
99
+ # p client.jobs_table[:upwork]
92
100
  #
93
101
  # client.next
94
102
  # @return [Hash] First page of result for all providers (default maximum 25 records for each page)
@@ -133,8 +141,7 @@ module HawatelSearchJobs
133
141
 
134
142
  # Sum jobs offers from specified api or count all
135
143
  #
136
- # @param args [Hash]
137
- # @option args [String] :api name
144
+ # @param api [String] api name
138
145
  # @example
139
146
  # p client.count
140
147
  # p client.count('indeed')
@@ -1,3 +1,3 @@
1
1
  module HawatelSearchJobs
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -50,6 +50,14 @@ describe HawatelSearchJobs::Client do
50
50
  config.careerjet[:activated] =true
51
51
  config.careerjet[:api] = 'public.api.careerjet.net'
52
52
  config.careerjet[:page_size] = 70
53
+
54
+ config.upwork[:activated] = false
55
+ config.upwork[:consumer_key] = ''
56
+ config.upwork[:consumer_secret] = ''
57
+ config.upwork[:oauth_token] = ''
58
+ config.upwork[:oauth_token_secret] = ''
59
+ config.upwork[:page_size] = 20
60
+
53
61
  end
54
62
  end
55
63
 
@@ -1,2 +1,2 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'hawatel_search_jobs'
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'hawatel_search_jobs'
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+ require 'upwork/api'
3
+ require 'upwork/api/routers/jobs/search'
4
+
5
+ xdescribe "HawatelSearchJobs::Api::Upwork" do
6
+
7
+ before(:each) do
8
+ HawatelSearchJobs.configure do |config|
9
+ config.upwork[:consumer_key] = ''
10
+ config.upwork[:consumer_secret] = ''
11
+ config.upwork[:oauth_token] = ''
12
+ config.upwork[:oauth_token_secret] = ''
13
+ config.upwork[:page_size] = 100
14
+ end
15
+ end
16
+
17
+ let(:client) { return HawatelSearchJobs::Client.new }
18
+ let(:result) {
19
+ return HawatelSearchJobs::Api::Upwork.search(
20
+ :settings => HawatelSearchJobs.upwork,
21
+ :query => { :keywords => 'ruby', :company => '' }
22
+ )}
23
+
24
+ it "metadata from search() result" do
25
+ expect(result.page).to be_a_kind_of(Integer)
26
+ expect(result.last).to be_a_kind_of(Integer)
27
+ expect(result.totalResults).to be_a_kind_of(Integer)
28
+ end
29
+
30
+ it "job attributes from search() result" do
31
+ not_nil = 0
32
+ result.jobs.each do |job|
33
+ expect(job.jobtitle).to be_a_kind_of(String)
34
+ not_nil += 1 if !job.location.nil?
35
+ expect(job.company).to be_a_kind_of(String)
36
+ expect(job.url).to include('http')
37
+ end
38
+ expect(not_nil).to be > 0
39
+ end
40
+
41
+ it "count of jobs is the same like page_size" do
42
+ expect(result.jobs.count).to eq(HawatelSearchJobs.upwork[:page_size])
43
+ puts result.jobs.inspect
44
+ end
45
+
46
+ it "call page() without specified page (default 0)" do
47
+ jobs = HawatelSearchJobs::Api::Upwork.page({:settings => HawatelSearchJobs.upwork, :query_key => result.key})
48
+ expect(jobs.page).to eq(0)
49
+ end
50
+
51
+ it "call page() with specified page" do
52
+ jobs = HawatelSearchJobs::Api::Upwork.page({:settings => HawatelSearchJobs.upwork, :query_key => result.key, :page => 1})
53
+ expect(jobs.page).to eq(1)
54
+ end
55
+
56
+ it "next page does not contain last page" do
57
+ jobs_first = HawatelSearchJobs::Api::Upwork.page({:settings => HawatelSearchJobs.upwork, :query_key => result.key, :page => 1})
58
+ expect(jobs_first.page).to eq(1)
59
+
60
+ jobs_second = HawatelSearchJobs::Api::Upwork.page({:settings => HawatelSearchJobs.upwork, :query_key => result.key, :page => 2})
61
+ expect(jobs_second.page).to eq(2)
62
+
63
+ jobs_first.jobs.each do |first_job|
64
+ jobs_second.jobs.each do |second_job|
65
+ expect(first_job.url).not_to eq(second_job.url)
66
+ end
67
+ end
68
+
69
+ end
70
+
71
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hawatel_search_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Przemyslaw Mantaj
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-29 00:00:00.000000000 Z
12
+ date: 2016-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xing_api
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: upwork-api
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: activesupport
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +98,7 @@ dependencies:
84
98
  description: |-
85
99
  Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites
86
100
  to get current job offers. At this moment, supported backends are indeed.com, careerjet.com,
87
- xing.com, careerbuilder.com and reed.co.uk.
101
+ xing.com, careerbuilder.com, reed.co.uk, and upwork.com.
88
102
  email:
89
103
  - przemyslaw.mantaj@hawatel.com
90
104
  - daniel.iwaniuk@hawatel.com
@@ -110,6 +124,7 @@ files:
110
124
  - lib/hawatel_search_jobs/api/careerjet.rb
111
125
  - lib/hawatel_search_jobs/api/indeed.rb
112
126
  - lib/hawatel_search_jobs/api/reed.rb
127
+ - lib/hawatel_search_jobs/api/upwork.rb
113
128
  - lib/hawatel_search_jobs/api/xing.rb
114
129
  - lib/hawatel_search_jobs/client.rb
115
130
  - lib/hawatel_search_jobs/helpers.rb
@@ -121,6 +136,7 @@ files:
121
136
  - spec/indeed_spec.rb
122
137
  - spec/reed_spec.rb
123
138
  - spec/spec_helper.rb
139
+ - spec/upwork_spec.rb
124
140
  - spec/xing_spec.rb
125
141
  homepage: http://github.com/Hawatel/hawatel_search_jobs
126
142
  licenses:
@@ -134,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
150
  requirements:
135
151
  - - ">="
136
152
  - !ruby/object:Gem::Version
137
- version: 2.0.0
153
+ version: 2.2.2
138
154
  required_rubygems_version: !ruby/object:Gem::Requirement
139
155
  requirements:
140
156
  - - ">="
@@ -154,5 +170,5 @@ test_files:
154
170
  - spec/indeed_spec.rb
155
171
  - spec/reed_spec.rb
156
172
  - spec/spec_helper.rb
173
+ - spec/upwork_spec.rb
157
174
  - spec/xing_spec.rb
158
- has_rdoc: