ruboty-app_annie 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2daa7fa7ba02eb8335af311550c43be49b5c9128
4
- data.tar.gz: 68f228c318192549238d1ff474de97c35e3d8b61
3
+ metadata.gz: ee0059031d52310c5caae6a58974e8a51fe1cb88
4
+ data.tar.gz: 8c463be5260746121c34f6028c9185516fb023aa
5
5
  SHA512:
6
- metadata.gz: 165fa35dae9bdec63b1a4fff49557142bc639ce71bf7b29446ea90933dda69cdb5a76ab9ec450de4579b49b5c6bd8fcb2c5aff386fc69b133aaa818dee73a790
7
- data.tar.gz: 2f50bac27a910dacbf6b69de777ac34e78d1654365899394fedad759cf9bfdc8460735e991c8a9602cba31a119493944e4fc071fa1b7967329da90f4f5d02c9b
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
- @reviews ||= client.product_reviews(market, given_product_id, given_start_date, given_end_date, given_country).body.reviews.map do |review|
35
- "#{market_string(market)} #{product.product_name} #{version_string(review)}\n" + "> #{rating_string(review)}#{title_string(review)}\n" + "> ```#{review.text}```"
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 product
40
- @product ||= client.product_details(market, given_product_id).body.product
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
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module AppAnnie
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -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'’'s reviews of days ago",
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.8
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-24 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty