jobhunters 0.1.0 → 0.1.1

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: fe2e74c4da7b6ad850e533fd56bfb9c4d5631059
4
- data.tar.gz: 25713e3ab31d01a7580de48923811054f89a81ad
3
+ metadata.gz: 245ffe9265a222c74977251aa25e5608886886ce
4
+ data.tar.gz: 77c1987cbefcd96c9cc238f613dbbc8b6a3efe06
5
5
  SHA512:
6
- metadata.gz: 84bd717d61c1fae9c81ccf6a0a833cd6a5c108df274d1f1054c1c9be247f2b45923036f2330ebf1beff65b2bac56c4931c46a8467c084ffe3e5d6d38e9be3bbd
7
- data.tar.gz: 4f77098b152f08a263fb7bfc0e6809efe50ad3a6819a8ca5b4632a7a27ecf291a9a364325a9db35f4d6f13664fc1a1fa77cd39be625afd91e7f1550d171c8aa3
6
+ metadata.gz: 4402ec72b50d987ea982da4647d5e78ee1dec4b92bb87c050ee3aa130ccfdfb71d9252d376c31014f06bd1ddc30f0405bc7cc00588bf56a10041f8c211332e09
7
+ data.tar.gz: 889dc6123597a449780d9091eebee5d9922c12a28b07424f2635eff064b15f3d18342552dc467e1e2b18872fd2c43bc85def9f03adf2edf1545bd14511c85a0c
data/Gemfile CHANGED
@@ -2,6 +2,8 @@ source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  gem 'nokogiri'
5
+ gem 'sinatra'
6
+ gem 'json'
5
7
 
6
8
  group :test do
7
9
  gem 'rake'
data/README.md CHANGED
@@ -1,15 +1,41 @@
1
1
  ====================
2
2
  JOBHUNTERS
3
3
  ---------------------
