shopify_app_reviews 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +10 -2
- data/lib/shopify_app_reviews/app_review_scraper.rb +4 -1
- data/lib/shopify_app_reviews/cli.rb +18 -1
- data/lib/shopify_app_reviews/shopify_app.rb +31 -0
- data/lib/shopify_app_reviews/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcfcb07d32a35d2b9d38e20ba7b46afee69c3637
|
4
|
+
data.tar.gz: 46ebacd5c1b0107f793f673ade83e2a02bb2bbf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cc87de2a5def3d9159c659258eb2256378c8096eafeabfb8efec6222c5037e769e1dfa74039bbc5862a5b9f8d4f567c16d85ba310a6f64707af31ae3bf04ede
|
7
|
+
data.tar.gz: 63ffe378dde8ae42c592347b774f20c35b60dceb0bc0e7c97596e44738041f6b7f6b71bdc003fa9586e7f0660f1c85c17eb410c5b38cd14d80a147ac5026352d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -26,8 +26,16 @@ To start the CLI, navigate to the project root and run:
|
|
26
26
|
|
27
27
|
You'll be required to supply the program with a Shopify app name or app URL from the Shopify App Store.
|
28
28
|
|
29
|
-
If a Shopify App is found, you can access its latest 10 reviews using
|
30
|
-
|
29
|
+
If a Shopify App is found, you can access its latest 10 reviews using:
|
30
|
+
|
31
|
+
$ latest reviews
|
32
|
+
|
33
|
+
You can also access some basic sentiment analysis for each app, based on its overall rating as well as the combined ratings of the 10 latest reviews. Overall Sentiment and Trending Sentiment are available using:
|
34
|
+
|
35
|
+
$ overall sentiment
|
36
|
+
$ trending sentiment
|
37
|
+
|
38
|
+
Please note that trending sentiment will not be available as an sub-menu option until the 10 latest reviews have been collected for that app using `latest reviews`, as it depends on that data.
|
31
39
|
|
32
40
|
## Contributing
|
33
41
|
|
@@ -28,6 +28,9 @@ class AppReviewScraper
|
|
28
28
|
|
29
29
|
html2 = open(app.url)
|
30
30
|
index2 = Nokogiri::HTML(html2)
|
31
|
-
|
31
|
+
dev_contact = index2.css('li.app-support-list__item span').children.find do |li|
|
32
|
+
li.text.strip if li.text.include?("@")
|
33
|
+
end
|
34
|
+
app.developer_contact = dev_contact.text
|
32
35
|
end
|
33
36
|
end
|
@@ -43,6 +43,10 @@ class ShopifyAppReviews::CLI
|
|
43
43
|
def print_sub_instructions(requested_app)
|
44
44
|
puts "Use 'latest reviews' to see #{requested_app.name}'s 10 latest reviews.".colorize(:yellow)
|
45
45
|
puts "Use 'app details' to review #{requested_app.name}'s details.".colorize(:yellow)
|
46
|
+
puts "Use 'overall sentiment' to see how people feel about #{requested_app.name} in general.".colorize(:yellow)
|
47
|
+
unless requested_app.app_reviews.empty?
|
48
|
+
puts "Use 'trending sentiment' to see how people feel about #{requested_app.name} lately.".colorize(:yellow)
|
49
|
+
end
|
46
50
|
puts "Use 'new app' to return to the previous menu.".colorize(:yellow)
|
47
51
|
puts "You can use 'exit cli' to leave at any time.".colorize(:yellow)
|
48
52
|
print "What would you like to do? ".colorize(:green)
|
@@ -84,11 +88,23 @@ class ShopifyAppReviews::CLI
|
|
84
88
|
exit
|
85
89
|
end
|
86
90
|
app_details_table(requested_app) if sub_input == "app details"
|
91
|
+
overall_sentiment(requested_app) if sub_input == "overall sentiment"
|
92
|
+
trending_sentiment(requested_app) if sub_input == "trending sentiment" unless requested_app.app_reviews.empty?
|
87
93
|
end
|
88
94
|
end
|
89
95
|
end
|
90
96
|
end
|
91
97
|
|
98
|
+
def overall_sentiment(app)
|
99
|
+
hr
|
100
|
+
puts "The overall sentiment for".colorize(:green) + " #{app.name.colorize(:white)} " + "is ".colorize(:green) + "#{app.overall_sentiment}"
|
101
|
+
end
|
102
|
+
|
103
|
+
def trending_sentiment(app)
|
104
|
+
hr
|
105
|
+
puts "The trending sentiment for".colorize(:green) + " #{app.name.colorize(:white)} " + "is ".colorize(:green) + "#{app.trending_sentiment}"
|
106
|
+
end
|
107
|
+
|
92
108
|
def app_details_table(app)
|
93
109
|
add_metadata_to_app(app)
|
94
110
|
puts "Found ".colorize(:green) + "#{app.name.colorize(:white)}" + " in the ".colorize(:green) + "#{app.category.colorize(:white)}" + " category. ".colorize(:green)
|
@@ -97,7 +113,8 @@ class ShopifyAppReviews::CLI
|
|
97
113
|
puts "App URL: ".colorize(:green) + "#{app.url.colorize(:white)}"
|
98
114
|
puts "Developer: ".colorize(:green) + "#{app.developer_name.colorize(:white)}" + " (#{app.developer_url})".colorize(:green)
|
99
115
|
puts "Developer Contact: ".colorize(:green) + "#{app.developer_contact}".colorize(:white)
|
100
|
-
|
116
|
+
puts "The overall sentiment for".colorize(:green) + " #{app.name.colorize(:white)} " + "is ".colorize(:green) + "#{app.overall_sentiment}"
|
117
|
+
trending_sentiment(app) unless app.app_reviews.empty?
|
101
118
|
end
|
102
119
|
|
103
120
|
def display_app_reviews(app)
|
@@ -35,6 +35,37 @@ class ShopifyApp
|
|
35
35
|
app_reviews.count
|
36
36
|
end
|
37
37
|
|
38
|
+
def set_sentiment(rating_type)
|
39
|
+
sentiment = "Unknown"
|
40
|
+
if rating_type.is_a?(String)
|
41
|
+
rating = rating_type.split(" ").first
|
42
|
+
rating = rating.to_f
|
43
|
+
else
|
44
|
+
rating = rating_type
|
45
|
+
end
|
46
|
+
sentiment = "terrible (#{rating}/5)".colorize(:red) if rating.between?(0.00,0.999)
|
47
|
+
sentiment = "really bad (#{rating}/5)".colorize(:red) if rating.between?(1.00,1.999)
|
48
|
+
sentiment = "OK at best (#{rating}/5)".colorize(:yellow) if rating.between?(2.00,2.999)
|
49
|
+
sentiment = "good (#{rating}/5)".colorize(:yellow) if rating.between?(3.00,3.999)
|
50
|
+
sentiment = "great (#{rating}/5)".colorize(:cyan) if rating.between?(4.00,4.499)
|
51
|
+
sentiment = "excellent (#{rating}/5)".colorize(:cyan) if rating.between?(4.50,5.00)
|
52
|
+
sentiment
|
53
|
+
end
|
54
|
+
|
55
|
+
def overall_sentiment
|
56
|
+
set_sentiment(self.overall_rating)
|
57
|
+
end
|
58
|
+
|
59
|
+
def trending_sentiment
|
60
|
+
ratings_array = []
|
61
|
+
self.app_reviews.each do |review|
|
62
|
+
rating = review.rating.split(" ").first.to_f
|
63
|
+
ratings_array << rating
|
64
|
+
end
|
65
|
+
trending_rating = ratings_array.reduce(:+) / ratings_array.size
|
66
|
+
set_sentiment(trending_rating)
|
67
|
+
end
|
68
|
+
|
38
69
|
def self.create_from_collection(app_array)
|
39
70
|
app_array.each do |app_info|
|
40
71
|
self.create(app_info)
|