popcorn_love 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 91f277d518ba497cd6ffb12cad1effa008c6d5cdee08daad89d7b6029ebbd17b
4
+ data.tar.gz: 1d8a5b1a0ede9d4eab24fdf0fcf80405014d8d2382c8fa9c340effd1904a00a1
5
+ SHA512:
6
+ metadata.gz: 333fe57f1cb84d7ba95722545bb1eb623c90fbee320e785f2e4d20482706af96c895c250fcac37f648eae5cd10b2ed2713a158f665eaf459cbee5ae4bd12f1fc
7
+ data.tar.gz: db8b85248106da4469bceff7cc75987873a86b458ecb0100cdfde9f4af59c22d216db4ee83e982c484db46fde6ee9cb80c155ba28fb4551b4cbffd476a9388ea
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -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 'christlife4u@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,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in popcorn.gemspec
4
+ gemspec
5
+ gem 'nokogiri'
6
+ gem 'pry'
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ popcorn (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ method_source (0.9.2)
11
+ mini_portile2 (2.4.0)
12
+ nokogiri (1.10.4)
13
+ mini_portile2 (~> 2.4.0)
14
+ pry (0.12.2)
15
+ coderay (~> 1.1.0)
16
+ method_source (~> 0.9.0)
17
+ rake (10.5.0)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ bundler (~> 2.0)
24
+ nokogiri
25
+ popcorn!
26
+ pry
27
+ rake (~> 10.0)
28
+
29
+ BUNDLED WITH
30
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 'Shamel Lakin'
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,42 @@
1
+ HELLO WORLD
2
+ # Popcorn_love - Ruby
3
+
4
+ Welcome to Popcorn_love your new ruby gem! This gem enables you to list the top ten box office movies along with their weekend revenue and their overall gross. Popcorn_love also gives you a brief synopsis of the movie so the user can figure which movie is the right one.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'popcorn'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install popcorn
21
+
22
+ ## Usage
23
+
24
+ Use this gem to get you started on the top ten box office titles and more...
25
+
26
+ ## Development
27
+
28
+ 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.
29
+
30
+ 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).
31
+
32
+ ## Contributing
33
+
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/'shamel'/popcorn. 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.
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
39
+
40
+ ## Code of Conduct
41
+
42
+ Everyone interacting in the Popcorn project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/'shamel'/popcorn_love/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "popcorn"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
15
+
16
+
17
+
data/bin/popcorn ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require './config/environment.rb'
4
+
5
+ Popcorn::CLI.new.call
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
@@ -0,0 +1,12 @@
1
+ # Libraries
2
+
3
+ require 'nokogiri'
4
+ require 'open-uri'
5
+ require 'pry'
6
+
7
+ # Main environment files
8
+
9
+ require './lib/popcorn/version.rb'
10
+ require './lib/popcorn/scraper.rb'
11
+ require './lib/popcorn/user.rb'
12
+ require './lib/popcorn/cli.rb'
data/lib/popcorn.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "popcorn/version"
2
+
3
+ module Popcorn
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,56 @@
1
+ class Popcorn::CLI
2
+
3
+ def call
4
+ welcome
5
+ show_top_ten
6
+ get_stats
7
+ end
8
+
9
+ def welcome
10
+ print "Welcome to Popcorn, Where we give you the top ten box office movies and more,
11
+ May I have your name please: "
12
+ @name = Popcorn::User.new.name
13
+ puts
14
+ puts "Hi, #{@name}. Here's a list of the current top 10 box office movies"
15
+ puts
16
+ end
17
+
18
+ def show_top_ten
19
+ Popcorn::Scraper.get_topbox_titles.each.with_index(1) do |title, index|
20
+ puts "#{index}. #{title}"
21
+ end
22
+ puts
23
+ end
24
+
25
+
26
+ def get_stats
27
+
28
+ while true
29
+ puts "\nEnter the number of the movie you wish to find the stats on or type exit: "
30
+ choice = Popcorn::User.get_user_choice
31
+
32
+ if choice == "exit"
33
+ goodbye
34
+ else
35
+ choice = choice.to_i
36
+ puts "\n\nOk! #{Popcorn::Scraper.get_topbox_titles[choice]}'s weekend gross revenue is #{Popcorn::Scraper.get_topbox_weekend[choice]} and it's overall gross revenue is #{Popcorn::Scraper.get_topbox_gross[choice]}. It's been in Top Box Office Status for #{Popcorn::Scraper.get_topbox_weeks[choice]} week/s.\n\nSynopsis >\n====================\n\n#{Popcorn::Scraper.get_movie_synopsis[choice]}"
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+ def goodbye
43
+ puts "\nSee you next time #{@name}, Enjoy the show!"
44
+ exit!
45
+ end
46
+ end
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
@@ -0,0 +1,61 @@
1
+ class Popcorn::Scraper
2
+
3
+ @@url = "https://www.imdb.com/chart/boxoffice?ref_=nv_ch_cht"
4
+ @@doc = Nokogiri::HTML(open(@@url))
5
+
6
+ @@titles = []
7
+ @@weekend = []
8
+ @@gross = []
9
+ @@weeks = []
10
+ @@info =[]
11
+
12
+ def self.get_topbox_titles
13
+ @@doc.css('tbody tr td.titleColumn a').each do |title|
14
+ @@titles << title.text
15
+ end
16
+ @@titles
17
+ end
18
+
19
+ def self.get_topbox_weekend
20
+ @@doc.css("tbody tr td.ratingColumn").each do |w_rev|
21
+ if !(w_rev.css("span").attribute("class"))
22
+ @@weekend << w_rev.text.strip
23
+ end
24
+ end
25
+ @@weekend
26
+ end
27
+
28
+ def self.get_topbox_gross
29
+ @@doc.css("tbody tr td.ratingColumn").each do |w_rev|
30
+ if w_rev.css("span").attribute("class")
31
+ @@gross << w_rev.text.strip
32
+ end
33
+ end
34
+ @@gross
35
+ end
36
+
37
+
38
+ def self.get_topbox_weeks
39
+ @@doc.css("tbody tr td.weeksColumn").each do |week|
40
+ @@weeks << week.text.to_i
41
+ end
42
+ @@weeks
43
+ end
44
+
45
+ def self.get_movie_synopsis
46
+ ids = []
47
+ @@doc.css("tbody td.titleColumn a").each do |title|
48
+ ids << title.attribute('href').value
49
+ end
50
+ ids.each do |id|
51
+ @@info << Nokogiri::HTML(open("https://www.imdb.com#{id}")).css("div.summary_text").text.strip
52
+ end
53
+ @@info
54
+ end
55
+
56
+
57
+ end
58
+
59
+
60
+
61
+
@@ -0,0 +1,20 @@
1
+ class Popcorn::User
2
+
3
+ attr_reader :name
4
+
5
+ def initialize
6
+ @name = gets.chomp.to_s
7
+ @name = @name[0].upcase + @name[1..-1].downcase
8
+ end
9
+
10
+ def self.get_user_choice
11
+ user_choice = gets.chomp
12
+ user_choice
13
+ end
14
+
15
+ def more_info?
16
+ #ask the user to enter another number for more info or press exit to leave
17
+ #Say goodbye
18
+ #make sure thaey do not type in gibba jabba
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module Popcorn
2
+ VERSION = "0.1.0"
3
+ end
data/popcorn.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "popcorn/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "popcorn_love"
7
+ spec.version = Popcorn::VERSION
8
+ spec.authors = ["'Shamel Lakin'"]
9
+ spec.email = ["'christlife4u@gmail.com'"]
10
+
11
+ spec.summary = %q{"Tracking top box office movies"}
12
+ spec.description = %q{"Tracking top box office movies internationally"}
13
+ spec.homepage = "https://github.com/ShamelLakin/popcorn"
14
+ spec.license = "MIT"
15
+
16
+
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 2.0"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: popcorn_love
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - "'Shamel Lakin'"
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-10-31 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
+ description: '"Tracking top box office movies internationally"'
42
+ email:
43
+ - "'christlife4u@gmail.com'"
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - CODE_OF_CONDUCT.md
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - bin/console
56
+ - bin/popcorn
57
+ - bin/setup
58
+ - config/environment.rb
59
+ - lib/popcorn.rb
60
+ - lib/popcorn/cli.rb
61
+ - lib/popcorn/scraper.rb
62
+ - lib/popcorn/user.rb
63
+ - lib/popcorn/version.rb
64
+ - popcorn.gemspec
65
+ homepage: https://github.com/ShamelLakin/popcorn
66
+ licenses:
67
+ - MIT
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubygems_version: 3.0.3
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: '"Tracking top box office movies"'
88
+ test_files: []