daily_properties 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c1fa89cd356c98fad275eb087ecef43d0b942d2
4
- data.tar.gz: 426edcd72a65cb1e261a93255c6c710e12531819
3
+ metadata.gz: 5719d30858ce132c47deb4492eb5da903a2f22e8
4
+ data.tar.gz: 1d0a5becf00aa1bca03bafec8821a5a5dac44794
5
5
  SHA512:
6
- metadata.gz: d0582d6ebbd7dac099645d374a9c0f1c52f1d869d32459f768857ed775a68e2061bafa97b74e7e7d287b7ad0551527f42ac857542c7f94d6b01d3562ab5082d3
7
- data.tar.gz: 68422c2646b73569cf604ee198f91e342a9d1d6170e0cebdd9b2a7319d3166aed3868d4100b2179633e8ebedff4c6aeb50624caf4c3328624f6d38a188c24dd0
6
+ metadata.gz: a1364c54427f3cc58a31a7fe509dad2cc6af83dfb2ee291aba1d9503f2ebcb4f474caeccd636ea33eb0fdd5dbf0d60edbc83a1b5c760567a3f48a79447552d3e
7
+ data.tar.gz: 0e822f0ee8b3d5265ad2e38e1b8578c83f28f78184b2471e9a2af283e9eba0c0aa56b4c022fa6a92697277af65b5990f4d96b50bbc88d4d1c470f2bdf2923002
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.14.6
@@ -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 zhang.jingru.93@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
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ # Specify your gem's dependencies in daily_properties.gemspec
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 JingruZhang
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/NOTE.md ADDED
@@ -0,0 +1,33 @@
1
+ Imagine the interface
2
+ Start with project structure
3
+ Start with the entry point
4
+ Discover objects
5
+ Program
6
+
7
+ bundle gem daily_properties
8
+
9
+ command line interface for new properties sold in the neighborhood (& later maybe new houses listed in the neighborhood, too) zillow
10
+
11
+ with users typing in zip code, it shows a list of properties recently sold within the zipcode (a list of 20)
12
+
13
+ (Build from where the user is going to interact with the program!)
14
+ CLI interface:
15
+ User type in: daily_properties
16
+ 60618
17
+ A list of 26 properties
18
+ 3904 N Seeley Ave, Chicago, IL, $1.93M, sold 04/05/2017, 6 bds, 6 ba
19
+ 2631 W Belmont Ave UNIT 4, Chicago, IL, $312,000, sold 04/04/2017, 2bds, 2ba
20
+
21
+ Which one would you like to learn more about? (1-26)
22
+ Goodbye!
23
+
24
+ Step zero: basic interface and fake data(completed)
25
+ Step one: scrape zillow with a static zipcode--60618(completed)
26
+ Step two: scrape zillow with a zipcode given by user
27
+
28
+ What is a property?
29
+ A property has an address
30
+ A property has a price
31
+ A property has a sold date
32
+ A property has a URL
33
+
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # DailyProperties
2
+
3
+ Put in the zipcode you would like to look up the most recently sold properties within that zipcode area, the gem will return you a list of the most recently sold properties with addresses, sold dates, sold prices, and urls to photos and other specs on zillow.com. Follow the menu prompts and have fun!
4
+
5
+ ## Installation
6
+
7
+ Install it yourself as:
8
+
9
+ $ gem install daily_properties
10
+
11
+ ## Usage
12
+
13
+ After installing the gem, run command `daily-properties` to start. Please follow the prompts for instruction.
14
+
15
+ Here is a link to a walkthough video that I made. (https://youtu.be/npKP1ylzQA0)
16
+
17
+ ## Development
18
+
19
+ 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.
20
+
21
+ 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).
22
+
23
+ ## Contributing
24
+
25
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/daily_properties. 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.
26
+
27
+
28
+ ## License
29
+
30
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
31
+
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ #require "bundler/gem_tasks"
2
+ #require "rspec/core/rake_task"
3
+
4
+ #RSpec::Core::RakeTask.new(:spec)
5
+
6
+ #task :default => :spec
7
+
8
+ require_relative './config/environment'
9
+
10
+ def reload!
11
+ load './lib/daily_properties/scraper.rb'
12
+ end
13
+
14
+ desc "A console"
15
+ task :console do
16
+ Pry.start
17
+ end
data/bin/console ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "irb"
4
+ IRB.start(__FILE__)
data/bin/daily-properties CHANGED
@@ -1,6 +1,8 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
4
  require "daily_properties"
