apt_finder 0.1.4 → 0.1.5
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/README.md +4 -2
- data/apt_finder-0.1.4.gem +0 -0
- data/lib/apt_finder/cli.rb +24 -22
- data/lib/apt_finder/listings.rb +1 -1
- data/lib/apt_finder/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cab558514168d8ca455378db6dbedcc975aa935
|
4
|
+
data.tar.gz: 836d301d2de286f0a4a09c3681f8de5fe768e6eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfafb4706fbcd70b7955382654af61ab8752e00da339b5e2717061a36541157fec6b4ed3afcc1f2cf8eecf060b273de39d663dc049419f442f409e9261919540
|
7
|
+
data.tar.gz: 7fe837200194e245429cbad7cf613c1023503ff2480d631bf363d3052f14f578eef117849ad7da998b293b400d5dc85078e95bd42a797750221ca3605360592e
|
data/README.md
CHANGED
@@ -20,7 +20,9 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
After installing the gem
|
24
|
+
|
25
|
+
$ apt_finder
|
24
26
|
|
25
27
|
## Development
|
26
28
|
|
@@ -30,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
30
32
|
|
31
33
|
## Contributing
|
32
34
|
|
33
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/yeungn/apt-finder-cli-gem. 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
36
|
|
35
37
|
|
36
38
|
## License
|
Binary file
|
data/lib/apt_finder/cli.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
class AptFinder::CLI
|
2
2
|
def call
|
3
3
|
puts "Welcome to Apt Finder"
|
4
|
-
|
5
4
|
listings
|
6
5
|
menu
|
7
6
|
end
|
@@ -29,31 +28,34 @@ class AptFinder::CLI
|
|
29
28
|
puts "-----------------------------------------------"
|
30
29
|
puts doc.css('section.description').text.strip.gsub(/\n|\r/, '').gsub(/\s+/, ' ')
|
31
30
|
puts ""
|
32
|
-
puts "Enter the number of
|
31
|
+
puts "Enter the number of bedroom(s) that you would like more info on:"
|
32
|
+
puts "0 = studio | 1 = one bedrooom | 2 = two bedroom"
|
33
33
|
bedrooms = gets.strip
|
34
34
|
|
35
|
-
if bedrooms
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
puts doc.css('div.available-now')[0].text.strip
|
43
|
-
else
|
44
|
-
puts "not available"
|
45
|
-
end
|
35
|
+
if bedrooms == "0"
|
36
|
+
doc.css('div.name')[0] != nil
|
37
|
+
# doc.css('div.name')[0].text.downcase.strip.include?("studio")
|
38
|
+
puts doc.css('div.name')[0].text.strip
|
39
|
+
# puts doc.css('#lease-terms .length')[0].text.strip
|
40
|
+
puts doc.css('div.rent')[0].text.strip
|
41
|
+
puts doc.css('div.available-now')[0].text.strip
|
46
42
|
elsif bedrooms == "1"
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
43
|
+
doc.css('div.name')[4] != nil
|
44
|
+
# doc.css('div.name')[4].text.downcase.strip.include?("1 bedroom")
|
45
|
+
puts doc.css('div.name')[4].text.strip
|
46
|
+
# puts doc.css('#lease-terms .length').text.strip
|
47
|
+
puts doc.css('div.rent')[4].text.strip
|
48
|
+
puts doc.css('div.available-now')[4].text.strip
|
49
|
+
elsif bedrooms == "2"
|
50
|
+
doc.css('div.name')[9] != nil
|
51
|
+
# doc.css('div.name')[9].text.downcase.strip.include?("studio")
|
52
|
+
puts doc.css('div.name')[9].text.strip
|
53
|
+
# puts doc.css('#lease-terms .length')[9].text.strip
|
54
|
+
puts doc.css('div.rent')[9].text.strip
|
55
|
+
puts doc.css('div.available-now')[9].text.strip
|
56
|
+
else
|
57
|
+
puts "not available"
|
55
58
|
end
|
56
|
-
|
57
59
|
elsif input == "list"
|
58
60
|
listings
|
59
61
|
elsif input == "exit"
|
data/lib/apt_finder/listings.rb
CHANGED
@@ -5,7 +5,7 @@ class AptFinder::Listings
|
|
5
5
|
def self.listings
|
6
6
|
doc = Nokogiri::HTML(open("http://www.apartmentfinder.com/New-York/New-York-Apartments"))
|
7
7
|
|
8
|
-
doc.css('div.listingContent')[0..
|
8
|
+
doc.css('div.listingContent')[0..9].each_with_index do |list, index|
|
9
9
|
title = list.css('div.listingTitle').text.strip
|
10
10
|
price = list.css('span.altRentDisplay').text.strip
|
11
11
|
link = list.css('div.listingTitle a').attr('href').value
|
data/lib/apt_finder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apt_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yeungn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- LICENSE.txt
|
97
97
|
- README.md
|
98
98
|
- Rakefile
|
99
|
+
- apt_finder-0.1.4.gem
|
99
100
|
- apt_finder.gemspec
|
100
101
|
- bin/apt_finder
|
101
102
|
- bin/console
|