jobhunters 0.1.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 +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +10 -0
- data/Gemfile +8 -0
- data/LICENSE +21 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/bin/jobhunters +11 -0
- data/jobhunters.gemspec +19 -0
- data/lib/jobhunters/JobSearch.rb +63 -0
- data/lib/jobhunters/version.rb +3 -0
- data/lib/jobhunters.rb +1 -0
- data/spec/test.rb +45 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fe2e74c4da7b6ad850e533fd56bfb9c4d5631059
|
4
|
+
data.tar.gz: 25713e3ab31d01a7580de48923811054f89a81ad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84bd717d61c1fae9c81ccf6a0a833cd6a5c108df274d1f1054c1c9be247f2b45923036f2330ebf1beff65b2bac56c4931c46a8467c084ffe3e5d6d38e9be3bbd
|
7
|
+
data.tar.gz: 4f77098b152f08a263fb7bfc0e6809efe50ad3a6819a8ca5b4632a7a27ecf291a9a364325a9db35f4d6f13664fc1a1fa77cd39be625afd91e7f1550d171c8aa3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Roger Gomez, Edwin Mejia, Mauricio Jaime
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
====================
|
2
|
+
JOBHUNTERS
|
3
|
+
---------------------
|
4
|
+
[](https://travis-ci.org/rojotic26/jobhunters)
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
This gem may be used as a command line utility to obtain information of some job offers in CA by passing a category.
|
8
|
+
BASED ON TECOLOCO JOB OFFERS IN CENTRAL AMERICA
|
9
|
+
|
10
|
+
## More Details
|
11
|
+
This gem is based on the website: www.tecoloco.com
|
12
|
+
A website to see job offers in Central America. Very famous in Nicaragua and El Salvador.
|
13
|
+
|
14
|
+
>lib/JobSearch: This class get the category of jobs you are looking for and return a hash of job offers information.
|
15
|
+
>
|
16
|
+
>bin/jobhunters: This file is our executable file.
|
17
|
+
>
|
18
|
+
>GemFile: This file is just to specified which gems we are using.
|
19
|
+
|
20
|
+
This is an example of a category:
|
21
|
+
'marketing-ventas'
|
22
|
+
|
23
|
+
Our team-members are:
|
24
|
+
>Mauricio Jaime - mjboyarov@gmail.com / Nicaragua
|
25
|
+
>
|
26
|
+
>Roger Gomez - rojotic26@gmail.com / Nicaragua
|
27
|
+
>
|
28
|
+
>Edwin Mejia - eddwin@live.com / El Salvador
|
data/Rakefile
ADDED
data/bin/jobhunters
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/jobhunters/JobSearch.rb'
|
4
|
+
fail ArgumentError, "Usage: Job offers [category]\n" if ARGV.count == 0
|
5
|
+
category = ARGV[0]
|
6
|
+
|
7
|
+
jobs_found = JobSearch::Tecoloco.getjobs(category)
|
8
|
+
|
9
|
+
jobs_found.each do |title, date, city|
|
10
|
+
puts "Job offer:#{title} in #{city} until #{date}."
|
11
|
+
end
|
data/jobhunters.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require 'jobhunters/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'jobhunters'
|
6
|
+
s.version = JobHunters::VERSION
|
7
|
+
s.executables << 'jobhunters'
|
8
|
+
s.add_development_dependency 'minitest'
|
9
|
+
s.add_development_dependency 'minitest-rg'
|
10
|
+
s.date = '2014-10-26'
|
11
|
+
s.summary = 'Job offers search in Central American countries'
|
12
|
+
s.description = 'Look for the recent job offers available in Central America'
|
13
|
+
s.authors = ['Roger, Edwin and Mauricio']
|
14
|
+
s.email = 'rojotic26@gmail.com'
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.homepage = 'https://github.com/rojotic26/tecoloco-job-offers.git'
|
18
|
+
s.license = 'MIT'
|
19
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'date'
|
4
|
+
module JobSearch
|
5
|
+
# This class get the category of jobs you are looking for and
|
6
|
+
# return a hash of job offers information.
|
7
|
+
class Tecoloco
|
8
|
+
# Variables
|
9
|
+
TITLE_JOB = "//div[@class = 'plaza']//a[@class = 'oferta-trabajo']"
|
10
|
+
CITY_JOB = "//div[@class = 'plaza']//span[@class = 'ciudad-trabajo']"
|
11
|
+
DATE_JOB = "//div[@class = 'plaza']//div[@class = 'vigencia-trabajo']"
|
12
|
+
DETAIL_JOB = "//div[@class = 'plaza']//span[@class = 'detalle-trabajo']"
|
13
|
+
URL_TECOLOCO = 'http://www.tecoloco.com/empleo-'
|
14
|
+
|
15
|
+
# Function to obtain the whole information of the job offers at tecoloco
|
16
|
+
def self.getjobs(category)
|
17
|
+
doc = gethtml(category)
|
18
|
+
titles = get_titles(doc)
|
19
|
+
dates = get_dates(doc)
|
20
|
+
cities = get_cities(doc)
|
21
|
+
details = get_details(doc)
|
22
|
+
integrate(titles, dates, cities, details)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Function to get the url of tecoloco
|
26
|
+
def self.gethtml(category)
|
27
|
+
url = "#{URL_TECOLOCO}#{category}"
|
28
|
+
Nokogiri::HTML(open(url))
|
29
|
+
end
|
30
|
+
|
31
|
+
# Function to obtain the titles of the job offers at tecoloco
|
32
|
+
def self.get_titles(document)
|
33
|
+
titles = document.xpath(TITLE_JOB)
|
34
|
+
titles.map { |t| t.text }
|
35
|
+
end
|
36
|
+
|
37
|
+
# Function to obtain dates of the job offers at tecoloco
|
38
|
+
def self.get_dates(document)
|
39
|
+
dates = document.xpath(DATE_JOB)
|
40
|
+
dates.map { |d| Date.parse(d) }
|
41
|
+
end
|
42
|
+
|
43
|
+
# Function to obtain the cities of the job offers at tecoloco
|
44
|
+
def self.get_cities(document)
|
45
|
+
cities = document.xpath(CITY_JOB)
|
46
|
+
cities.map { |c| c.text }
|
47
|
+
end
|
48
|
+
|
49
|
+
# Function to obtain details of the job offers at tecoloco
|
50
|
+
def self.get_details(document)
|
51
|
+
details = document.xpath(DETAIL_JOB)
|
52
|
+
details.map { |dt| dt.text }
|
53
|
+
end
|
54
|
+
|
55
|
+
# Function to integrate the data of job offers in a hash by category
|
56
|
+
def self.integrate(titles, dates, cities, details)
|
57
|
+
jobs_array = titles.each_with_index.map do |_, index, _, _|
|
58
|
+
[titles[index], dates[index], cities[index], details[index]]
|
59
|
+
end
|
60
|
+
jobs_array
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/jobhunters.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'jobhunters/JobSearch.rb'
|
data/spec/test.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require './lib/jobhunters/JobSearch.rb'
|
4
|
+
#Tests
|
5
|
+
jobs_found = JobSearch::Tecoloco.getjobs('marketing')
|
6
|
+
|
7
|
+
describe JobSearch do
|
8
|
+
|
9
|
+
describe 'Obtaining the jobs' do
|
10
|
+
it 'has the right number of jobs' do
|
11
|
+
jobs_found.size.must_equal 15
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'Only future jobs' do
|
16
|
+
jobs_found.each do |title, date, city, details|
|
17
|
+
|
18
|
+
it 'Title is empty' do
|
19
|
+
title.wont_be_nil
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'Date is empty' do
|
23
|
+
date.wont_be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'City is empty' do
|
27
|
+
city.wont_be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'Details is empty' do
|
31
|
+
details.wont_be_nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'Date is future' do
|
35
|
+
assert_operator date, :>=, DateTime.now
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
it 'City is in CA' do
|
40
|
+
['Nicaragua','Costa Rica','El Salvador','Belice','Honduras','Panamá','Guatemala','República Dominicana'].must_include city
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jobhunters
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roger, Edwin and Mauricio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest-rg
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Look for the recent job offers available in Central America
|
42
|
+
email: rojotic26@gmail.com
|
43
|
+
executables:
|
44
|
+
- jobhunters
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/jobhunters
|
55
|
+
- jobhunters.gemspec
|
56
|
+
- lib/jobhunters.rb
|
57
|
+
- lib/jobhunters/JobSearch.rb
|
58
|
+
- lib/jobhunters/version.rb
|
59
|
+
- spec/test.rb
|
60
|
+
homepage: https://github.com/rojotic26/tecoloco-job-offers.git
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.4.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Job offers search in Central American countries
|
84
|
+
test_files: []
|