daily-trending-apps 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9106d5eb7ef6b183b5e3d760bc8c43138f82139ee73a24586014ba94e937adbf
4
+ data.tar.gz: 4bb0e04f3b1e46b5c62df59114148c9681c3953a99c174351e7d4ada74bfc3cf
5
+ SHA512:
6
+ metadata.gz: 6a61534ea0047c577383af08aa596351ace83fbf30d162da2c564285bcb77e1c1da13aa41bcc39a1f8dfbfe89af0d39147a71667c1b5f70454f56ff0268b42d6
7
+ data.tar.gz: 51d46be1d5c670efc808cdfc511f1537a4e20bf8998d256b4a0a710fbac92bf59ba2b05049d7a174b4fe2d1012c3c8c434f06730603d590f02f1f0430790121a
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require './lib/daily_trending'
4
+
5
+
6
+
7
+ DailyTrending::Cli.new.call
@@ -0,0 +1,9 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+ require 'pry'
4
+ require 'colorize'
5
+ require 'colorized_string'
6
+
7
+ require_relative './daily_trending/version'
8
+ require_relative './daily_trending/app'
9
+ require_relative './daily_trending/cli'
@@ -0,0 +1,50 @@
1
+ class DailyTrending::App
2
+ attr_accessor :title, :dev,:app_url, :dev_url, :rating, :price, :genre, :con_rating, :rate_cnt, :description
3
+ @@all = []
4
+
5
+
6
+ def self.scrape_play_store
7
+ doc = Nokogiri::HTML(open("https://play.google.com/store/apps/collection/promotion_3000792_new_releases_apps?clp=SpEBCikKI3Byb21vdGlvbl8zMDAwNzkyX25ld19yZWxlYXNlc19hcHBzEAcYAxpkCl5uZXdfaG9tZV9kZXZpY2VfZmVhdHVyZWRfcmVjczJfdG9waWNfdjFfbGF1bmNoX2FwcHNfVVNfXzE1MTQ0NDgwMDAwMDBfNl9wcm9tb18xNTE0NDkxNzcwMTgwMDAwEAwYAw%3D%3D%3AS%3AANO1ljLrBj0&hl=en"))
8
+ doc.css('div.card-content.id-track-click.id-track-impression')
9
+ end
10
+
11
+
12
+ # Iterates #scrape_play_store method to # Makes the apps and assigns
13
+ # the attributes available on Google play store
14
+
15
+ def self.make_apps
16
+ scrape_play_store.each do |a|
17
+ app = self.new
18
+ app.title = a.css('a.title').attribute('title').value
19
+ app.dev = a.css('a.subtitle').attribute('title').value
20
+ app.dev_url = ("https://play.google.com" + a.css('a.subtitle').attribute('href').value)
21
+ app.app_url = ("https://play.google.com" + a.css('a.title').attribute('href').value)
22
+ app.rating = a.css('div.tiny-star').attribute('aria-label').value.strip.slice(/\d.\S/)<<"/5 Stars"
23
+ app.price = a.at_css('span.display-price').text
24
+ app.save
25
+ end
26
+ all
27
+ end
28
+
29
+ def save
30
+ @@all << self
31
+ end
32
+
33
+ def self.all
34
+ @@all
35
+ end
36
+
37
+
38
+ def scrape_app(url)
39
+ Nokogiri::HTML(open(url))
40
+ end
41
+
42
+
43
+ def make_app(url)
44
+ page = scrape_app(url)
45
+ self.genre = page.css('a.document-subtitle.category').text
46
+ self.con_rating = page.css('span.document-subtitle.content-rating-title').text
47
+ self.rate_cnt = page.css('span.rating-count').text
48
+ self.description = page.css('div.show-more-content.text-body').text
49
+ end
50
+ end
@@ -0,0 +1,67 @@
1
+ class DailyTrending::Cli
2
+
3
+ def call
4
+ list_apps
5
+ menu
6
+ goodbye
7
+ end
8
+
9
+ def list_apps
10
+ s = "******".colorize(:blue)
11
+ puts ""
12
+ puts " #{s}"+"New And Updated Apps!"+s
13
+ puts ""
14
+
15
+ @apps = DailyTrending::App.make_apps
16
+ @apps.each.with_index(1) do |app, i|
17
+ puts <<-DOC
18
+ #{i} #{app.title.colorize(:blue)}
19
+ #{app.rating} Cost: #{app.price}
20
+
21
+ DOC
22
+ end
23
+ puts ""
24
+ end
25
+
26
+ def menu
27
+ input = nil
28
+ until input == 'exit'
29
+ puts "Enter the number of the app that interests you or type exit"
30
+ input = gets.strip.downcase
31
+
32
+ if input.to_i > 0
33
+ app_info(@apps[input.to_i-1])
34
+ elsif input == 'list'
35
+ list_apps
36
+ else
37
+ puts "#{input} not an option, type list or exit" unless input == 'exit'
38
+ end
39
+ end
40
+ end
41
+
42
+ def app_info(app)
43
+ app.make_app(app.app_url)
44
+ puts <<-DOC
45
+ #{app.title.upcase.colorize(:blue)}
46
+ Developers: #{app.dev}
47
+ Content For: #{app.con_rating}
48
+ Rated By: #{app.rate_cnt}
49
+
50
+ DOC
51
+ puts "DESCRIPTION:".colorize(:red)
52
+ puts <<-DOC
53
+
54
+ #{app.description}
55
+
56
+ Get App At: #{app.app_url.colorize(:red)}
57
+ More Apps By #{app.dev}: #{app.dev_url.colorize(:red)}
58
+
59
+ DOC
60
+ end
61
+
62
+
63
+ def goodbye
64
+ puts "See you next time!!"
65
+ end
66
+
67
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: daily-trending-apps
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - "'Chad Montoya'"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-03 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: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
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: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.11.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.11.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.8'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: colorize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.8.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.8.1
83
+ description: Displays new and updated apps from Google Play Store
84
+ email:
85
+ - "'chadmontoya21@yahoo.com'"
86
+ executables:
87
+ - daily-trending-apps
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - bin/daily-trending-apps
92
+ - lib/daily_trending.rb
93
+ - lib/daily_trending/app.rb
94
+ - lib/daily_trending/cli.rb
95
+ homepage: https://github.com/badlychadly/daily-trending-apps-cli-gem
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.7.3
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Shows info on new and updated apps
119
+ test_files: []