5
5
 
6
- DailyProperties::CLI.new.call
6
+ DailyProperties::CLI.new.welcome
7
+
8
+
data/bin/setup ADDED
@@ -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
@@ -1,6 +1,7 @@
1
1
  require "nokogiri"
2
2
  require 'open-uri'
3
3
  require 'bundler'
4
+ require 'pry'
4
5
  Bundler.require
5
6
 
6
7
  require_relative "../lib/daily_properties/version"
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'daily_properties/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "daily_properties"
8
+ spec.version = DailyProperties::VERSION
9
+ spec.authors = ["Jingru Zhang"]
10
+ spec.email = ["zhang.jingru.93@gmail.com"]
11
+
12
+ spec.summary = %q{A CLI gem that displays a list of properties that were recently sold within a zipcode area, scrapped from zillow.com}
13
+ spec.description = %q{This CLI gem helps home buyers and sellers to view the most recently sold properties within a given zipcode. Use 'daily-properties' command to run. It asks users for a zipcode input, and gives users a list of the most recently sold properties in the area. Users can type respective property number to get the url to view more details of the property.}
14
+ spec.homepage = "https://github.com/jingruzhang/cli_daily_properties"
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'] = "TODO: Set to 'http://mygemserver.com'"
21
+ #else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ #end
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.require_paths = ['lib']
27
+ spec.executables = ['daily-properties']
28
+
29
+ spec.post_install_message = "Thanks for installing! Happy researching."
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.14"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+ spec.add_dependency "nokogiri", "~> 1.7"
35
+ spec.add_development_dependency 'pry'
36
+ end
data/lib/.DS_Store ADDED
Binary file
@@ -1,8 +1,14 @@
1
1
  # CLI Controller
2
2
 
3
3
  class DailyProperties::CLI
4
+
5
+ def welcome
6
+ print "Welcome! "
7
+ call
8
+ end
9
+
4
10
  def call
5
- puts "Welcome! Please enter the zipcode, and I will list the 26 most recently sold properties in that area:"
11
+ puts "Please enter the zipcode, and I will list the most recently sold properties in that area for you: "
6
12
  zipcode = gets.strip.to_i
7
13
  list_properties(zipcode)
8
14
  menu
@@ -10,9 +16,9 @@ class DailyProperties::CLI
10
16
 
11
17
  def list_properties(zipcode)
12
18
  DailyProperties::Scraper.make_properties(zipcode)
13
- @properties = DailyProperties::Property.property
19
+ @properties = DailyProperties::Property.properties
14
20
  @properties.each.with_index(1) do |property, i|
15
- puts "#{i}. #{property.address}, #{property.sold_date} at #{property.price}"
21
+ puts "#{i}. #{property.address}, #{property.sold_date}, #{property.price}"
16
22
  end
17
23
  puts "--------------------------------------------------"
18
24
  end
@@ -20,23 +26,27 @@ class DailyProperties::CLI
20
26
  def menu
21
27
  input = nil
22
28
  while input != "exit"
23
- puts "Enter the number of the property that you'd like to know more about, or enter another to look up another zipcode, or enter list to see the list, or enter exit: "
29
+ puts "Enter the number of the property that you'd like to know more about, or enter 'price' to view the list sorted by sold price (high-->low), or enter 'another' to look up another zipcode, or enter 'exit': "
24
30
  input = gets.strip.downcase
25
- if input.to_i > 0 && input.to_i < 27
26
- the_property = @properties[input.to_i - 1]
27
- puts "#{the_property.address}, #{the_property.sold_date} at #{the_property.price}"
28
- puts "See more at #{the_property.url}"
29
- elsif input == "another"
31
+ if input == "another"
30
32
  DailyProperties::Property.clear_all
31
33
  puts "--------------------------------------------------"
32
34
  call
