firstjob_api 1.0.4

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.
@@ -0,0 +1,15 @@
1
+ module FirstjobApi
2
+ class University
3
+ UNIVERSITIES = YAML.load_file(File.join(File.dirname(__FILE__),"../data/universities.yaml"))["universities"].symbolize_keys!
4
+
5
+ # Poor's man all
6
+ def self.all
7
+ UNIVERSITIES
8
+ end
9
+
10
+ # Poor's man find
11
+ def self.find(id)
12
+ UNIVERSITIES[id]
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module FirstjobApi
2
+ VERSION = "1.0.4"
3
+ end
@@ -0,0 +1,5 @@
1
+ FirstjobApi.setup do |config|
2
+ config.username = ENV["FIRSTJOB_USERNAME"]
3
+ config.password = ENV["FIRSTJOB_PASSWORD"]
4
+ config.base_uri ENV["FIRSTJOB_BASE_URI"]
5
+ end
@@ -0,0 +1,69 @@
1
+ class FirstjobFixture
2
+ def self.publication
3
+ publication = Firstjob::Publication.new
4
+ publication.body[:descripcion] = "Descripcion de la publicacion de prueba" # required
5
+ publication.body[:titulo] = "Publicacion de prueba" # required
6
+ #publication.body[:referencia] = "" #optional
7
+
8
+ # We can use an id for denominacion
9
+ publication.body[:denominacion][:id] = 0 # required
10
+ # or we can create a new one
11
+ #publication.body[:denominacion][:nombre] = ""
12
+ #publication.body[:denominacion][:logo] = ""
13
+
14
+ #publication.body[:preguntas] # optional
15
+ publication.body[:preguntas][0][:simple][:texto] = "Pregunta de prueba" # optional
16
+ publication.body[:preguntas] << {choice: {texto: "Pregunta de alternativas", indiceCorrecta: 2, opciones: [{opcion: "respuesta 1"}, {opcion: "respuesta 2"}, {opcion: "respuesta 3"}, {opcion: "respuesta 4"}]}} # optional
17
+
18
+ #publication.body["postulantesDiscapacitados"] false, #optional
19
+
20
+ #publication.body["lugarTrabajo"]
21
+ #publication.body[:lugarTrabajo][:id] = 0 # TODO: found in the developers site but not in the documentation
22
+ publication.body[:lugarTrabajo][:paisId] = 1 # required
23
+ publication.body[:lugarTrabajo][:zonaId] = 18 # required
24
+ publication.body[:lugarTrabajo][:localidadId] = 6050 # required
25
+ publication.body[:lugarTrabajo][:direccion] = "San Martin 256" # required
26
+ publication.body[:lugarTrabajo][:mostrarDireccionEnAviso] = false # required
27
+
28
+ publication.body[:recepcionCandidato][:electronica][:email] = "test@domain.com" # required
29
+ # recepcionCandidato can aslo be with dias, rangoHorario and direccion
30
+ publication.body[:areaId] = 19 # required
31
+ publication.body[:subAreaId] = 26 # required
32
+ ####publication.body[:requisitos] # optional
33
+ ###publication.body[:requisitos][:experiencia]
34
+ publication.body[:requisitos][:experiencia][:minimo] = 60 # required
35
+ publication.body[:requisitos][:experiencia][:excluyente] = false # required
36
+ ###publication.body[:requisitos][:edad]
37
+ publication.body[:requisitos][:edad][:edadMinima] = 18 # required
38
+ publication.body[:requisitos][:edad][:edadMaxima] = 40 # required
39
+ publication.body[:requisitos][:edad][:excluyente] = false # required
40
+ ###publication.body["requisitos"]["educacion"]
41
+ publication.body[:requisitos][:educacion][:estadoEstudioId] = 2 # required
42
+ publication.body[:requisitos][:educacion][:tipoEstudioId] = 3 # required
43
+ publication.body[:requisitos][:educacion][:excluyente] = false # required
44
+ ###publication.body["requisitos"]["idiomas"]
45
+ publication.body[:requisitos][:idiomas][0][:nivelId] = 10 # required
46
+ publication.body[:requisitos][:idiomas][0][:idiomaId] = 1 # required
47
+ publication.body[:requisitos][:idiomas][0][:excluyente] = false # required
48
+ ###publication.body["requisitos"]["residencia"]
49
+ publication.body[:requisitos][:residencia][:cercania] = "provincia" # required
50
+ #publication.body[:requisitos][:residencia][:cantidadKm] = 0 # optional
51
+ publication.body[:requisitos][:residencia][:excluyente] = false # required
52
+ ###publication.body["requisitos"]["salario"]
53
+ publication.body[:requisitos][:salario][:tipo] = "bruto" # required
54
+ publication.body[:requisitos][:salario][:salarioMinimo] = 200000 # required
55
+ publication.body[:requisitos][:salario][:salarioMaximo] = 1000000 # required
56
+ publication.body[:requisitos][:salario][:frecuenciaPagoId] = 4 # required
57
+ publication.body[:requisitos][:salario][:mostrarAviso] = true # required
58
+ publication.body[:requisitos][:salario][:solicitarCandidato] = true # required
59
+ publication.body[:requisitos][:salario][:excluyente] = false # optional
60
+ ###publication.body[:requisitos][:genero]
61
+ publication.body[:requisitos][:genero][:nombre] = "masculino" # required
62
+ publication.body[:requisitos][:genero][:excluyente] = false # required
63
+ publication.body[:tipoTrabajoId] = 4 # required
64
+
65
+ return publication
66
+
67
+ # publish(publication.body.to_publication.body)
68
+ end
69
+ end
@@ -0,0 +1,174 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bumeran do
4
+ it 'is a sanity test' do
5
+ end
6
+
7
+ it 'has a valid model' do
8
+ Bumeran.has_valid_access_token?.should be_true
9
+ end
10
+
11
+ it 'can create publication', create: true do
12
+ publication = BumeranFixture.publication
13
+ result = Bumeran.create_aviso(publication.body.to_json)
14
+ pp result
15
+ result.to_i.should > 0
16
+ end
17
+
18
+ it 'can publish publication', create: true do
19
+ publication = BumeranFixture.publication
20
+ published_publication_id = Bumeran.publish(publication.body.to_json, 1, 30) # pais Argentina = 1, plan publicacion "simple" = 30
21
+ pp published_publication_id
22
+ published_publication_id.to_i.should > 0
23
+ end
24
+
25
+ it 'can create, get, publish and destroy publication', publish: true do
26
+ publication = BumeranFixture.publication
27
+ publication_id = Bumeran.create_aviso(publication.body.to_json)
28
+ pp publication_id
29
+ publication_id.should > 0
30
+
31
+ publication = Bumeran.get_publication(publication_id)
32
+ pp publication
33
+ publication["id"].should > 0
34
+
35
+ published_publication = Bumeran.publicar_aviso(publication_id, 1, 30) # pais Argentina = 1, plan publicacion "simple" = 30
36
+ pp published_publication
37
+
38
+ deleted_publication = Bumeran.destroy_aviso(publication_id)
39
+ pp deleted_publication
40
+ end
41
+
42
+ it 'can get areas', getters: true do
43
+ pp Bumeran.areas
44
+ Bumeran.areas.count.should > 0
45
+ end
46
+
47
+ it 'can get subareas', getters: true do
48
+ pp Bumeran.subareas
49
+ Bumeran.subareas.count.should > 0
50
+ end
51
+
52
+ it 'can get frecuencias_pago', getters: true do
53
+ pp Bumeran.frecuencias_pago
54
+ Bumeran.frecuencias_pago.count.should > 0
55
+ end
56
+
57
+ it 'can get paises' do
58
+ pp Bumeran.paises
59
+ Bumeran.paises.count.should > 0
60
+ end
61
+
62
+ # localidades gives error! (API problem)
63
+ it 'can get paises, zonas, localidades, and plan plublicaciones' do
64
+ pp Bumeran.paises
65
+ Bumeran.paises.count.should > 0
66
+ Bumeran.zonas.count.should > 0
67
+ #Bumeran.localidades.count.should > 0
68
+ Bumeran.plan_publicaciones.count.should > 0
69
+ end
70
+
71
+ it 'can get denominaciones', getters: true do
72
+ pp Bumeran.denominaciones
73
+ Bumeran.denominaciones.count.should > 0
74
+ end
75
+
76
+ it 'can get direcciones', getters: true do
77
+ pp Bumeran.direcciones
78
+ Bumeran.direcciones.count.should > 0
79
+ end
80
+
81
+ it 'can get frecuencias_pago', getters: true do
82
+ pp Bumeran.frecuencias_pago
83
+ Bumeran.frecuencias_pago.count.should > 0
84
+ end
85
+
86
+
87
+ it 'can get idiomas', getters: true do
88
+ pp Bumeran.idiomas
89
+ Bumeran.idiomas.count.should > 0
90
+ end
91
+
92
+ it 'can get industrias', getters: true do
93
+ pp Bumeran.industrias
94
+ Bumeran.industrias.count.should > 0
95
+ end
96
+
97
+ it 'can get niveles_idiomas', getters: true do
98
+ pp Bumeran.niveles_idiomas
99
+ Bumeran.niveles_idiomas.count.should > 0
100
+ end
101
+
102
+ it 'can get tipos_trabajo', getters: true do
103
+ pp Bumeran.tipos_trabajo
104
+ Bumeran.tipos_trabajo.count.should > 0
105
+ end
106
+
107
+ it 'can get areas_estudio', getters: true do
108
+ pp Bumeran.areas_estudio
109
+ Bumeran.areas_estudio.count.should > 0
110
+ end
111
+
112
+ it 'can get estados_estudio', getters: true do
113
+ pp Bumeran.estados_estudio
114
+ Bumeran.estados_estudio.count.should > 0
115
+ end
116
+
117
+ it 'can get tipos_estudio', getters: true do
118
+ pp Bumeran.tipos_estudio
119
+ Bumeran.tipos_estudio.count.should > 0
120
+ end
121
+
122
+ it 'can get tipos_estudio', getters: true do
123
+ pp Bumeran.tipos_estudio
124
+ Bumeran.tipos_estudio.count.should > 0
125
+ end
126
+
127
+ it 'can get estudio', getters: true do
128
+ params = {}
129
+ params['curriculum_id']=1000
130
+ estudio = Bumeran.get_estudio(1285190, params)
131
+ pp estudio
132
+ estudio["titulo"].class.should be String
133
+ end
134
+
135
+ it 'can get conocimiento', getters: true do
136
+ #conocimiento = Bumeran.get_conocimiento(140)
137
+ #pp conocimiento
138
+ #conocimiento["nombre"].class.should be String
139
+ params = {}
140
+ params['curriculum_id']=1000
141
+ conocimiento = Bumeran.get_conocimiento(140, params)
142
+ pp conocimiento
143
+ conocimiento["nombre"].class.should be String
144
+ end
145
+
146
+ it 'can get conocimiento_custom', getters: true do
147
+ params = {}
148
+ params['curriculum_id']=1000
149
+ conocimiento_custom = Bumeran.get_conocimiento_custom(623710, params)
150
+ pp conocimiento_custom
151
+ conocimiento_custom["nombre"].class.should be String
152
+ end
153
+
154
+ it 'can get experiencia_laboral', getters: true do
155
+ params = {}
156
+ params['curriculum_id']=1000
157
+ experiencia_laboral = Bumeran.get_experiencia_laboral(1651500, params)
158
+ pp experiencia_laboral
159
+ experiencia_laboral["puesto"].class.should be String
160
+ end
161
+
162
+ it 'can get postulacion', getters: true do
163
+ postulacion = Bumeran.get_postulacion(1000)
164
+ pp postulacion
165
+ postulacion["estado"].class.should be String
166
+ end
167
+
168
+ it 'can get curriculum', getters: true do
169
+ curriculum = Bumeran.get_curriculum(1000)
170
+ pp curriculum
171
+ curriculum["nombre"].class.should be String
172
+ end
173
+
174
+ end
@@ -0,0 +1,29 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+
6
+ #
7
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
8
+ RSpec.configure do |config|
9
+ config.treat_symbols_as_metadata_keys_with_true_values = true
10
+ config.run_all_when_everything_filtered = true
11
+ config.filter_run focus: true
12
+
13
+ Dir["./spec/fixtures/*.rb"].sort.each { |f| require f }
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
21
+
22
+ require 'firstjob_api'
23
+ require 'firstjob_api/publication'
24
+ begin
25
+ require 'firstjob_initializer_helper'
26
+ rescue Exception => e
27
+ raise "firstjob_initializer_helper does't exist, follow the instructions in the README"
28
+ end
29
+ require 'pry-byebug'
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: firstjob_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Rodrigo Fernandez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.13.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.13.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A gem to access the Firstjob API
84
+ email:
85
+ - chaotiklv@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - LICENSE
95
+ - README.md
96
+ - Rakefile
97
+ - firstjob_api.gemspec
98
+ - lib/data/career_statuses.yaml
99
+ - lib/data/careers.yaml
100
+ - lib/data/english_levels.yaml
101
+ - lib/data/excel_levels.yaml
102
+ - lib/data/looking_fors.yaml
103
+ - lib/data/universities.yaml
104
+ - lib/firstjob_api.rb
105
+ - lib/firstjob_api/career.rb
106
+ - lib/firstjob_api/career_status.rb
107
+ - lib/firstjob_api/english_level.rb
108
+ - lib/firstjob_api/excel_level.rb
109
+ - lib/firstjob_api/http_parser.rb
110
+ - lib/firstjob_api/looking_for.rb
111
+ - lib/firstjob_api/publication.rb
112
+ - lib/firstjob_api/university.rb
113
+ - lib/firstjob_api/version.rb
114
+ - spec/firstjob_initializer_helper.rb
115
+ - spec/fixtures/firstjob_fixture.rb
116
+ - spec/lib/bumeran_spec.rb
117
+ - spec/spec_helper.rb
118
+ homepage: https://github.com/rfernand/firstjob
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.4.8
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: A gem to access the Firstjob API
142
+ test_files:
143
+ - spec/firstjob_initializer_helper.rb
144
+ - spec/fixtures/firstjob_fixture.rb
145
+ - spec/lib/bumeran_spec.rb
146
+ - spec/spec_helper.rb