1
|
|
|
<?php namespace JobApis\Jobs\Client\Queries; |
2
|
|
|
|
3
|
|
|
class CareercastQuery extends AbstractQuery |
4
|
|
|
{ |
5
|
|
|
/** |
6
|
|
|
* Search keyword |
7
|
|
|
* |
8
|
|
|
* @var string |
9
|
|
|
*/ |
10
|
|
|
protected $keyword; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Results per page |
14
|
|
|
* |
15
|
|
|
* @var integer |
16
|
|
|
*/ |
17
|
|
|
protected $rows; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Page number |
21
|
|
|
* |
22
|
|
|
* @var integer |
23
|
|
|
*/ |
24
|
|
|
protected $page; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Radius from location (in miles). |
28
|
|
|
* |
29
|
|
|
* @var integer |
30
|
|
|
*/ |
31
|
|
|
protected $radius; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Job title (must match one of Careercast's standard titles) |
35
|
|
|
* |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
protected $normalizedJobTitle; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Job category (must match one of Careercast's standard categories) |
42
|
|
|
* |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
protected $category; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Company name |
49
|
|
|
* |
50
|
|
|
* @var string |
51
|
|
|
*/ |
52
|
|
|
protected $company; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Job source |
56
|
|
|
* |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
protected $jobSource; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Date the job was posted |
63
|
|
|
* |
64
|
|
|
* @var string |
65
|
|
|
*/ |
66
|
|
|
protected $postDate; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Results format ("json" or "rss") |
70
|
|
|
* |
71
|
|
|
* @var string |
72
|
|
|
*/ |
73
|
|
|
protected $format; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Work status |
77
|
|
|
* |
78
|
|
|
* @var string |
79
|
|
|
*/ |
80
|
|
|
protected $workStatus; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Location |
84
|
|
|
* |
85
|
|
|
* @var string |
86
|
|
|
*/ |
87
|
|
|
protected $location; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Only look for keywords in title |
91
|
|
|
* |
92
|
|
|
* @var string |
93
|
|
|
*/ |
94
|
|
|
protected $kwsJobTitleOnly; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Sort by. Options: |
98
|
|
|
* |
99
|
|
|
* PostDate |
100
|
|
|
* score |
101
|
|
|
* geo_distance |
102
|
|
|
* JobTitle |
103
|
|
|
* Company |
104
|
|
|
* IsFeatured |
105
|
|
|
* scorelocation |
106
|
|
|
* Priority |
107
|
|
|
* |
108
|
|
|
* Can be followed with " desc" or " asc" |
109
|
|
|
* |
110
|
|
|
* Can also use multiple sort options by comma delimiting them. |
111
|
|
|
* |
112
|
|
|
* @var string |
113
|
|
|
*/ |
114
|
|
|
protected $sort; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Get baseUrl |
118
|
|
|
* |
119
|
|
|
* @return string Value of the base url to this api |
120
|
|
|
*/ |
121
|
6 |
|
public function getBaseUrl() |
122
|
|
|
{ |
123
|
6 |
|
return 'http://www.careercast.com/jobs/results/keyword/'; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Get keyword |
128
|
|
|
* |
129
|
|
|
* @return string Attribute being used as the search keyword |
130
|
|
|
*/ |
131
|
6 |
|
public function getKeyword() |
132
|
|
|
{ |
133
|
6 |
|
return $this->keyword; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Get query string for client based on properties |
138
|
|
|
* |
139
|
|
|
* @return string |
140
|
|
|
*/ |
141
|
4 |
|
public function getQueryString() |
142
|
|
|
{ |
143
|
4 |
|
$keyword = urlencode($this->keyword); |
144
|
|
|
|
145
|
4 |
|
return $keyword.'?'.http_build_query($this->getQueryAttributes()); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Default parameters |
150
|
|
|
* |
151
|
|
|
* @var array |
152
|
|
|
*/ |
153
|
18 |
|
protected function defaultAttributes() |
154
|
|
|
{ |
155
|
|
|
return [ |
156
|
18 |
|
'format' => 'json', |
157
|
18 |
|
]; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Gets the attributes to use for this API's query |
162
|
|
|
* |
163
|
|
|
* @var array |
164
|
|
|
*/ |
165
|
4 |
|
protected function getQueryAttributes() |
166
|
|
|
{ |
167
|
4 |
|
$attributes = get_object_vars($this); |
168
|
4 |
|
unset($attributes['keyword']); |
169
|
4 |
|
return $attributes; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Required attributes for the query |
174
|
|
|
* |
175
|
|
|
* @var array |
176
|
|
|
*/ |
177
|
6 |
|
protected function requiredAttributes() |
178
|
|
|
{ |
179
|
|
|
return [ |
180
|
6 |
|
'keyword', |
181
|
6 |
|
]; |
182
|
|
|
} |
183
|
|
|
} |
184
|
|
|
|