bumeran 0.0.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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/lib/bumeran.rb +368 -0
- data/lib/bumeran/version.rb +3 -0
- data/lib/tasks/bumeran_tasks.rake +4 -0
- data/test/bumeran_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/test_helper.rb +18 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 81d81ce21ddcbb420694be00624d395d06293d0d
|
4
|
+
data.tar.gz: d2844c98bcd242e2c8f3e3c844d41be30b9245f2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71f1b87fcfb20d638343214519ec9312a6e8fba048045db0f75ea2ea3cfecadcd5db537a96b641eb3553e3c21e2fda29f2004c826484203fa5be41f7fc05247f
|
7
|
+
data.tar.gz: 2222e75b6425f60f313e4e1cbac04564e21d794fe5650df62bab1b15d456fc76bda78fe9216152f640c7942e82474cda5b76592ce9dcaeb35a21838e8cc8d9ba
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 Rodrigo Fernandez
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Bumeran'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
data/lib/bumeran.rb
ADDED
@@ -0,0 +1,368 @@
|
|
1
|
+
#module Bumeran
|
2
|
+
#end
|
3
|
+
require 'httparty'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
class Bumeran
|
7
|
+
include HTTParty
|
8
|
+
base_uri 'https://developers.bumeran.com'
|
9
|
+
|
10
|
+
# API login configuration, need initialization setup to work
|
11
|
+
mattr_accessor :grant_type
|
12
|
+
@@grant_type = "password"
|
13
|
+
|
14
|
+
mattr_accessor :client_id
|
15
|
+
@@client_id = nil
|
16
|
+
|
17
|
+
mattr_accessor :username
|
18
|
+
@@username = nil
|
19
|
+
|
20
|
+
mattr_accessor :email
|
21
|
+
@@email = nil
|
22
|
+
|
23
|
+
mattr_accessor :password
|
24
|
+
@@password = nil
|
25
|
+
|
26
|
+
|
27
|
+
# Default way to setup Bumeran.
|
28
|
+
def self.setup
|
29
|
+
yield self
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize
|
33
|
+
auth_token = login
|
34
|
+
@options = { query: {access_token: auth_token} }
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def default_publication_json
|
39
|
+
return {
|
40
|
+
descripcion: "",
|
41
|
+
titulo: "",
|
42
|
+
referencia: "", #optional
|
43
|
+
tipoTrabajoId: 0,
|
44
|
+
denominacion: {
|
45
|
+
id: 0,
|
46
|
+
nombre: "",
|
47
|
+
logo: ""
|
48
|
+
},
|
49
|
+
preguntas: [ # optional
|
50
|
+
{
|
51
|
+
simple: {
|
52
|
+
texto: ""
|
53
|
+
}
|
54
|
+
}
|
55
|
+
],
|
56
|
+
postulantesDiscapacitados: false, #optional
|
57
|
+
lugarTrabajo: {
|
58
|
+
id: 0,
|
59
|
+
direccion: "",
|
60
|
+
zonaId: 0,
|
61
|
+
paisId: 0,
|
62
|
+
localidadId: 0,
|
63
|
+
mostrarDireccionEnAviso: false
|
64
|
+
},
|
65
|
+
recepcionCandidato: {},
|
66
|
+
areaId: 0,
|
67
|
+
subAreaId: 0,
|
68
|
+
requisitos: { # optional
|
69
|
+
experiencia: {
|
70
|
+
minimo: 0,
|
71
|
+
excluyente: false
|
72
|
+
},
|
73
|
+
edad: {
|
74
|
+
edadMinima: 0,
|
75
|
+
edadMaxima: 0,
|
76
|
+
excluyente: false
|
77
|
+
},
|
78
|
+
educacion: {
|
79
|
+
estadoEstudioId: 0,
|
80
|
+
tipoEstudioId: 0,
|
81
|
+
excluyente: false
|
82
|
+
},
|
83
|
+
idiomas: [
|
84
|
+
{
|
85
|
+
nivelId: 0,
|
86
|
+
idiomaId: 0,
|
87
|
+
excluyente: false
|
88
|
+
}
|
89
|
+
],
|
90
|
+
residencia: {
|
91
|
+
cercania: "",
|
92
|
+
cantidadKm: 0,
|
93
|
+
excluyente: false
|
94
|
+
},
|
95
|
+
salario: {
|
96
|
+
tipo: "",
|
97
|
+
salarioMinimo: 0,
|
98
|
+
salarioMaximo: 0,
|
99
|
+
frecuenciaPagoId: 0,
|
100
|
+
mostrarAviso: false,
|
101
|
+
solicitarCandidato: false,
|
102
|
+
excluyente: false
|
103
|
+
},
|
104
|
+
genero: {
|
105
|
+
nombre: "",
|
106
|
+
excluyente: false
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
def publish_test
|
113
|
+
json = default_publication_json
|
114
|
+
json[:descripcion] = ""
|
115
|
+
json[:titulo] = ""
|
116
|
+
#json[:referencia] = "" #optional
|
117
|
+
|
118
|
+
json[:denominacion][:id] = 0
|
119
|
+
json[:denominacion][:nombre] = ""
|
120
|
+
json[:denominacion][:logo] = ""
|
121
|
+
|
122
|
+
json[:preguntas] # optional
|
123
|
+
#json[:preguntas][:texto]
|
124
|
+
|
125
|
+
#json["postulantesDiscapacitados"] false, #optional
|
126
|
+
|
127
|
+
#json["lugarTrabajo"]
|
128
|
+
json[:lugarTrabajo][:id] = 0
|
129
|
+
json[:lugarTrabajo][:direccion] = ""
|
130
|
+
json[:lugarTrabajo][:zonaId] = 0
|
131
|
+
json[:lugarTrabajo][:paisId] = 0
|
132
|
+
json[:lugarTrabajo][:localidadId] = 0
|
133
|
+
json[:lugarTrabajo][:mostrarDireccionEnAviso] = false
|
134
|
+
|
135
|
+
json[:recepcionCandidato] = {}
|
136
|
+
json[:areaId] = 0
|
137
|
+
json[:subAreaId] = 0
|
138
|
+
####json[:requisitos] # optional
|
139
|
+
###json[:requisitos][:experiencia]
|
140
|
+
#json[:requisitos][:experiencia][:minimo] = 0
|
141
|
+
#json[:requisitos][:experiencia][:excluyente] = false
|
142
|
+
###json[:requisitos][:edad]
|
143
|
+
#json[:requisitos][:edad][:edadMinima] = 0
|
144
|
+
#json[:requisitos][:edad][:edadMaxima] = 0
|
145
|
+
#json[:requisitos][:edad][:excluyente] = false
|
146
|
+
###json["requisitos"]["educacion"]
|
147
|
+
#json["requisitos"]["educacion"]["estadoEstudioId"] = 0
|
148
|
+
#json["requisitos"]["educacion"]["tipoEstudioId"] = 0
|
149
|
+
#json["requisitos"]["educacion"]["excluyente"] = false
|
150
|
+
###json["requisitos"]["idiomas"]
|
151
|
+
#json["requisitos"]["idiomas"]["nivelId"] = 0
|
152
|
+
#json["requisitos"]["idiomas"]["idiomaId"] = 0
|
153
|
+
#json["requisitos"]["idiomas"]["excluyente"] = false
|
154
|
+
###json["requisitos"]["residencia"]
|
155
|
+
#json["requisitos"]["residencia"]["cercania"] = ""
|
156
|
+
#json["requisitos"]["residencia"]["cantidadKm"] = 0
|
157
|
+
#json["requisitos"]["residencia"]["excluyente"] = false
|
158
|
+
###json["requisitos"]["salario"]
|
159
|
+
#json["requisitos"]["salario"]["tipo"] = ""
|
160
|
+
#json["requisitos"]["salario"]["salarioMinimo"] = 0
|
161
|
+
#json["requisitos"]["salario"]["salarioMaximo"] = 0
|
162
|
+
#json["requisitos"]["salario"]["frecuenciaPagoId"] = 0
|
163
|
+
#json["requisitos"]["salario"]["mostrarAviso"] = false
|
164
|
+
#json["requisitos"]["salario"]["solicitarCandidato"] = false
|
165
|
+
#json["requisitos"]["salario"]["excluyente"] = false
|
166
|
+
###json["requisitos"]["genero"]
|
167
|
+
#json["requisitos"]["genero"]["nombre"] = ""
|
168
|
+
#json["requisitos"]["genero"]["excluyente"] = false
|
169
|
+
json[:tipoTrabajoId] = 0
|
170
|
+
|
171
|
+
publish(json.to_json)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Publicaciones
|
175
|
+
def publish(json)
|
176
|
+
new_publish_path = "/v0/empresas/avisos"
|
177
|
+
response = self.class.put(new_publish_path, @options.merge(body: json, headers: { "Accept" => "application/json", "Content-Type" => "application/json"}))
|
178
|
+
|
179
|
+
if check_response(response)
|
180
|
+
case response.code
|
181
|
+
when 201
|
182
|
+
# "Publication created, All good!"
|
183
|
+
return response.body # id del proceso publicado
|
184
|
+
when 200
|
185
|
+
# "TODO: Uhm.. no idea, is this good?"
|
186
|
+
return response.body # id del proceso publicado?
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def get_publication(publication_id)
|
192
|
+
get_publish_path = "/v0/empresas/avisos/#{publication_id}"
|
193
|
+
response = self.class.put(get_publish_path, @options)
|
194
|
+
|
195
|
+
return check_response(response)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Servicios comunes
|
199
|
+
def areas #jobs areas
|
200
|
+
areas_path = "/v0/empresas/comunes/areas"
|
201
|
+
response = self.class.get(areas_path, @options)
|
202
|
+
|
203
|
+
return check_response(response)
|
204
|
+
end
|
205
|
+
|
206
|
+
def subareas_in(area_id)
|
207
|
+
subareas_path = "/v0/empresas/comunes/areas/#{area_id}/subAreas"
|
208
|
+
response = self.class.get(subareas_path, @options)
|
209
|
+
|
210
|
+
return check_response(response)
|
211
|
+
end
|
212
|
+
|
213
|
+
def frecuencias_pago
|
214
|
+
frecuencias_pago_path = "/v0/empresas/comunes/frecuenciasPago"
|
215
|
+
response = self.class.get(frecuencias_pago_path, @options)
|
216
|
+
|
217
|
+
return check_response(response)
|
218
|
+
end
|
219
|
+
|
220
|
+
def idiomas
|
221
|
+
idiomas_path = "/v0/empresas/comunes/idiomas"
|
222
|
+
response = self.class.get(idiomas_path, @options)
|
223
|
+
|
224
|
+
return check_response(response)
|
225
|
+
end
|
226
|
+
|
227
|
+
def industrias
|
228
|
+
industrias_path = "/v0/empresas/comunes/industrias"
|
229
|
+
response = self.class.get(industrias_path, @options)
|
230
|
+
|
231
|
+
return check_response(response)
|
232
|
+
end
|
233
|
+
|
234
|
+
def niveles_idiomas
|
235
|
+
niveles_idiomas_path = "/v0/empresas/comunes/nivelesIdiomas"
|
236
|
+
response = self.class.get(niveles_idiomas_path, @options)
|
237
|
+
|
238
|
+
return check_response(response)
|
239
|
+
end
|
240
|
+
|
241
|
+
def tipos_trabajo
|
242
|
+
tipos_trabajo_path = "/v0/empresas/comunes/tiposTrabajo"
|
243
|
+
response = self.class.get(tipos_trabajo_path, @options)
|
244
|
+
|
245
|
+
return check_response(response)
|
246
|
+
end
|
247
|
+
|
248
|
+
# Servicios de estudios de los postulantes
|
249
|
+
def areas_estudio
|
250
|
+
areas_estudio_path = "/v0/estudios/areasEstudio"
|
251
|
+
response = self.class.get(areas_estudio_path, @options)
|
252
|
+
|
253
|
+
return check_response(response)
|
254
|
+
end
|
255
|
+
|
256
|
+
def estados_estudio
|
257
|
+
estados_estudio_path = "/v0/estudios/estadosEstudio"
|
258
|
+
response = self.class.get(estados_estudio_path, @options)
|
259
|
+
|
260
|
+
return check_response(response)
|
261
|
+
end
|
262
|
+
|
263
|
+
def tipos_estudio
|
264
|
+
tipos_estudio_path = "/v0/estudios/tiposEstudio"
|
265
|
+
response = self.class.get(tipos_estudio_path, @options)
|
266
|
+
|
267
|
+
return check_response(response)
|
268
|
+
end
|
269
|
+
|
270
|
+
def get_estudio(estudio_id)
|
271
|
+
estudio_path = "/v0/estudios/#{estudio_id}"
|
272
|
+
response = self.class.get(estudio_path, @options)
|
273
|
+
|
274
|
+
return check_response(response)
|
275
|
+
end
|
276
|
+
|
277
|
+
# Servicios de la experiencia laboral de los postulantes
|
278
|
+
def get_experiencia_laboral(experiencia_laboral_id)
|
279
|
+
experiencia_laboral_path = "/v0/experienciaLaborales/#{experiencia_laboral_id}"
|
280
|
+
response = self.class.get(experiencia_laboral_path, @options)
|
281
|
+
|
282
|
+
return check_response(response)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Servicios generales asociados a datos de localización
|
286
|
+
def paises
|
287
|
+
paises_path = "/v0/empresas/locacion/paises"
|
288
|
+
response = self.class.get(paises_path, @options)
|
289
|
+
|
290
|
+
return check_response(response)
|
291
|
+
end
|
292
|
+
|
293
|
+
def zonas_in(pais_id)
|
294
|
+
zonas_path = "/v0/empresas/locacion/paises/#{pais_id}/zonas"
|
295
|
+
response = self.class.get(zonas_path, @options)
|
296
|
+
|
297
|
+
return check_response(response)
|
298
|
+
end
|
299
|
+
|
300
|
+
def localidades_in(zona_id)
|
301
|
+
localidades_path = "/v0/empresas/locacion/zonas/#{zona_id}/localidades"
|
302
|
+
response = self.class.get(localidades_path, @options)
|
303
|
+
|
304
|
+
return check_response(response)
|
305
|
+
end
|
306
|
+
|
307
|
+
# Servicio de postulaciones a los avisos publicados por las empresas
|
308
|
+
def get_postulacion(postulacion_id)
|
309
|
+
postulaciones_path = "/v0/empresas/postulaciones/#{postulacion_id}"
|
310
|
+
response = self.class.get(postulaciones_path, @options)
|
311
|
+
|
312
|
+
return check_response(response)
|
313
|
+
end
|
314
|
+
|
315
|
+
def discard_postulacion(postulacion_id)
|
316
|
+
discard_postulaciones_path = "/v0/empresas/postulaciones/#{postulacion_id}/descartar"
|
317
|
+
response = self.class.put(discard_postulaciones_path, @options)
|
318
|
+
|
319
|
+
return check_response(response)
|
320
|
+
end
|
321
|
+
|
322
|
+
|
323
|
+
def login
|
324
|
+
login_path = "/v0/empresas/usuarios/login"
|
325
|
+
# POST /v0/empresas/usuarios/login
|
326
|
+
# sends post request with:
|
327
|
+
# grant_type= Tipo de permiso de OAuth2 query string
|
328
|
+
# client_id= Identificador del cliente de OAuth2 query string
|
329
|
+
# username= Nombre de usuario query string
|
330
|
+
# password= Password del usuario query string
|
331
|
+
# recieves json
|
332
|
+
# {
|
333
|
+
# "accessToken": "bdf48bc4-6b7a-4de9-82e5-5bf278d23855",
|
334
|
+
# "tokenType": "bearer",
|
335
|
+
# "expiresIn": 1199
|
336
|
+
# }
|
337
|
+
|
338
|
+
response = self.class.post(login_path, query: {grant_type: @@grant_type, client_id: @@client_id, username: @@username, password: @@password})
|
339
|
+
|
340
|
+
if check_response(response)
|
341
|
+
# "All good!"
|
342
|
+
access_token = response["accessToken"]
|
343
|
+
token_type = response["tokenType"]
|
344
|
+
expires_in = response["expiresIn"]
|
345
|
+
return access_token
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
|
350
|
+
private
|
351
|
+
def check_response(response)
|
352
|
+
case response.code
|
353
|
+
when 200..201
|
354
|
+
# "All good!"
|
355
|
+
return response
|
356
|
+
when 401
|
357
|
+
raise "Unauthorized, check login info"
|
358
|
+
when 403
|
359
|
+
raise "Error 403: Forbidden"
|
360
|
+
when 404
|
361
|
+
raise "Error 404 not found"
|
362
|
+
when 500...600
|
363
|
+
raise "ZOMG ERROR #{response.code}"
|
364
|
+
else
|
365
|
+
raise "Error #{response.code}, unkown response"
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|