indeed_scraper 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
  SHA256:
3
- metadata.gz: 31a4a686bc7617cd3d7cda00a6b207ae3e16e6aec5fdc606583629d5dbe37dde
4
- data.tar.gz: 20d53a19f5d6732df7cdd1fe5284ff550232431b7b80fb86610e08a928c7f9c3
3
+ metadata.gz: b927e28d353e15313a480a0adb399ef094eee722d546f63b2961f2711cc27129
4
+ data.tar.gz: fbfa2e6a0abb288aa8b13e95089f4368bcd19c48d10bf12914c09a0033b58a73
5
5
  SHA512:
6
- metadata.gz: aaffb8511b507201d57e74f4ca0467e07701cbd07d748ba85a54e4699f991a45a845707ecca823fa34f3d8b65d97536f6ea76433d42c7f62af17d8afbadb164c
7
- data.tar.gz: 464e7e9dbab6d49a26ffbc7827fcd0fb4f41a9b00e5755a7890c0ae5088ab41c52664644cb467214f05150cb9cd0551f0bf7bf7859040c828d897a3164aea9e2
6
+ metadata.gz: 5904fac759cf34e4b9f89ebb8664d74d1e509e857d22952ad2ec7ca9325d51b25c5857ca0ed5f2708961b1e497af670e0c9efbf148fd0674886535984cd6a921
7
+ data.tar.gz: ab257b416e055b824ed19a183fd43e95c651da3a4c1416ffcf0c5a892ca4957b3cea9c5678a9f3f7b28e4c4b2a0d6a98855ff06aa4af5ff3c04240d33eb2b8fb
data/Gemfile CHANGED
@@ -6,4 +6,5 @@ gem 'nokogiri'
6
6
  gem 'open-uri'
7
7
 
8
8
  # Specify your gem's dependencies in indeed_scraper.gemspec
9
- gemspec
9
+
10
+ gemspec
data/README.md CHANGED
@@ -20,7 +20,8 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- jobs = IndeedScraper::Job.
23
+ Run 'indeed_scraper' after installing.
24
+
24
25
 
25
26
  ## Development
26
27
 
data/bin/run CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  require_relative '../lib/indeed_scraper.rb'
4
4
 
