ruboty-app_annie 0.0.8 → 0.0.9
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/lib/ruboty/app_annie/actions/list_reviews.rb +23 -4
- data/lib/ruboty/app_annie/version.rb +1 -1
- data/lib/ruboty/handlers/app_annie.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee0059031d52310c5caae6a58974e8a51fe1cb88
|
4
|
+
data.tar.gz: 8c463be5260746121c34f6028c9185516fb023aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfc623933264efd0ecf80ecbe57863b56424ae9d2682877599278a46139007c1f0a0b10dbebf377006900deaf010967555a2f32a38601212e2f745d2911899e8
|
7
|
+
data.tar.gz: fe528cb137f66a9cfdd3a0342d81f89628dc4e8df08b6e882acfd4572a7adb7266027e693825e1573256232b2fcb4ab331be8a8ae8e56320c6f4af1103a4bf29
|
@@ -31,13 +31,30 @@ module Ruboty
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def reviews
|
34
|
-
|
35
|
-
|
34
|
+
reply_reviews = []
|
35
|
+
if given_product_id.nil?
|
36
|
+
client.products(account.account_id).body.products.select{ |p| p.status }.map do |p|
|
37
|
+
reply_reviews << product_reviews(p.product_id, p.product_name)
|
38
|
+
end
|
39
|
+
else
|
40
|
+
product = product(given_product_id)
|
41
|
+
reply_reviews = product_reviews(product.product_id, product.product_name)
|
42
|
+
end
|
43
|
+
reply_reviews
|
44
|
+
end
|
45
|
+
|
46
|
+
def product_reviews(product_id, product_name)
|
47
|
+
client.product_reviews(market, product_id, given_start_date, given_end_date, given_country).body.reviews.map do |review|
|
48
|
+
"#{market_string(market)} #{product_name} #{version_string(review)}\n" + "> #{rating_string(review)}#{title_string(review)}\n" + "> ```#{review.text}```"
|
36
49
|
end
|
37
50
|
end
|
38
51
|
|
39
|
-
def
|
40
|
-
|
52
|
+
def account
|
53
|
+
client.accounts.body.accounts.select { |a| a.market == market }.first
|
54
|
+
end
|
55
|
+
|
56
|
+
def product(product_id)
|
57
|
+
client.product_details(market, product_id).body.product
|
41
58
|
end
|
42
59
|
|
43
60
|
def market_string(market)
|
@@ -88,6 +105,8 @@ module Ruboty
|
|
88
105
|
|
89
106
|
def given_product_id
|
90
107
|
message[:product_id]
|
108
|
+
rescue IndexError
|
109
|
+
nil
|
91
110
|
end
|
92
111
|
|
93
112
|
def given_start_date
|
@@ -24,7 +24,13 @@ module Ruboty
|
|
24
24
|
on(
|
25
25
|
/annie list (?<market>(?:ios|android)) reviews of (?<product_id>.+) days ago (?<days_ago>.+) in (?<country>.+)\z/,
|
26
26
|
name: "list_reviews_of_days_ago",
|
27
|
-
description: "Retrieve one product'
|
27
|
+
description: "Retrieve one product's reviews of days ago",
|
28
|
+
)
|
29
|
+
|
30
|
+
on(
|
31
|
+
/annie list (?<market>(?:ios|android)) all reviews days ago (?<days_ago>.+) in (?<country>.+)\z/,
|
32
|
+
name: "list_all_reviews_of_days_ago",
|
33
|
+
description: "Retrieve all product's reviews of days ago",
|
28
34
|
)
|
29
35
|
|
30
36
|
def list_accounts(message)
|
@@ -42,6 +48,10 @@ module Ruboty
|
|
42
48
|
def list_reviews_of_days_ago(message)
|
43
49
|
Ruboty::AppAnnie::Actions::ListReviews.new(message).call
|
44
50
|
end
|
51
|
+
|
52
|
+
def list_all_reviews_of_days_ago(message)
|
53
|
+
Ruboty::AppAnnie::Actions::ListReviews.new(message).call
|
54
|
+
end
|
45
55
|
end
|
46
56
|
end
|
47
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-app_annie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fakestarbaby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|