4
+ [![Gem Version](https://badge.fury.io/rb/jobhunters.svg)](http://badge.fury.io/rb/jobhunters)
4
5
  [![Build Status](https://travis-ci.org/rojotic26/jobhunters.svg?branch=master)](https://travis-ci.org/rojotic26/jobhunters)
5
6
 
7
+ home: [https://github.com/rojotic26/jobhunters.git](https://github.com/rojotic26/jobhunters.git)
8
+ Gem to obtain the recent job offers from Tecoloco, a job search offer website in Central America.
9
+
6
10
  ## Usage
11
+
7
12
  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
13
+
14
+ ## CLI
15
+
16
+ To use the Executable File:
17
+ In order to run the executable file, just include a valid category, in this example we are requesting the marketing and sales offers, so use as a parameter the "marketing-ventas" value.
18
+
19
+ jobhunters 'marketing-ventas'
20
+
21
+ Other category examples to try are:
22
+
23
+ >informatica-internet,
24
+ >administrativo,
25
+ >call-center.
26
+
27
+ ## Code Example:
28
+
29
+ require 'jobhunters'
30
+ jobs_found = JobSearch::Tecoloco.getjobs('marketing-ventas')
31
+ jobs_found.each do |title, date, city|
32
+ puts "Job offer:#{title} in #{city} until #{date}."
33
+ end
9
34
 
10
35
  ## 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.
36
+
37
+ This gem is based on the website: [http://www.tecoloco.com/](https://github.com/soumyaray/citesight)
38
+ A website to see job offers in Central America.
13
39
 
14
40
  >lib/JobSearch: This class get the category of jobs you are looking for and return a hash of job offers information.
15
41
  >
@@ -17,10 +43,8 @@ A website to see job offers in Central America. Very famous in Nicaragua and El
17
43
  >
18
44
  >GemFile: This file is just to specified which gems we are using.
19
45
 
20
- This is an example of a category:
21
- 'marketing-ventas'
22
-
23
46
  Our team-members are:
47
+
24
48
  >Mauricio Jaime - mjboyarov@gmail.com / Nicaragua
25
49
  >
26
50
  >Roger Gomez - rojotic26@gmail.com / Nicaragua
data/app.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'sinatra/base'
2
+ require 'jobhunters'
3
+ require 'json'
4
+
5
+ class TecolocoJobOffers < Sinatra:Base
6
+ end
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+
3
+ # git-flow make-less installer for *nix systems, by Rick Osborne
4
+ # Based on the git-flow core Makefile:
5
+ # http://github.com/nvie/gitflow/blob/master/Makefile
6
+
7
+ # Licensed under the same restrictions as git-flow:
8
+ # http://github.com/nvie/gitflow/blob/develop/LICENSE
9
+
10
+ # Does this need to be smarter for each host OS?
11
+ if [ -z "$INSTALL_PREFIX" ] ; then
12
+ INSTALL_PREFIX="/usr/local/bin"
13
+ fi
14
+
15
+ if [ -z "$REPO_NAME" ] ; then
16
+ REPO_NAME="gitflow"
17
+ fi
18
+
19
+ if [ -z "$REPO_HOME" ] ; then
20
+ REPO_HOME="http://github.com/nvie/gitflow.git"
21
+ fi
22
+
23
+ EXEC_FILES="git-flow"
24
+ SCRIPT_FILES="git-flow-init git-flow-feature git-flow-hotfix git-flow-release git-flow-support git-flow-version gitflow-common gitflow-shFlags"
25
+ SUBMODULE_FILE="gitflow-shFlags"
26
+
27
+ echo "### gitflow no-make installer ###"
28
+
29
+ case "$1" in
30
+ uninstall)
31
+ echo "Uninstalling git-flow from $INSTALL_PREFIX"
32
+ if [ -d "$INSTALL_PREFIX" ] ; then
33
+ for script_file in $SCRIPT_FILES $EXEC_FILES ; do
34
+ echo "rm -vf $INSTALL_PREFIX/$script_file"
35
+ rm -vf "$INSTALL_PREFIX/$script_file"
36
+ done
37
+ else
38
+ echo "The '$INSTALL_PREFIX' directory was not found."
39
+ echo "Do you need to set INSTALL_PREFIX ?"
40
+ fi
41
+ exit
42
+ ;;
43
+ help)
44
+ echo "Usage: [environment] gitflow-installer.sh [install|uninstall]"
45
+ echo "Environment:"
46
+ echo " INSTALL_PREFIX=$INSTALL_PREFIX"
47
+ echo " REPO_HOME=$REPO_HOME"
48
+ echo " REPO_NAME=$REPO_NAME"
49
+ exit
50
+ ;;
51
+ *)
52
+ echo "Installing git-flow to $INSTALL_PREFIX"
53
+ if [ -d "$REPO_NAME" -a -d "$REPO_NAME/.git" ] ; then
54
+ echo "Using existing repo: $REPO_NAME"
55
+ else
56
+ echo "Cloning repo from GitHub to $REPO_NAME"
57
+ git clone "$REPO_HOME" "$REPO_NAME"
58
+ fi
59
+ if [ -f "$REPO_NAME/$SUBMODULE_FILE" ] ; then
60
+ echo "Submodules look up to date"
61
+ else
62
+ echo "Updating submodules"
63
+ lastcwd=$PWD
64
+ cd "$REPO_NAME"
65
+ git submodule init
66
+ git submodule update
67
+ cd "$lastcwd"
68
+ fi
69
+ install -v -d -m 0755 "$INSTALL_PREFIX"
70
+ for exec_file in $EXEC_FILES ; do
71
+ install -v -m 0755 "$REPO_NAME/$exec_file" "$INSTALL_PREFIX"
72
+ done
73
+ for script_file in $SCRIPT_FILES ; do
74
+ install -v -m 0644 "$REPO_NAME/$script_file" "$INSTALL_PREFIX"
75
+ done
76
+ exit
77
+ ;;
78
+ esac
@@ -6,10 +6,10 @@ module JobSearch
6
6
  # return a hash of job offers information.
7
7
  class Tecoloco
8
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']"
9
+ TITLE_JOB = "//span[@class = 'plaza visible-desktop']//a[@class = 'oferta-trabajo']"
10
+ CITY_JOB = "//span[@class = 'plaza visible-desktop']//span[@class = 'pais-trabajo']"
11
+ DATE_JOB = "//span[@class = 'plaza visible-desktop']//span[@class = 'imgVigencia-align sprite-imgVigencia']"
12
+ DETAIL_JOB = "//span[@class = 'plaza visible-desktop']//span[@class = 'detalle-trabajo']"
13
13
  URL_TECOLOCO = 'http://www.tecoloco.com/empleo-'
14
14
 
15
15
  # Function to obtain the whole information of the job offers at tecoloco
@@ -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 = "//span[@class = 'plaza visible-desktop']//a[@class = 'oferta-trabajo']"
10
+ CITY_JOB = "//span[@class = 'plaza visible-desktop']//span[@class = 'pais-trabajo']"
11
+ DATE_JOB = "//span[@class = 'plaza visible-desktop']//span[@class = 'imgVigencia-align sprite-imgVigencia']"
12
+ DETAIL_JOB = "//span[@class = 'plaza visible-desktop']//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
@@ -1,3 +1,3 @@
1
1
  module JobHunters
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
data/testsinatra.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'sinatra'
2
+
3
+ get '/hi' do
4
+ "Hello World!"
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobhunters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger, Edwin and Mauricio
@@ -51,12 +51,16 @@ files:
51
51
  - LICENSE
52
52
  - README.md
53
53
  - Rakefile
54
+ - app.rb
54
55
  - bin/jobhunters
56
+ - gitflow-installer.sh
55
57
  - jobhunters.gemspec
56
58
  - lib/jobhunters.rb
57
59
  - lib/jobhunters/JobSearch.rb
60
+ - lib/jobhunters/JobSearch.rb~
58
61
  - lib/jobhunters/version.rb
59
62
  - spec/test.rb
63
+ - testsinatra.rb
60
64
  homepage: https://github.com/rojotic26/tecoloco-job-offers.git
61
65
  licenses:
62
66
  - MIT