lib/firstjob_api.rb in firstjob_api-1.0.7 vs lib/firstjob_api.rb in firstjob_api-1.0.8

- old
+ new

@@ -13,11 +13,11 @@ require 'firstjob_api/publication' require 'firstjob_api/http_parser' module FirstjobApi include HTTParty - base_uri 'https://api.firstjob.com' + base_uri 'https://api.firstjob.me' # API login configuration, need initialization setup to work mattr_accessor :grant_type @@grant_type = "password" @@ -70,73 +70,9 @@ # Publicaciones # creates and publish a publication def self.publish(params) publication = FirstjobApi::Publication.create(params) return publication - end - - def self.update_publication(publication_id, json) - update_publication_path = "/v0/empresas/avisos/#{publication_id}" - response = self.post(update_publication_path, @@options.merge(body: json, headers: { "Accept" => "application/json", "Content-Type" => "application/json"})) - - if HttpParser.parse_response(response) - case response.code - when 201 - # "Publication updated, All good!" - return response # body contains id del proceso publicado - when 200 - # "TODO: Uhm.. no idea, is this good?" - return response # body contains id del proceso publicado? - end - end - end - - def self.publish_publication(publication_id, pais_id, plan_publication_id) - publish_publication_path = "/v0/empresas/avisos/#{publication_id}/publicacion/#{plan_publication_id}" - response = self.put(publish_publication_path, @@options.merge(query: @@options[:query].merge({paisId: pais_id}))) - - if HttpParser.parse_response(response) - case response.code - when 201 - # "Publication created, All good!" - return response # body contains id del proceso publicado - when 200 - # "TODO: Uhm.. no idea, is this good?" - return response # body contains id del proceso publicado? - end - end - end - - def self.get_publication_url(publication_id) - "http://www.laborum.cl/empleos/#{publication_id}.html" - end - - def self.get_publication(publication_id) - get_publication_path = "/v0/empresas/avisos/#{publication_id}" - response = self.get(get_publication_path, @@options) - - return HttpParser.parse_response_to_json(response) - end - - def self.get_postulations_in_publication(publication_id, page=0, postulations_per_page=20) - get_postulations_in_publication_path = "/v0/empresas/avisos/#{publication_id}/postulaciones" - response = self.get(get_postulations_in_publication_path, @@options.merge(query: @@options[:query].merge({page: page, perPage: postulations_per_page}))) - - return HttpParser.parse_response_to_json(response) - end - - def self.get_postulation(postulation_id) - get_postulation_path = "/v0/empresas/postulaciones/#{postulation_id}" - response = self.get(get_postulation_path, @@options) - - return HttpParser.parse_response_to_json(response) - end - - def self.destroy_publication(publication_id) - destroy_publication_path = "/v0/empresas/avisos/#{publication_id}" - response = self.delete(destroy_publication_path, @@options) - - return HttpParser.parse_response(response) end end