find_deals 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: aef9856b6afdd0c574a9d8b039aa0795203494837fc52bd010a83b565507d785
4
- data.tar.gz: 396acf291d62931e56f8515438f75d144cf58172a74e893d4f779428059e03ac
3
+ metadata.gz: 02c047e83f2444de3f44b5dfaa0497f049a7f1d4f96bfdf9164212c83c8916cc
4
+ data.tar.gz: 540282527bbf6031e430fb06593a0c40af7de5c024b0122c5df2856ef760694e
5
5
  SHA512:
6
- metadata.gz: 014ccc37b2568925a33fbed509f12e913082533009c9e413c809ded81ccffc8074670d7de8a5fd2c9b8c8afc9df1b540229348cb34437088eaf2e341e414753f
7
- data.tar.gz: 8111c921484e105c6286f3923f705a66183550e6011c2107c87ab58644f6681721dcf696cac9c4edae248aa1cc01b3918f078b9189f13f4970be99b4d44a14c8
6
+ metadata.gz: 5c3c8ee759504e2f57ed7ba3c62b3fa5df3003f38bbb74dafa17e23f4c25be618da3ba1860b3308b98e6b6e4e4bfca74ffa357432a0a703a1960a6095ee19656
7
+ data.tar.gz: 855068c031fe912f850f4dbce557203e2f3836c6aeff98ee45dd8fa8f63e2e56113dc3fe45af5d113b2aad02bf99e645655a3889df13e9de244bfa96f4549c25
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in find_deals.gemspec
6
6
  gemspec
7
7
 
8
- gem "find_deals", :git => "://github.com/nils-vanderwerf/find_deals.git"
8
+
9
9
  gem 'activerecord', '~> 5.2', :require => 'active_record'
10
10
  gem 'rake', "~> 13.0"
11
11
  gem 'rubocop', "~> 1.7" #code style checker
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- find_deals (0.1.0)
4
+ find_deals (0.1.1)
5
5
  activerecord
6
6
  nokogiri
7
7
  require_all
@@ -39,7 +39,7 @@ GEM
39
39
  minitest (5.14.4)
40
40
  mustermann (1.1.1)
41
41
  ruby2_keywords (~> 0.0.1)
42
- nokogiri (1.11.5-x86_64-darwin)
42
+ nokogiri (1.11.6-x86_64-darwin)
43
43
  racc (~> 1.4)
44
44
  parallel (1.20.1)
45
45
  parser (3.0.1.1)
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # FindDeals
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/find_deals`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Welcome to your this awesome find deals gem, whicgh scrapes https://www.scoopon.com.au/ and finds the best deals in a specific area, from a specific category.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,17 +20,30 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ 1. Type in the number of the Australian city you're interested in viewing.
24
+ 2. Type in the category you're interested in viewing (some combinations are unavailable - unfortunately there are no deals for a selection).
25
+ 3. It will come up with a list of deals with their title, location, price and discount.
26
+ 4. Type in a number you want to see more about
27
+ 5. It will give a short description of the selected deal.
28
+ 6. Specify Y or N (Yes or No) about whether you want to save the current deal.
29
+ 7. If yes, it will need a username to associate the deal with the user.
30
+ 8. If you click Y for Yes in the next step, it will print your saved deals.
31
+ 9. You are now presented with options -
32
+ - you can type it 'more' to see more deals (it is case insensitive)
33
+ - you can type it 'city' to see your saved deals by city
34
+ - you can type it 'categories' to your saved deals by category
35
+ - you can type it 'delete' to delete one of your saved deals
36
+ 10. It will then loop around to the appropriate function.
26
37
 
27
- ## Development
28
38
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+ ## Development
30
40
 
41
+ After checking out the repo, run `bin/setup` to install dependencies, which includes the database migrations.
31
42
  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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
43
 
33
44
  ## Contributing
34
45
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/find_deals. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/find_deals/blob/master/CODE_OF_CONDUCT.md).
46
+ Bug reports and pull requests are welcome on GitHub at https://github.com/nils-vanderwerf/find_deals. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nils_vanderwerf/find_deals/blob/master/CODE_OF_CONDUCT.md).
36
47
 
37
48
  ## License
38
49
 
Binary file
data/find_deals.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["n.vanderw.92@gmail.com"]
10
10
 
11
11
  spec.summary = "A Web scraper for Scoopon to find deals and promotions"
12
- spec.description = "Based on the users city and category input, they scrape a list of deals from Scoopon.com. They have they chhoice to save to the database and view their saved deals."
12
+ spec.description = "Based on the users city and category input, they scrape a list of deals from Scoopon.com. They have they choice to save to the database and view their saved deals."
13
13
  spec.homepage = "https://github.com/nils-vanderwerf/find_deals/"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
@@ -328,7 +328,7 @@ class FindDeals::CLI
328
328
  end
329
329
  end
330
330
 
331
- SavedDeals.all.delete_from_db(@input.to_i)
331
+ SavedDeals.all.delete_from_db(user, @input.to_i)
332
332
  prompt_to_show_saved_deals
333
333
  next_steps
334
334
 
@@ -15,8 +15,9 @@ class SavedDeals < ActiveRecord::Base
15
15
  puts "===================================================================="
16
16
  end
17
17
 
18
- def self.delete_from_db(user_input)
19
- title_to_delete = self.all[user_input-1].title
20
- self.where(title: title_to_delete).destroy_all
18
+ def self.delete_from_db(user, user_input)
19
+ selected_user_deals = SavedDeals.select {|deal| deal.user_id == user.id}
20
+ title_to_delete = selected_user_deals[user_input-1].title
21
+ SavedDeals.where(title: title_to_delete).destroy_all
21
22
  end
22
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FindDeals
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: find_deals
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
  - nils-vanderwerf
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-02 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -122,9 +122,9 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description: Based on the users city and category input, they scrape a list of deals
126
- from Scoopon.com. They have they chhoice to save to the database and view their
127
- saved deals.
125
+ description: Based on the users city and category input, they scrape a list of deals
126
+ from Scoopon.com. They have they choice to save to the database and view their saved
127
+ deals.
128
128
  email:
129
129
  - n.vanderw.92@gmail.com
130
130
  executables: []