bumeran 0.2.4 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5af83ab6911bcb77e789eb5b541ad9b6221b576
4
- data.tar.gz: eb947e1745ed9fcc5c628db3593806f181a1abf1
3
+ metadata.gz: f5e346b87cfc1b68e63e646711cc138fdf12a90d
4
+ data.tar.gz: dcbabf45b9fd1160bdf95b0eeffc4247c8c96f82
5
5
  SHA512:
6
- metadata.gz: 4bdad18145822e47190a8e41c43061d400e7d7e304cf263483b6bffcfca5c0e1a2e579970ceac1451ff4df1e194ce8231b053a89923174e8f08d3afe7ad479b6
7
- data.tar.gz: 20dd9e37853cff050b2ece22ef28b313d1fb2dfb446395afa94dbbf175f49377f48dd076202271c268ccc59065f89e0cae6d64adfc37ce18e0061afcd781ad39
6
+ metadata.gz: ca687e1e43b00054bf017ab9cd3d3afa363a595c9d1b53f147ec18cd94b14500361cfe63254f646ab60e5c03cd43bf01e556636c02a8736e52da48870907d58f
7
+ data.tar.gz: 06bc69ba1e28bbe11eaa8c7e1b136354e7318bd7ec3244372017e79cbf68c9540f451f9e358287121059c9451111bc1d64d7a56f206e231ebda8ffd17369c29b
data/README.md CHANGED
@@ -21,11 +21,12 @@ After you finished the gem installation, you need to configure it with your Bume
21
21
 
22
22
  ```ruby
23
23
  Bumeran.setup do |config|
24
- config.grant_type = "password" # Default value
25
- config.client_id = "" # Bumeran client id
26
- config.username = "" # Bumeran client username
27
- config.email = "" # Bumeran client email
28
- config.password = "" # Bumeran client password
24
+ config.grant_type = "password" # Default value
25
+ config.client_id = "" # Bumeran client id
26
+ config.username = "" # Bumeran client username
27
+ config.email = "" # Bumeran client email
28
+ config.password = "" # Bumeran client password
29
+ config.environment "production" # You can choose between production or development
29
30
  end
30
31
  ```
31
32
  ## How to use
@@ -5,7 +5,7 @@ require 'erb'
5
5
 
6
6
  module Bumeran
7
7
  include HTTParty
8
- base_uri 'https://developers.bumeran.com'
8
+ base_uri 'https://api.bumeran.com'
9
9
 
10
10
  # API login configuration, need initialization setup to work
11
11
  mattr_accessor :grant_type
@@ -61,6 +61,16 @@ module Bumeran
61
61
  yield self
62
62
  end
63
63
 
64
+ def self.environment(use_environment="production")
65
+ if use_environment == "production"
66
+ Bumeran.base_uri('https://api.bumeran.com')
67
+ elsif use_environment == "development"
68
+ Bumeran.base_uri('https://developers.bumeran.com')
69
+ else
70
+ Bumeran.base_uri('https://developers.bumeran.com')
71
+ end
72
+ end
73
+
64
74
  def self.initialize
65
75
  unless has_valid_access_token?
66
76
  login
@@ -130,6 +140,23 @@ module Bumeran
130
140
  end
131
141
  end
132
142
 
143
+ def self.update_publication(publication_id, json)
144
+ Bumeran.initialize
145
+ update_publication_path = "/v0/empresas/avisos/#{publication_id}"
146
+ response = self.post(update_publication_path, @@options.merge(body: json, headers: { "Accept" => "application/json", "Content-Type" => "application/json"}))
147
+
148
+ if Parser.parse_response(response)
149
+ case response.code
150
+ when 201
151
+ # "Publication updated, All good!"
152
+ return response # body contains id del proceso publicado
153
+ when 200
154
+ # "TODO: Uhm.. no idea, is this good?"
155
+ return response # body contains id del proceso publicado?
156
+ end
157
+ end
158
+ end
159
+
133
160
  def self.publish_publication(publication_id, pais_id, plan_publication_id)
134
161
  Bumeran.initialize
135
162
  publish_publication_path = "/v0/empresas/avisos/#{publication_id}/publicacion/#{plan_publication_id}"
@@ -147,6 +174,10 @@ module Bumeran
147
174
  end
148
175
  end
149
176
 
177
+ def self.get_publication_url(publication_id)
178
+ "http://www.laborum.cl/empleos/#{publication_id}.html"
179
+ end
180
+
150
181
  def self.get_publication(publication_id)
151
182
  Bumeran.initialize
152
183
  get_publication_path = "/v0/empresas/avisos/#{publication_id}"
@@ -349,7 +380,7 @@ module Bumeran
349
380
  # Servicios generales asociados a datos de localización
350
381
  def self.get_paises
351
382
  Bumeran.initialize
352
- paises_path = "/v0/empresas/localizaciones/paises"
383
+ paises_path = "/v0/empresas/locacion/paises"
353
384
  response = self.get(paises_path, @@options)
354
385
 
355
386
  paises_json = Parser.parse_response_to_json(response)
@@ -358,7 +389,7 @@ module Bumeran
358
389
 
359
390
  def self.get_zonas_in(pais_id)
360
391
  Bumeran.initialize
361
- zonas_path = "/v0/empresas/localizaciones/paises/#{pais_id}/zonas"
392
+ zonas_path = "/v0/empresas/locacion/paises/#{pais_id}/zonas"
362
393
  response = self.get(zonas_path, @@options)
363
394
 
364
395
  json_zonas = Parser.parse_response_to_json(response)
@@ -368,7 +399,7 @@ module Bumeran
368
399
 
369
400
  def self.get_localidades_in(zona_id)
370
401
  Bumeran.initialize
371
- localidades_path = "/v0/empresas/localizaciones/zonas/#{zona_id}/localidades"
402
+ localidades_path = "/v0/empresas/locacion/zonas/#{zona_id}/localidades"
372
403
  response = self.get(localidades_path, @@options)
373
404
 
374
405
  json = Parser.parse_response_to_json(response)
@@ -507,7 +538,7 @@ module Bumeran
507
538
  # Servicios de la experiencia laboral de los postulantes
508
539
  def self.get_experiencia_laboral(experiencia_laboral_id)
509
540
  Bumeran.initialize
510
- experiencia_laboral_path = "/v0/experienciasLaborales/#{experiencia_laboral_id}"
541
+ experiencia_laboral_path = "/v0/experienciaLaborales/#{experiencia_laboral_id}"
511
542
  response = self.get(experiencia_laboral_path, @@options)
512
543
 
513
544
  return Parser.parse_response_to_json(response)
@@ -1,3 +1,3 @@
1
1
  module Bumeran
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -4,4 +4,5 @@ Bumeran.setup do |config|
4
4
  config.username = ""
5
5
  config.email = ""
6
6
  config.password = ""
7
+ config.environment "development"
7
8
  end
@@ -54,11 +54,6 @@ describe Bumeran do
54
54
  Bumeran.frecuencias_pago.count.should > 0
55
55
  end
56
56
 
57
- it 'can get paises' do
58
- pp Bumeran.paises
59
- Bumeran.paises.count.should > 0
60
- end
61
-
62
57
  # localidades gives error! (API problem)
63
58
  it 'can get paises, zonas, localidades, and plan plublicaciones' do
64
59
  pp Bumeran.paises
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumeran
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Fernandez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.2.2
126
+ rubygems_version: 2.4.5
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: A gem to access the Bumeran api