5
- CommandLineInterface.new.run_program
6
-
7
-
5
+ cli = CommandLineInterface.new
6
+ cli.greeting
7
+ cli.run_program
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ notes
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at 'sheena.myb@gmail.com'. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|indeed_scraper| "https://github.com/essbee808/indeed_scraper" }
4
+ gem 'colorize'
5
+ gem 'nokogiri'
6
+ gem 'open-uri'
7
+
8
+ # Specify your gem's dependencies in indeed_scraper.gemspec
9
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 'Sheena Bonilla'
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # IndeedScraper
2
+
3
+ Welcome to Indeed Scraper! This CLI (Command Line Interface) Gem was created to provide assistance in finding employment. Data is extracted from an external source (i.e. www.indeed.com) and displayed as the following attributes: title, company, location, hours/salary, job url, and a short description.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'indeed_scraper'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install indeed_scraper
20
+
21
+ ## Usage
22
+
23
+ jobs = IndeedScraper::Job.
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/run` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/'essbee808'/indeed_scraper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
38
+
39
+ ## Code of Conduct
40
+
41
+ Everyone interacting in the IndeedScraper project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/'essbee808'/indeed_scraper/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ #=> tells the shell which interpreter to use to execute the remainder of the file.
3
+
4
+ require "bundler/setup"
5
+ require "indeed/scraper"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/indeed_scraper.rb'
4
+
5
+ CommandLineInterface.new.run_program
6
+
7
+
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,42 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "indeed_scraper/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "indeed_scraper"
8
+ spec.version = IndeedScraper::VERSION
9
+ spec.authors = ["'Sheena Bonilla'"]
10
+ spec.email = ["'sheena.myb@gmail.com'"]
11
+ spec.files = ["lib/indeed_scraper.rb"]
12
+ spec.summary = %q{Indeed Scraper was created to provide assistance in finding employment.}
13
+ spec.description = %q{Data is extracted from an external source (i.e. www.indeed.com) and displayed as the following attributes: title, location, hours/salary, job url, and a short description.}
14
+ spec.homepage = "https://github.com/essbee808/indeed_scraper"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "https://rubygems.org/profiles/essbee808"
21
+
22
+ # spec.metadata["homepage_uri"] = spec.homepage
23
+ # spec.metadata["source_code_uri"] = "https://github.com/essbee808/indeed_scraper.git"
24
+ # else
25
+ # raise "RubyGems 2.0 or newer is required to protect against " \
26
+ # "public gem pushes."
27
+ # end
28
+
29
+ # Specify which files should be added to the gem when it is released.
30
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
+ end
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ["lib"]
37
+
38
+ spec.add_development_dependency "bundler", "~> 1.17"
39
+ spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_dependency "colorize", "0.8"
41
+ spec.add_dependency "nokogiri", "1.8.5"
42
+ end
@@ -0,0 +1,153 @@
1
+ class CommandLineInterface
2
+
3
+ BASE_PATH = "https://www.indeed.com"
4
+
5
+ def run_program
6
+ greeting
7
+ make_jobs
8
+ add_other_attributes_to_job
9
+ display_job
10
+ end
11
+
12
+ def greeting
13
+ puts "Hello there! Welcome to Indeed Scraper Command Line Interface.".green
14
+ puts "What is your name?".green
15
+ @user_name = user_input
16
+ puts " "
17
+ puts "Aloha, #{@input}!".green
18
+ puts "Enter your 5 digit zipcode:".green
19
+ end
20
+
21
+ #User's input
22
+ def user_input
23
+ input = gets.strip #remove white space
24
+ @input = input
25
+ end
26
+
27
+ def make_selection
28
+ puts " "
29
+ puts "Select a number from the list above for more info.".green
30
+ puts "Enter a number:".green
31
+ user_input
32
+
33
+ if @input.to_i.between?(1, 15)
34
+ puts " "
35
+ job = Job.all[@input.to_i-1]
36
+
37
+ puts " "
38
+ puts "TITLE: ".blue + "#{job.title}\n" if !job.title.empty?
39
+ puts "COMPANY: ".blue + "#{job.company}\n" if !job.company.empty?
40
+ puts "HOURS/SALARY: ".blue + "#{job.type}\n" if !job.type.empty?
41
+ puts "LOCATION: ".blue + "#{job.location}\n\n" if !job.location.empty?
42
+ if !job.description.empty?
43
+ puts "DESCRIPTION: \n".blue
44
+ puts "#{job.description}\n"
45
+ end
46
+ menu_list
47
+ else
48
+ make_selection
49
+ end
50
+ end
51
+
52
+ def menu_list
53
+ puts " "
54
+ puts "What do you want to do, #{@user_name}?".green
55
+ puts "Enter a number:\n".green
56
+ puts "1. Apply"
57
+ puts "2. Go back"
58
+ puts "3. Exit\n"
59
+
60
+ user_input
61
+ # binding.pry
62
+ if @input.to_i == 1
63
+ job = Job.all[@input.to_i-1]
64
+ puts "To apply, right click on the link below then select 'Open URL'.".green
65
+ puts " "
66
+ puts BASE_PATH + job.job_url
67
+ menu_list
68
+ elsif @input.to_i == 2
69
+ display_job
70
+ elsif @input.to_i == 3
71
+ puts " "
72
+ puts "See you later, #{@user_name}! Good luck on your job search!".green
73
+ else
74
+ menu_list
75
+ end
76
+ end
77
+
78
+ def verify_zipcode
79
+ if /^[0-9]{5}$/.match(@input)
80
+ puts "Great! We found some cool jobs for #{@input}.".green
81
+ puts "Loading may take a few moments, so in the meantime, please enjoy this cute cat: \n\n\n".green
82
+ puts " /\\_/\\ ".magenta.blink
83
+ puts " ( o.o ) ".magenta.blink
84
+ puts " > ^ < \n\n\n\n".magenta.blink
85
+ else
86
+ puts "Hmm...that doesn't look right. Enter your 5 digit zipcode:".green
87
+ user_input
88
+ verify_zipcode
89
+ end
90
+ @input
91
+ end
92
+
93
+ def make_jobs
94
+ user_input
95
+ puts " "
96
+ verify_zipcode
97
+ jobs_array = Scraper.scrape_index_page(@input)
98
+ Job.create_from_collection(jobs_array) # creates an array of job objects with 4 attributes
99
+ end
100
+
101
+ def add_other_attributes_to_job
102
+ Job.all.each do |job|
103
+ other_details = Scraper.scrape_job_post(BASE_PATH + job.job_url)
104
+ job.add_job_attributes(other_details)
105
+ end
106
+ end
107
+
108
+ def display_job
109
+ Job.all.each.with_index(1) do |el, index|
110
+ #if index <= 4 #=> displays first 5 jobs in @@all array
111
+ puts "#{index}" + ". " + "#{el.title}\n\n"
112
+ end
113
+ make_selection
114
+ end
115
+
116
+ end
117
+
118
+ #display first 5 jobs
119
+ #prompt user to make a selection or type 'more' for more choices
120
+ #if user selects index 0-4
121
+ # display details for job object
122
+ # ask for user input
123
+ # prompts: apply (display url) or go back?
124
+ #elsif user selects 'more'
125
+ # pull next 5 job objects from array
126
+ # display as 1-5?
127
+ # ask for user input
128
+ # prompt: make a selection or type 'more' for more choices
129
+ #else
130
+ # loop
131
+ #end
132
+
133
+
134
+ # prompt user for zipcode
135
+ #Great! Please enter your 5 digit zipcode:
136
+
137
+ # user types zipcode
138
+
139
+ # first scrape => grabs first 15 and create job objects
140
+ #Scraper.scrape_index_page(index)
141
+
142
+ # display 5 jobs at a time
143
+
144
+ # user selects job from list to get more info
145
+
146
+ # second scrape => display everything nicely
147
+ # attributes: type (part/full), description, wage...
148
+
149
+ # conditional => Still interested? Type yes or no
150
+
151
+ # give options to see next 5 jobs
152
+
153
+ # set variable equal to last index number?
@@ -0,0 +1,33 @@
1
+ class Job
2
+ attr_accessor :title, :company, :description, :location, :job_url, :type
3
+
4
+ @@all = []
5
+
6
+ def initialize(job_hash)
7
+ job_hash.each {|key, value| self.send(("#{key}="), value)}
8
+ @@all << self
9
+ end
10
+
11
+ def self.create_from_collection(jobs_array)
12
+ jobs_array.each do |hash|
13
+ new_job = self.new(hash)
14
+ new_job
15
+ end
16
+ end
17
+
18
+ def add_job_attributes(other_details)
19
+ #iterate over attributes_hash
20
+ #use metaprogramming; assign job attributes and values using send method
21
+ other_details.each do |key, value|
22
+ @description = other_details[:description]
23
+ @type = other_details[:type]
24
+ end
25
+ @description = self.description
26
+ @type = self.type
27
+ end
28
+
29
+ def self.all
30
+ @@all
31
+ end
32
+
33
+ end
@@ -0,0 +1,34 @@
1
+ class Scraper
2
+
3
+ BASE_PATH = "https://www.indeed.com"
4
+
5
+ def self.scrape_index_page(input)
6
+ html = open(BASE_PATH + "/l-#{input}-jobs.html") # interpolate input
7
+ parsed_page = Nokogiri::HTML(html)
8
+ all_jobs = parsed_page.css('div.jobsearch-SerpJobCard')
9
+
10
+ all_jobs.collect do |job_card|
11
+ job = {
12
+ :title => job_card.css('a').attr('title').value,
13
+ :company => job_card.css('span.company').text.strip, #remove white space
14
+ :location => job_card.css('div.location').text,
15
+ :job_url => job_card.css('a').attr('href').value
16
+ }
17
+ job
18
+ end
19
+ end
20
+
21
+ def self.scrape_job_post(job_url)
22
+ html = open(job_url)
23
+ parsed_job_post = Nokogiri::HTML(html) #parse html
24
+ other_details = parsed_job_post.css('div.jobsearch-ViewJobLayout-jobDisplay')
25
+
26
+ details_hash = {}
27
+
28
+ other_details.each do |info|
29
+ details_hash[:description] = info.css('div.jobsearch-JobComponent-description p').text
30
+ details_hash[:type] = info.css('div.jobsearch-JobMetadataHeader-item').text
31
+ end
32
+ details_hash
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module IndeedScraper
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,13 @@
1
+ #environment file
2
+ #require Gems
3
+ require 'pry'
4
+ require 'nokogiri'
5
+ require 'open-uri'
6
+ require 'colorize'
7
+
8
+ require_relative "indeed_scraper/version"
9
+ require_relative "indeed_scraper/command_line_interface"
10
+ require_relative "indeed_scraper/job"
11
+ require_relative "indeed_scraper/scraper"
12
+
13
+ #when referencing, don't need .rb
@@ -31,12 +31,13 @@ Gem::Specification.new do |spec|
31
31
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
32
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
33
  end
34
- spec.bindir = "exe"
35
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.bindir = "bin"
35
+ spec.executables = ["run"]
36
36
  spec.require_paths = ["lib"]
37
37
 
38
38
  spec.add_development_dependency "bundler", "~> 1.17"
39
39
  spec.add_development_dependency "rake", "~> 10.0"
40
- spec.add_dependency "colorize", "0.8"
41
- spec.add_dependency "nokogiri", "1.8.5"
40
+ spec.add_dependency "colorize", "~> 0.8.1"
41
+ spec.add_dependency "nokogiri", "~> 1.8"
42
+
42
43
  end
@@ -2,11 +2,10 @@ class CommandLineInterface
2
2
 
3
3
  BASE_PATH = "https://www.indeed.com"
4
4
 
5
- def run_program
6
- greeting
7
- make_jobs
8
- add_other_attributes_to_job
9
- display_job
5
+ def run_program
6
+ make_jobs
7
+ add_other_attributes_to_job
8
+ display_job
10
9
  end
11
10
 
12
11
  def greeting
@@ -14,27 +13,29 @@ class CommandLineInterface
14
13
  puts "What is your name?".green
15
14
  @user_name = user_input
16
15
  puts " "
17
- puts "Aloha, #{@input}!".green
18
- puts "Enter your 5 digit zipcode:".green
16
+ puts "Hello, #{@user_name}!".green
17
+ @user_name
19
18
  end
20
19
 
21
- #User's input
22
20
  def user_input
23
21
  input = gets.strip #remove white space
24
22
  @input = input
25
23
  end
24
+
25
+ def zipcode
26
+ puts "Enter your 5 digit zipcode:".green
27
+ end
26
28
 
27
29
  def make_selection
28
- puts " "
29
- puts "Select a number from the list above for more info.".green
30
- puts "Enter a number:".green
30
+ puts "Select a number from the list above for more info or type 'back' to enter a new zipcode.".green
31
31
  user_input
32
32
 
33
+ #=> conditional statement depending on user's selection
33
34
  if @input.to_i.between?(1, 15)
34
35
  puts " "
35
36
  job = Job.all[@input.to_i-1]
36
-
37
37
  puts " "
38
+ @url = BASE_PATH + job.job_url
38
39
  puts "TITLE: ".blue + "#{job.title}\n" if !job.title.empty?
39
40
  puts "COMPANY: ".blue + "#{job.company}\n" if !job.company.empty?
40
41
  puts "HOURS/SALARY: ".blue + "#{job.type}\n" if !job.type.empty?
@@ -44,8 +45,12 @@ class CommandLineInterface
44
45
  puts "#{job.description}\n"
45
46
  end
46
47
  menu_list
48
+ @url
49
+ elsif @input == "back"
50
+ clear_all
51
+ run_program
47
52
  else
48
- make_selection
53
+ make_selection
49
54
  end
50
55
  end
51
56
 
@@ -55,20 +60,16 @@ class CommandLineInterface
55
60
  puts "Enter a number:\n".green
56
61
  puts "1. Apply"
57
62
  puts "2. Go back"
58
- puts "3. Exit\n"
63
+ puts "3. Exit\n\n"
59
64
 
60
65
  user_input
61
- # binding.pry
62
- if @input.to_i == 1
63
- job = Job.all[@input.to_i-1]
64
- puts "To apply, right click on the link below then select 'Open URL'.".green
65
- puts " "
66
- puts BASE_PATH + job.job_url
66
+ if @input.to_i == 1 #=> utilize #to_i to convert input to integer
67
+ puts "To apply, right click on the link below then select 'Open URL'.\n\n".green
68
+ puts @url
67
69
  menu_list
68
70
  elsif @input.to_i == 2
69
71
  display_job
70
72
  elsif @input.to_i == 3
71
- puts " "
72
73
  puts "See you later, #{@user_name}! Good luck on your job search!".green
73
74
  else
74
75
  menu_list
@@ -76,8 +77,8 @@ class CommandLineInterface
76
77
  end
77
78
 
78
79
  def verify_zipcode
79
- if /^[0-9]{5}$/.match(@input)
80
- puts "Great! We found some cool jobs for #{@input}.".green
80
+ if /^[0-9]{5}$/.match(@input) #=> check to see that zipcode has 5 digits
81
+ puts "Great! Here's what we found for #{@input}.".green
81
82
  puts "Loading may take a few moments, so in the meantime, please enjoy this cute cat: \n\n\n".green
82
83
  puts " /\\_/\\ ".magenta.blink
83
84
  puts " ( o.o ) ".magenta.blink
@@ -91,6 +92,7 @@ class CommandLineInterface
91
92
  end
92
93
 
93
94
  def make_jobs
95
+ zipcode
94
96
  user_input
95
97
  puts " "
96
98
  verify_zipcode
@@ -113,23 +115,12 @@ class CommandLineInterface
113
115
  make_selection
114
116
  end
115
117
 
118
+ def clear_all
119
+ Job.all.clear
120
+ end
121
+
116
122
  end
117
123
 
118
- #display first 5 jobs
119
- #prompt user to make a selection or type 'more' for more choices
120
- #if user selects index 0-4
121
- # display details for job object
122
- # ask for user input
123
- # prompts: apply (display url) or go back?
124
- #elsif user selects 'more'
125
- # pull next 5 job objects from array
126
- # display as 1-5?
127
- # ask for user input
128
- # prompt: make a selection or type 'more' for more choices
129
- #else
130
- # loop
131
- #end
132
-
133
124
 
134
125
  # prompt user for zipcode
135
126
  #Great! Please enter your 5 digit zipcode:
@@ -139,8 +130,6 @@ end
139
130
  # first scrape => grabs first 15 and create job objects
140
131
  #Scraper.scrape_index_page(index)
141
132
 
142
- # display 5 jobs at a time
143
-
144
133
  # user selects job from list to get more info
145
134
 
146
135
  # second scrape => display everything nicely
@@ -16,8 +16,6 @@ class Job
16
16
  end
17
17
 
18
18
  def add_job_attributes(other_details)
19
- #iterate over attributes_hash
20
- #use metaprogramming; assign job attributes and values using send method
21
19
  other_details.each do |key, value|
22
20
  @description = other_details[:description]
23
21
  @type = other_details[:type]
@@ -1,3 +1,3 @@
1
1
  module IndeedScraper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -11,3 +11,6 @@ require_relative "indeed_scraper/job"
11
11
  require_relative "indeed_scraper/scraper"
12
12
 
13
13
  #when referencing, don't need .rb
14
+
15
+ module Concerns
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indeed_scraper
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
  - "'Sheena Bonilla'"
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-22 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,36 +42,37 @@ dependencies:
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.8'
47
+ version: 0.8.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.8'
54
+ version: 0.8.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.8.5
61
+ version: '1.8'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.8.5
68
+ version: '1.8'
69
69
  description: 'Data is extracted from an external source (i.e. www.indeed.com) and
70
70
  displayed as the following attributes: title, location, hours/salary, job url, and
71
71
  a short description.'
72
72
  email:
73
73
  - "'sheena.myb@gmail.com'"
74
- executables: []
74
+ executables:
75
+ - run
75
76
  extensions: []
76
77
  extra_rdoc_files: []
77
78
  files:
@@ -85,6 +86,21 @@ files:
85
86
  - bin/notes
86
87
  - bin/run
87
88
  - bin/setup
89
+ - indeed_scraper-0.1.0/.gitignore
90
+ - indeed_scraper-0.1.0/CODE_OF_CONDUCT.md
91
+ - indeed_scraper-0.1.0/Gemfile
92
+ - indeed_scraper-0.1.0/LICENSE.txt
93
+ - indeed_scraper-0.1.0/README.md
94
+ - indeed_scraper-0.1.0/Rakefile
95
+ - indeed_scraper-0.1.0/bin/console
96
+ - indeed_scraper-0.1.0/bin/run
97
+ - indeed_scraper-0.1.0/bin/setup
98
+ - indeed_scraper-0.1.0/indeed_scraper.gemspec
99
+ - indeed_scraper-0.1.0/lib/indeed_scraper.rb
100
+ - indeed_scraper-0.1.0/lib/indeed_scraper/command_line_interface.rb
101
+ - indeed_scraper-0.1.0/lib/indeed_scraper/job.rb
102
+ - indeed_scraper-0.1.0/lib/indeed_scraper/scraper.rb
103
+ - indeed_scraper-0.1.0/lib/indeed_scraper/version.rb
88
104
  - indeed_scraper.gemspec
89
105
  - lib/indeed_scraper.rb
90
106
  - lib/indeed_scraper/command_line_interface.rb