33
- elsif input == "list"
34
- list_properties
35
+ elsif input == "price"
36
+ DailyProperties::Property.sort_by_price
37
+ @properties = DailyProperties::Property.properties
38
+ @properties.each.with_index(1) do |property, i|
39
+ puts "#{i}. #{property.address}, #{property.sold_date}, #{property.price}"
40
+ end
41
+ puts "--------------------------------------------------"
35
42
  elsif input == "exit"
36
43
  goodbye
37
44
  exit
45
+ elsif the_property = DailyProperties::Property.find(input.to_i - 1)
46
+ puts "#{the_property.address}, #{the_property.sold_date}, #{the_property.price}"
47
+ puts "See more at #{the_property.url}"
38
48
  else
39
- puts "Not sure what you just enter. Type list or exit. "
49
+ puts "Not sure what you just enter."
40
50
  puts "--------------------------------------------------"
41
51
  end
42
52
  end
@@ -19,7 +19,7 @@ class DailyProperties::Property
19
19
  )
20
20
  end
21
21
 
22
- def self.property
22
+ def self.properties
23
23
  @@all
24
24
  end
25
25
 
@@ -27,5 +27,21 @@ class DailyProperties::Property
27
27
  @@all.clear
28
28
  end
29
29
 
30
+ def self.find(index)
31
+ index < 0 ? nil : @@all[index]
32
+ end
33
+
34
+ def convert_price_to_int
35
+ if price.include?("M")
36
+ (price.split("$")[1].gsub("M", "").to_f*1000000).to_i
37
+ else
38
+ price.split("$")[1].gsub(",", "").to_i
39
+ end
40
+ end
41
+
42
+ def self.sort_by_price
43
+ @@all.sort! {|a, b| b.convert_price_to_int <=> a.convert_price_to_int}
44
+ end
45
+
30
46
  end
31
47
 
@@ -0,0 +1,3 @@
1
+ module DailyProperties
2
+ VERSION = "0.1.5"
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daily_properties
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jingru Zhang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-10 00:00:00.000000000 Z
11
+ date: 2018-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,7 +66,25 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.7'
69
- description:
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: This CLI gem helps home buyers and sellers to view the most recently
84
+ sold properties within a given zipcode. Use 'daily-properties' command to run. It
85
+ asks users for a zipcode input, and gives users a list of the most recently sold
86
+ properties in the area. Users can type respective property number to get the url
87
+ to view more details of the property.
70
88
  email:
71
89
  - zhang.jingru.93@gmail.com
72
90
  executables:
@@ -74,17 +92,31 @@ executables:
74
92
  extensions: []
75
93
  extra_rdoc_files: []
76
94
  files:
95
+ - ".gitignore"
96
+ - ".rspec"
97
+ - ".travis.yml"
98
+ - CODE_OF_CONDUCT.md
99
+ - Gemfile
100
+ - LICENSE.txt
101
+ - NOTE.md
102
+ - README.md
103
+ - Rakefile
104
+ - bin/console
77
105
  - bin/daily-properties
106
+ - bin/setup
78
107
  - config/environment.rb
108
+ - daily_properties.gemspec
109
+ - lib/.DS_Store
79
110
  - lib/daily_properties.rb
80
111
  - lib/daily_properties/cli.rb
81
112
  - lib/daily_properties/property.rb
82
113
  - lib/daily_properties/scraper.rb
83
- homepage: https://github.com/jingruzhang/cli_daily_properties.git
114
+ - lib/daily_properties/version.rb
115
+ homepage: https://github.com/jingruzhang/cli_daily_properties
84
116
  licenses:
85
117
  - MIT
86
118
  metadata: {}
87
- post_install_message:
119
+ post_install_message: Thanks for installing! Happy researching.
88
120
  rdoc_options: []
89
121
  require_paths:
90
122
  - lib
@@ -103,6 +135,6 @@ rubyforge_project:
103
135
  rubygems_version: 2.6.11
104
136
  signing_key:
105
137
  specification_version: 4
106
- summary: It displays a list of 26 properties recently sold within a zipcode area,
107
- scrapped from zillow.com
138
+ summary: A CLI gem that displays a list of properties that were recently sold within
139
+ a zipcode area, scrapped from zillow.com
108
140
  test_files: []