reddit_api 0.3.5 → 0.3.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f86e4544f1d1d47db2ed282a9f31ed7934a4762
4
- data.tar.gz: c0bec668f4318d3f19383bae8b5f43338abdeb57
3
+ metadata.gz: 30f62db75bf65628c6c5ce135d156ebaeec4abe4
4
+ data.tar.gz: 56dd6a2b5e8151bf1ef65eff1f415fcbbbd38a9d
5
5
  SHA512:
6
- metadata.gz: 075cdd44d44133c32641c29cd958d80cac474d037deb4440ffff461bb22204a795f0a3ad7195e471087982d30d53e0e45a10138de6d16bffa31736e9465b9a6a
7
- data.tar.gz: 99b61cd2d850187e2ef5c49d40977389d5cc99fd12c6561a3903ede7f51435a376d68600207af5968f92a9c10738f61615368d2f6e30ccedc541f6da16a873fb
6
+ metadata.gz: 6c8f5daeb6393de0a79a61b1a5fda8ef551d84409b170574e5443a3a1e3dcb327a6f5596f3cc94cc14cbe68360ed2bc0fbc7c16e3b56498243bc2cd0f69a0c36
7
+ data.tar.gz: 7e9dbb6c10bb2c2e0741c8b257806149ba11504d585ade72909f7f27c8cd889ece309722e7267cf9d10eb03860a88929801f4bf73a12ba02c36f4e422d6e0a75
@@ -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 stickied_posts(posts_data)
38
- posts_data.select do |post_data|
39
- !stickied?(post_data)
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 stickied?(post_data)
44
- if post_data && post_data["data"]
45
- post_data["data"]["stickied"]
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
- if post_data["data"]
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
+
@@ -1,3 +1,3 @@
1
1
  module RedditApi
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reddit_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Fuentes