job_hunter_cli 0.1.1 → 0.1.2
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 +4 -4
- data/job_hunter_cli-0.1.1.gem +0 -0
- data/lib/job_hunter_cli/cli.rb +14 -14
- data/lib/job_hunter_cli/scraper.rb +1 -1
- data/lib/job_hunter_cli/version.rb +1 -1
- data/lib/job_hunter_cli.rb +0 -1
- metadata +3 -4
- data/job_hunter_cli-0.1.0.gem +0 -0
- data/lib/job_hunter_cli/jobs.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8142a717b5608b0681936521f2e64b2cd4c0674
|
4
|
+
data.tar.gz: 37f722fd23e2b9a656e9a61b69fe4e726fd688f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5ffe381e72d43d3707756369af26e1552022d9141c0d1b97bba584989710927f666a4c31dadd8bafe3bc7d9bd916e8ad807cba020f7a284ccca653424fe9525
|
7
|
+
data.tar.gz: f080620e07d1bb02386caa2c83a2ffcb0ee91c292ddd6cad82da03335976a70d2522367299e1fb551e3cf3254de5cf629620adc8003c9b43e280a68611303396
|
Binary file
|
data/lib/job_hunter_cli/cli.rb
CHANGED
@@ -7,45 +7,45 @@ class JobHunterCli::CLI
|
|
7
7
|
input.downcase!
|
8
8
|
invalid = "invalid"
|
9
9
|
puts ""
|
10
|
-
puts "
|
11
|
-
puts "
|
10
|
+
puts " ---------------------------------- | WELCOME TO JOB HUNTER |-------------------------------- "
|
11
|
+
puts " If you press enter without input then search will return its default values "
|
12
|
+
puts " Job Hunter shows you only the most recent jobs posted on Indeed.com "
|
12
13
|
puts ""
|
13
14
|
scraper = JobHunterCli::Scraper.new
|
14
15
|
|
15
16
|
until input =="exit"
|
16
|
-
|
17
17
|
# check for input not equal to exit to prevent the cli from not exiting when type exit after prompt
|
18
|
-
|
19
|
-
if
|
18
|
+
if input !="exit"
|
19
|
+
puts "1. Enter the max number of the search results you want return. Defaults to 10 if not specified"
|
20
20
|
input = gets.strip
|
21
21
|
scraper.limit = "limit=" + input
|
22
22
|
end
|
23
23
|
|
24
|
+
if input!="exit"
|
24
25
|
puts "2. Enter any query or name of job role"
|
25
|
-
if input && input!="exit"
|
26
26
|
input = gets.strip
|
27
27
|
scraper.q = "q=" + input
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
if
|
30
|
+
if input!="exit"
|
31
|
+
puts "3. Enter initals or name of country. Defaults to US if not specified"
|
32
32
|
input = gets.strip
|
33
33
|
scraper.co = "co=" + input
|
34
34
|
end
|
35
35
|
|
36
|
+
if input!="exit"
|
36
37
|
puts "4. Enter a postal code or a city"
|
37
|
-
if input && input!="exit"
|
38
38
|
input = gets.strip
|
39
39
|
scraper.l = "l=" + input
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
if
|
42
|
+
if input!="exit"
|
43
|
+
puts "5. Enter a number for distance from search location. Defaults to 25 if not specified"
|
44
44
|
input = gets.strip
|
45
45
|
scraper.radius = "radius=" + input
|
46
46
|
end
|
47
47
|
|
48
|
-
if input !="exit"
|
48
|
+
if input != "exit"
|
49
49
|
scraper.scrape_jobs # start scrape
|
50
50
|
jobs_array = scraper.scrape_jobs # return the array of hash objects from scrape
|
51
51
|
counter=0 # apply numbering to results
|
@@ -57,8 +57,8 @@ class JobHunterCli::CLI
|
|
57
57
|
puts ""
|
58
58
|
end # end of first each enumerable
|
59
59
|
else
|
60
|
-
puts "
|
61
|
-
end # end of if statement
|
60
|
+
puts "Search Ended"
|
61
|
+
end # end of last if statement on line 47
|
62
62
|
end # end of until statement
|
63
63
|
|
64
64
|
end # end of start method
|
@@ -4,7 +4,7 @@ class JobHunterCli::Scraper
|
|
4
4
|
|
5
5
|
def scrape_jobs
|
6
6
|
# indeed.com api uses XML. To parse in XLM use Nokogiri
|
7
|
-
uri = "http://api.indeed.com/ads/apisearch?publisher=3881286689960538&#{@q}&#{@l}&sort
|
7
|
+
uri = "http://api.indeed.com/ads/apisearch?publisher=3881286689960538&#{@q}&#{@l}&sort=date&#{@radius}&st=&jt=&start=&#{@limit}&fromage=&filter=&latlong=1&#{@co}&chnl=&userip=1.2.3.4&useragent=Mozilla/%2F4.0%28Firefox%29&v=2"
|
8
8
|
jobs_array = []
|
9
9
|
jobs_hash = {}
|
10
10
|
doc = Nokogiri::XML(open(uri))
|
data/lib/job_hunter_cli.rb
CHANGED
@@ -5,7 +5,6 @@ require 'pry'
|
|
5
5
|
require_relative "job_hunter_cli/version"
|
6
6
|
require_relative "job_hunter_cli/scraper"
|
7
7
|
require_relative "job_hunter_cli/cli"
|
8
|
-
require_relative "job_hunter_cli/jobs"
|
9
8
|
|
10
9
|
#this sets up the JobHunter Module as having access to all the JobHunter::*FILES*
|
11
10
|
module JobHunterCli
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job_hunter_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lenn Hypolite
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open-uri
|
@@ -90,11 +90,10 @@ files:
|
|
90
90
|
- bin/console
|
91
91
|
- bin/job_hunter_cli
|
92
92
|
- bin/setup
|
93
|
-
- job_hunter_cli-0.1.
|
93
|
+
- job_hunter_cli-0.1.1.gem
|
94
94
|
- job_hunter_cli.gemspec
|
95
95
|
- lib/job_hunter_cli.rb
|
96
96
|
- lib/job_hunter_cli/cli.rb
|
97
|
-
- lib/job_hunter_cli/jobs.rb
|
98
97
|
- lib/job_hunter_cli/scraper.rb
|
99
98
|
- lib/job_hunter_cli/version.rb
|
100
99
|
- spec.md
|
data/job_hunter_cli-0.1.0.gem
DELETED
Binary file
|
data/lib/job_hunter_cli/jobs.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
class JobHunterCli::Jobs
|
2
|
-
attr_accessor :job_role, :company, :city, :state, :country, :url, :description, :date_posted, :post_duration
|
3
|
-
|
4
|
-
@@all = []
|
5
|
-
|
6
|
-
# takes in an argument of a hash and sets that new student's attributes using the key/value pairs of that hash.
|
7
|
-
def initialize(jobs_hash)
|
8
|
-
jobs_hash.each do |title, string|
|
9
|
-
self.send("#{title}=", string)
|
10
|
-
end
|
11
|
-
@@all << self
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.create_from_collection(jobs_array)
|
15
|
-
jobs_array.each do |jobs_hash|
|
16
|
-
self.new(jobs_hash) # mass assignment It's taking a hash with key and value pairs as arguments
|
17
|
-
# and setting them equal to the attributes that the class has
|
18
|
-
# handing it off to initialize
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.all
|
23
|
-
@@all
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|