stelling_banjos 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +23 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/Rakefile +2 -0
- data/banjo_deals-0.1.0.gem +0 -0
- data/bin/banjo +5 -0
- data/bin/console +13 -0
- data/bin/setup +8 -0
- data/lib/environment.rb +14 -0
- data/lib/stelling_banjos/banjos.rb +34 -0
- data/lib/stelling_banjos/cli.rb +166 -0
- data/lib/stelling_banjos/scraper.rb +32 -0
- data/lib/stelling_banjos/version.rb +3 -0
- data/stelling_banjos.gemspec +33 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 858f5b2e78762cb5cd88e8cd9be18f5e6734e000e918c6f561bbe5dcdab65e30
|
4
|
+
data.tar.gz: 6e2ad7a39de665d01282d49e8fdc5fc478f948beedc49ae8f35c4eea46f94643
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c4229ddd7d46878f91e9366073670cf6fad1fec2d2853e93c3855f90465d1081fc58c5e5f40122b64982e6f0c123ba9eaadac81dda9773f9ca7b2a8f2a191050
|
7
|
+
data.tar.gz: c39329d31f1e36e00320a8f2989ab984e17d7e43a803c594409683a6476f1df13bcb84bbab02f516e61c93bf2a40977f86db7cbe99d8222329b1b3609a902678
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 'slaydenriley@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/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
coderay (1.1.2)
|
5
|
+
colorize (0.8.1)
|
6
|
+
method_source (0.9.2)
|
7
|
+
mini_portile2 (2.4.0)
|
8
|
+
nokogiri (1.10.4)
|
9
|
+
mini_portile2 (~> 2.4.0)
|
10
|
+
pry (0.12.2)
|
11
|
+
coderay (~> 1.1.0)
|
12
|
+
method_source (~> 0.9.0)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
colorize
|
19
|
+
nokogiri (= 1.10.4)
|
20
|
+
pry
|
21
|
+
|
22
|
+
BUNDLED WITH
|
23
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 'Riley Slayden'
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# StellingBanjos
|
2
|
+
|
3
|
+
The StellingBanjos gem provides the user with a list of Stelling Banjos (the best banjos) for sale
|
4
|
+
from the website https://www.elderly.com using a CLI. The catelog displays each banjo name, the price,
|
5
|
+
and whether or not it is in stock.
|
6
|
+
|
7
|
+
The user can then make a specific banjo selection to view more information about a banjo and can follow
|
8
|
+
a link to the specific banjo webpage.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'stelling_banjos'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install stelling_banjos
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Simply enter the CLI by running ruby bin/banjo and follow the on-screen instructions.
|
29
|
+
|
30
|
+
## Development
|
31
|
+
|
32
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
33
|
+
|
34
|
+
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).
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/'slaydenriley'/stelling_banjos. 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.
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
43
|
+
|
44
|
+
## Code of Conduct
|
45
|
+
|
46
|
+
Everyone interacting in the StellingBanjos project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/'slaydenriley'/stelling_banjos/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
Binary file
|
data/bin/banjo
ADDED
data/bin/console
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
|
5
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
6
|
+
# with your gem easier. You can also use a different console, if you like.
|
7
|
+
|
8
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
9
|
+
# require "pry"
|
10
|
+
# Pry.start
|
11
|
+
|
12
|
+
require "irb"
|
13
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/environment.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative "stelling_banjos/version"
|
2
|
+
require_relative "stelling_banjos/cli"
|
3
|
+
require_relative "stelling_banjos/scraper"
|
4
|
+
require_relative "stelling_banjos/banjos"
|
5
|
+
|
6
|
+
require 'nokogiri'
|
7
|
+
require 'open-uri'
|
8
|
+
require 'pry'
|
9
|
+
require 'colorize'
|
10
|
+
|
11
|
+
module StellingBanjos
|
12
|
+
class Error < StandardError; end
|
13
|
+
# Your code goes here...
|
14
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class StellingBanjos::Banjos
|
2
|
+
attr_accessor :name, :price, :link, :sold_out
|
3
|
+
|
4
|
+
@@all = []
|
5
|
+
|
6
|
+
def initialize(name, price, link, sold_out)
|
7
|
+
@name = name
|
8
|
+
@price = price
|
9
|
+
@link = link
|
10
|
+
@sold_out = sold_out
|
11
|
+
@@all << self
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.create_from_catelog(array)
|
15
|
+
array.each do |hash|
|
16
|
+
self.new(hash[:name], hash[:price], hash[:link], hash[:sold_out])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def sold_out?
|
21
|
+
case @sold_out
|
22
|
+
when "Yes"
|
23
|
+
return true
|
24
|
+
when "No"
|
25
|
+
return false
|
26
|
+
else
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.all
|
32
|
+
@@all
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
class StellingBanjos::Cli
|
2
|
+
|
3
|
+
LINK = "https://www.elderly.com/collections/stelling"
|
4
|
+
|
5
|
+
def start
|
6
|
+
puts ""
|
7
|
+
puts " ██████╗ █████╗ ███╗ ██╗ ██╗ ██████╗ ███████╗██╗".colorize(:green)
|
8
|
+
puts " ██╔══██╗██╔══██╗████╗ ██║ ██║██╔═══██╗██╔════╝██║".colorize(:green)
|
9
|
+
puts " ██████╔╝███████║██╔██╗ ██║ ██║██║ ██║███████╗██║".colorize(:green)
|
10
|
+
puts " ██╔══██╗██╔══██║██║╚██╗██║██ ██║██║ ██║╚════██║╚═╝".colorize(:green)
|
11
|
+
puts " ██████╔╝██║ ██║██║ ╚████║╚█████╔╝╚██████╔╝███████║██╗".colorize(:green)
|
12
|
+
puts " ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚════╝ ╚═════╝ ╚══════╝╚═╝".colorize(:green)
|
13
|
+
puts " ██████████████████████████████████████████████████████".colorize(:green)
|
14
|
+
puts ""
|
15
|
+
puts " Hello! Welcome to the Stelling Banjos catelog! The best banjos in the world!"
|
16
|
+
first_menu
|
17
|
+
end
|
18
|
+
|
19
|
+
def first_menu
|
20
|
+
puts ""
|
21
|
+
puts " MENU"
|
22
|
+
puts " ══════════════════════════════════"
|
23
|
+
puts " -Press 'Enter' to view the catelog".colorize(:green)
|
24
|
+
puts " -Type 'Exit' to leave".colorize(:red)
|
25
|
+
puts " ══════════════════════════════════"
|
26
|
+
|
27
|
+
input = gets.strip.downcase
|
28
|
+
case input
|
29
|
+
when ""
|
30
|
+
puts " Loading...".colorize(:red)
|
31
|
+
create_banjos
|
32
|
+
display_banjos
|
33
|
+
when "exit"
|
34
|
+
exit_out
|
35
|
+
else
|
36
|
+
puts " Please make a valid entry".colorize(:red)
|
37
|
+
puts ""
|
38
|
+
first_menu
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_banjos
|
43
|
+
StellingBanjos::Scraper.scrape_catelog_page(LINK)
|
44
|
+
StellingBanjos::Banjos.create_from_catelog(StellingBanjos::Scraper.all)
|
45
|
+
end
|
46
|
+
|
47
|
+
def display_banjos
|
48
|
+
puts ""
|
49
|
+
puts " ██████╗ █████╗ ████████╗███████╗██╗ ██████╗ ██████╗ ".colorize(:green)
|
50
|
+
puts " ██╔════╝██╔══██╗╚══██╔══╝██╔════╝██║ ██╔═══██╗██╔════╝ ".colorize(:green)
|
51
|
+
puts " ██║ ███████║ ██║ █████╗ ██║ ██║ ██║██║ ███╗".colorize(:green)
|
52
|
+
puts " ██║ ██╔══██║ ██║ ██╔══╝ ██║ ██║ ██║██║ ██║".colorize(:green)
|
53
|
+
puts " ╚██████╗██║ ██║ ██║ ███████╗███████╗╚██████╔╝╚██████╔╝".colorize(:green)
|
54
|
+
puts " ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ".colorize(:green)
|
55
|
+
puts " ███████████████████████████████████████████████████████████".colorize(:green)
|
56
|
+
puts " ~ Supplied by www.elderly.com ~".colorize(:red)
|
57
|
+
puts ""
|
58
|
+
|
59
|
+
StellingBanjos::Banjos.all.each.with_index do |banjo, index|
|
60
|
+
if banjo.sold_out?
|
61
|
+
puts " #{index + 1}. #{banjo.name} - #{banjo.price}" + " - SOLD OUT".colorize(:red)
|
62
|
+
else
|
63
|
+
puts " #{index + 1}. #{banjo.name} - #{banjo.price}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
second_menu
|
67
|
+
end
|
68
|
+
|
69
|
+
def second_menu
|
70
|
+
puts ""
|
71
|
+
puts " MENU"
|
72
|
+
puts " ══════════════════════════════════════════"
|
73
|
+
puts " -Enter a banjo number for more information".colorize(:green)
|
74
|
+
puts " -Type 'Exit' to exit".colorize(:red)
|
75
|
+
puts " ══════════════════════════════════════════"
|
76
|
+
|
77
|
+
input = gets.strip
|
78
|
+
if input.downcase == "exit"
|
79
|
+
exit_out
|
80
|
+
elsif input.to_i.between?(1, StellingBanjos::Banjos.all.length)
|
81
|
+
puts " Loading...".colorize(:red)
|
82
|
+
info_page_display(input)
|
83
|
+
else
|
84
|
+
puts ""
|
85
|
+
puts " Please make a valid entry".colorize(:red)
|
86
|
+
second_menu
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def info_page_display(input)
|
91
|
+
input = input.to_i - 1
|
92
|
+
|
93
|
+
link = StellingBanjos::Banjos.all[input].link
|
94
|
+
description = StellingBanjos::Scraper.scrape_info_page(link)
|
95
|
+
formatted_description = add_newlines(description, 68)
|
96
|
+
name = StellingBanjos::Banjos.all[input].name
|
97
|
+
price = StellingBanjos::Banjos.all[input].price
|
98
|
+
|
99
|
+
puts ""
|
100
|
+
puts ""
|
101
|
+
puts " █ #{name.upcase} - #{price}".colorize(:green)
|
102
|
+
puts ""
|
103
|
+
puts " █ #{formatted_description}"
|
104
|
+
puts ""
|
105
|
+
if StellingBanjos::Banjos.all[input].sold_out?
|
106
|
+
puts " █ SORRY! This banjo is SOLD OUT from elderly.com! Let's check Google instead...".colorize(:red)
|
107
|
+
puts " ==> https://www.google.com/search?q=#{name.downcase.gsub(" ", "-")}".colorize(:blue)
|
108
|
+
else
|
109
|
+
puts " █ Interested in buying? Go here:"
|
110
|
+
puts " ==> #{link}".colorize(:blue)
|
111
|
+
end
|
112
|
+
puts ""
|
113
|
+
third_menu
|
114
|
+
end
|
115
|
+
|
116
|
+
def third_menu
|
117
|
+
puts ""
|
118
|
+
puts " MENU"
|
119
|
+
puts " ══════════════════════════════════════════"
|
120
|
+
puts " -Enter another banjo number".colorize(:green)
|
121
|
+
puts " -Type 'Catelog' to view the catelog again".colorize(:green)
|
122
|
+
puts " -Type 'Exit' to exit".colorize(:red)
|
123
|
+
puts " ══════════════════════════════════════════"
|
124
|
+
puts ""
|
125
|
+
|
126
|
+
input = gets.strip
|
127
|
+
if input.downcase == "exit"
|
128
|
+
exit_out
|
129
|
+
elsif input.to_i.between?(1, StellingBanjos::Banjos.all.length)
|
130
|
+
puts " Loading...".colorize(:red)
|
131
|
+
info_page_display(input)
|
132
|
+
elsif input.downcase == "catelog"
|
133
|
+
display_banjos
|
134
|
+
else
|
135
|
+
puts ""
|
136
|
+
puts " Please make a valid entry".colorize(:red)
|
137
|
+
third_menu
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def add_newlines(string, max_length)
|
142
|
+
words = string.split(' ')
|
143
|
+
lines = []
|
144
|
+
current_line = ''
|
145
|
+
until words.empty?
|
146
|
+
current_line += " #{words.shift}"
|
147
|
+
if current_line.length >= max_length
|
148
|
+
lines << current_line
|
149
|
+
current_line = ''
|
150
|
+
end
|
151
|
+
end
|
152
|
+
lines.push(current_line).join("\n ").lstrip
|
153
|
+
end
|
154
|
+
|
155
|
+
def exit_out
|
156
|
+
puts ""
|
157
|
+
puts " ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗███████╗██╗ ".colorize(:red)
|
158
|
+
puts " ██╔════╝ ██╔═══██╗██╔═══██╗██╔══██╗██╔══██╗╚██╗ ██╔╝██╔════╝██║".colorize(:red)
|
159
|
+
puts " ██║ ███╗██║ ██║██║ ██║██║ ██║██████╔╝ ╚████╔╝ █████╗ ██║".colorize(:red)
|
160
|
+
puts " ██║ ██║██║ ██║██║ ██║██║ ██║██╔══██╗ ╚██╔╝ ██╔══╝ ╚═╝".colorize(:red)
|
161
|
+
puts " ╚██████╔╝╚██████╔╝╚██████╔╝██████╔╝██████╔╝ ██║ ███████╗██╗".colorize(:red)
|
162
|
+
puts " ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ".colorize(:red)
|
163
|
+
puts " ███████████████████████████████████████████████████████████████".colorize(:red)
|
164
|
+
puts ""
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class StellingBanjos::Scraper
|
2
|
+
|
3
|
+
@@all = []
|
4
|
+
|
5
|
+
def self.scrape_catelog_page(link)
|
6
|
+
catelog = Nokogiri::HTML(open(link))
|
7
|
+
catelog.css("div.ProductItem").each do |banjo|
|
8
|
+
name = banjo.css("h2").text.strip
|
9
|
+
if banjo.css("span").text.strip.include?("Sold out")
|
10
|
+
sold_out = "Yes"
|
11
|
+
|
12
|
+
#This removes "Sold out" from the end of each price
|
13
|
+
price = "$" + banjo.css("span").text.strip.split("$").pop.to_s
|
14
|
+
else
|
15
|
+
sold_out = "No"
|
16
|
+
price = banjo.css("span").text.strip
|
17
|
+
end
|
18
|
+
link = "https://www.elderly.com" + banjo.css("a").map{|link| link['href']}[0]
|
19
|
+
@@all << {name: name, price: price, link: link, sold_out: sold_out}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.scrape_info_page(link)
|
24
|
+
info = Nokogiri::HTML(open(link))
|
25
|
+
info.css("div.ProductMeta__Description.Rte").text.strip.split("More").shift.to_s.strip
|
26
|
+
#This was the only way I found to remove the "More Details..." at the end of each description
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.all
|
30
|
+
@@all
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "stelling_banjos/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "stelling_banjos"
|
8
|
+
spec.version = StellingBanjos::VERSION
|
9
|
+
spec.authors = ["'Riley Slayden'"]
|
10
|
+
spec.email = ["'slaydenriley@gmail.com'"]
|
11
|
+
|
12
|
+
spec.summary = %q{This gem displays banjos for sale on elderly.com and provides the user with additional information.}
|
13
|
+
spec.homepage = "https://github.com/slaydenriley/stelling_banjos"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_dependency "nokogiri"
|
32
|
+
spec.add_development_dependency "pry"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stelling_banjos
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "'Riley Slayden'"
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- "'slaydenriley@gmail.com'"
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- CODE_OF_CONDUCT.md
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- banjo_deals-0.1.0.gem
|
84
|
+
- bin/banjo
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/environment.rb
|
88
|
+
- lib/stelling_banjos/banjos.rb
|
89
|
+
- lib/stelling_banjos/cli.rb
|
90
|
+
- lib/stelling_banjos/scraper.rb
|
91
|
+
- lib/stelling_banjos/version.rb
|
92
|
+
- stelling_banjos.gemspec
|
93
|
+
homepage: https://github.com/slaydenriley/stelling_banjos
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata:
|
97
|
+
homepage_uri: https://github.com/slaydenriley/stelling_banjos
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubygems_version: 3.0.3
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: This gem displays banjos for sale on elderly.com and provides the user with
|
117
|
+
additional information.
|
118
|
+
test_files: []
|