Class: Firstjob::Publication
- Inherits:
-
Object
- Object
- Firstjob::Publication
- Defined in:
- lib/firstjob/publication.rb
Instance Attribute Summary collapse
-
#career_status_id ⇒ Object
Returns the value of attribute career_status_id.
-
#careers_ids ⇒ Object
Returns the value of attribute careers_ids.
-
#description ⇒ Object
Returns the value of attribute description.
-
#english_level_id ⇒ Object
Returns the value of attribute english_level_id.
-
#excel_level_id ⇒ Object
Returns the value of attribute excel_level_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#location ⇒ Object
Returns the value of attribute location.
-
#looking_for_id ⇒ Object
Returns the value of attribute looking_for_id.
-
#postulantes ⇒ Object
Returns the value of attribute postulantes.
-
#salary ⇒ Object
Returns the value of attribute salary.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#status ⇒ Object
Returns the value of attribute status.
-
#title ⇒ Object
Returns the value of attribute title.
-
#universities_ids ⇒ Object
Returns the value of attribute universities_ids.
-
#years_experience ⇒ Object
Returns the value of attribute years_experience.
Class Method Summary collapse
Instance Method Summary collapse
- #body ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes = {}) ⇒ Publication
constructor
A new instance of Publication.
- #postulants ⇒ Object
- #publish ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Publication
Returns a new instance of Publication.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/firstjob/publication.rb', line 8 def initialize(attributes={}) # Default values @salary = 0 @location = "Chile" @career_status_id = 1 @years_experience = 0 @english_level_id = 1 @excel_level_id = 1 attributes.each do |key, value| self.send("#{key}=", value) end end |
Instance Attribute Details
#career_status_id ⇒ Object
Returns the value of attribute career_status_id.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def career_status_id @career_status_id end |
#careers_ids ⇒ Object
Returns the value of attribute careers_ids.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def careers_ids @careers_ids end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def description @description end |
#english_level_id ⇒ Object
Returns the value of attribute english_level_id.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def english_level_id @english_level_id end |
#excel_level_id ⇒ Object
Returns the value of attribute excel_level_id.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def excel_level_id @excel_level_id end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def id @id end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def location @location end |
#looking_for_id ⇒ Object
Returns the value of attribute looking_for_id.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def looking_for_id @looking_for_id end |
#postulantes ⇒ Object
Returns the value of attribute postulantes.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def postulantes @postulantes end |
#salary ⇒ Object
Returns the value of attribute salary.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def salary @salary end |
#slug ⇒ Object
Returns the value of attribute slug.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def slug @slug end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def status @status end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def title @title end |
#universities_ids ⇒ Object
Returns the value of attribute universities_ids.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def universities_ids @universities_ids end |
#years_experience ⇒ Object
Returns the value of attribute years_experience.
3 4 5 |
# File 'lib/firstjob/publication.rb', line 3 def years_experience @years_experience end |
Class Method Details
.create(params) ⇒ Object
26 27 28 29 |
# File 'lib/firstjob/publication.rb', line 26 def self.create(params) publication = new(params) response = publication.publish() end |
Instance Method Details
#body ⇒ Object
22 23 24 |
# File 'lib/firstjob/publication.rb', line 22 def body default_publication_json() end |
#destroy ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/firstjob/publication.rb', line 65 def destroy response = Firstjob.post("/api/doregister_job", Firstjob..merge( body: Firstjob.body.merge({job_id: id}).to_json ) ) response_body = HttpParser.parse_response(response) end |
#postulants ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/firstjob/publication.rb', line 51 def postulants # Get postulants response = Firstjob.post("/api/get_applicants_job", Firstjob..merge( body: Firstjob.body.merge({job_id: @id}).to_json ) ) response_body = HttpParser.parse_json_response(response) # load results @postulantes = response_body["postulantes"] return @postulantes end |
#publish ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/firstjob/publication.rb', line 31 def publish # Post publication response = Firstjob.post("/api/publish_job", Firstjob..merge( body: Firstjob.body.merge({publish_job: self.body}).to_json ) ) response_body = HttpParser.parse_json_response(response) # load results @slug = response_body["slug"] @id = response_body["id"] @status = response_body["status"] return self end |
#url ⇒ Object
47 48 49 |
# File 'lib/firstjob/publication.rb', line 47 def url "#{Firstjob.base_uri}/jobs/#{slug}" end |