redd 0.7.1 → 0.7.2

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: 48bf9a93a4b969191c7ca64548fb6a56e5b7fda2
4
- data.tar.gz: 7423344e98a55f189dcd4fdae0c81c9cf88a2793
3
+ metadata.gz: 72469adb099523bf28cc5d24e451a1662dbd83e5
4
+ data.tar.gz: cc3cee620ae503607895c958743aa7ea7106d141
5
5
  SHA512:
6
- metadata.gz: 2e254c453af7d312d23d86404ba7ff6b18018d717052caf4a7be0aa7031f7e2ea90994275300397c13fb7fa7f538d4d75ca07221a4b9b7d76e037591884c2da1
7
- data.tar.gz: bbf195d1261025bc0299e48b11bf8dbf2012b05395ac3d3fa94aa361ad76076097580260e9f1b8dcc2ff467e8734990e5a2ef2a2bff07b5a8320db8478816a84
6
+ metadata.gz: 3cc603ceacd925867753441e49ff737da23f4375b8d92401dc4ef90f7e03f3bec5f23872e166080b27c990c631b2e35864e514940528a1d7a835da986312814b
7
+ data.tar.gz: fb869857d619ba1a6484a9eeb16b0630d7b7695aae95e196ccf4a4fd6b2e2087d0b4499f4f31c4698bc7eafd6a88ee6daf995752e08f1806bdd3233569578d69
@@ -42,9 +42,9 @@ module Redd
42
42
  # fullname.
43
43
  # @option params [String :before Return results before the given
44
44
  # fullname.
45
- # @option params [Integer] :count (0) The number of items already seen
46
- # in the listing.
47
- # @option params [1..100] :limit (25) The maximum number of things to
45
+ # @option params [Integer] :count The number of items already seen in
46
+ # the listing.
47
+ # @option params [1..100] :limit The maximum number of things to
48
48
  # return.
49
49
  # @option params [:hour, :day, :week, :month, :year, :all] :t The
50
50
  # time period to consider when sorting.
@@ -60,6 +60,39 @@ module Redd
60
60
  request_object(:get, path, params)
61
61
  end
62
62
  end
63
+
64
+ # Search.
65
+ # @param query [String] The query string.
66
+ # @param subreddit [Objects::Subreddit, String] The subreddit to query.
67
+ # @param params [Hash] A list of params to send with the request.
68
+ # @option params [String] :after Return results after the given
69
+ # fullname.
70
+ # @option params [String :before Return results before the given
71
+ # fullname.
72
+ # @option params [Integer] :count The number of items already seen in
73
+ # the listing.
74
+ # @option params [1..100] :limit The maximum number of things to
75
+ # return.
76
+ # @option params [:cloudsearch, :lucene, :plain] :syntax The type of
77
+ # syntax to use.
78
+ # @option params [:relevance, :new, :hot, :top, :comments] :sort The
79
+ # way to sort the results.
80
+ # @option params [:hour, :day, :week, :month, :year, :all] :t The
81
+ # time period to consider when sorting.
82
+ #
83
+ # @note The option :t only applies to the top and controversial sorts.
84
+ # @return [Objects::Listing<Objects::Thing>]
85
+ def search(query, subreddit = nil, **params)
86
+ path = "/search.json"
87
+ params[:q] = query
88
+ if subreddit
89
+ params[:restrict_sr] = true
90
+ srname = property(subreddit, :display_name)
91
+ path = path.prepend("/r/#{srname}")
92
+ end
93
+
94
+ request_object(:get, path, params)
95
+ end
63
96
  end
64
97
  end
65
98
  end
@@ -148,6 +148,30 @@ module Redd
148
148
  end
149
149
  end
150
150
 
151
+ # Search.
152
+ # @param query [String] The query string.
153
+ # @param params [Hash] A list of params to send with the request.
154
+ # @option params [String] :after Return results after the given
155
+ # fullname.
156
+ # @option params [String :before Return results before the given
157
+ # fullname.
158
+ # @option params [Integer] :count The number of items already seen in
159
+ # the listing.
160
+ # @option params [1..100] :limit The maximum number of things to
161
+ # return.
162
+ # @option params [:cloudsearch, :lucene, :plain] :syntax The type of
163
+ # syntax to use.
164
+ # @option params [:relevance, :new, :hot, :top, :comments] :sort The
165
+ # way to sort the results.
166
+ # @option params [:hour, :day, :week, :month, :year, :all] :t The
167
+ # time period to consider when sorting.
168
+ #
169
+ # @note The option :t only applies to the top and controversial sorts.
170
+ # @return [Objects::Listing<Objects::Thing>]
171
+ def search(query, **params)
172
+ client.search(query, self, **params)
173
+ end
174
+
151
175
  # @!method get_reports(**params)
152
176
  # @!method get_spam(**params)
153
177
  # @!method get_modqueue(**params)
data/lib/redd/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Redd # rubocop:disable Style/Documentation
2
2
  # The semantic version number.
3
- VERSION = "0.7.1"
3
+ VERSION = "0.7.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avinash Dwarapu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-14 00:00:00.000000000 Z
11
+ date: 2015-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler