reddit_api 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reddit_api/posts.rb +13 -9
- data/lib/reddit_api/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: 30f62db75bf65628c6c5ce135d156ebaeec4abe4
|
4
|
+
data.tar.gz: 56dd6a2b5e8151bf1ef65eff1f415fcbbbd38a9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c8f5daeb6393de0a79a61b1a5fda8ef551d84409b170574e5443a3a1e3dcb327a6f5596f3cc94cc14cbe68360ed2bc0fbc7c16e3b56498243bc2cd0f69a0c36
|
7
|
+
data.tar.gz: 7e9dbb6c10bb2c2e0741c8b257806149ba11504d585ade72909f7f27c8cd889ece309722e7267cf9d10eb03860a88929801f4bf73a12ba02c36f4e422d6e0a75
|
data/lib/reddit_api/posts.rb
CHANGED
@@ -10,6 +10,7 @@ module RedditApi
|
|
10
10
|
|
11
11
|
def top(subreddit, count)
|
12
12
|
posts_data = top_data(subreddit, count)
|
13
|
+
posts_data = map_to_params(posts_data)
|
13
14
|
posts_data = filter_out(posts_data, :stickied_posts)
|
14
15
|
build_all_posts(posts_data)
|
15
16
|
end
|
@@ -34,15 +35,19 @@ module RedditApi
|
|
34
35
|
send(filter, posts_data)
|
35
36
|
end
|
36
37
|
|
37
|
-
def
|
38
|
-
|
39
|
-
|
38
|
+
def map_to_params(posts_data)
|
39
|
+
post_params = []
|
40
|
+
posts_data.each do |post_data|
|
41
|
+
if params = post_data["data"]
|
42
|
+
post_params.push(params)
|
43
|
+
end
|
40
44
|
end
|
45
|
+
post_params
|
41
46
|
end
|
42
47
|
|
43
|
-
def
|
44
|
-
|
45
|
-
post_data["
|
48
|
+
def stickied_posts(posts_data)
|
49
|
+
posts_data.select do |post_data|
|
50
|
+
!post_data["stickied"]
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
@@ -53,10 +58,9 @@ module RedditApi
|
|
53
58
|
end
|
54
59
|
|
55
60
|
def build_post(post_data)
|
56
|
-
|
57
|
-
post_factory.new(post_data["data"])
|
58
|
-
end
|
61
|
+
post_factory.new(post_data)
|
59
62
|
end
|
60
63
|
|
61
64
|
end
|
62
65
|
end
|
66
|
+
|
data/lib/reddit_api/version.rb
CHANGED