actv 2.10.6 → 2.10.7

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: 2c8962be8f84d61a6bec5ddd0330e948469f8ea9
4
- data.tar.gz: 73dd3d5bf2832ddac42468eda20ff6e7ce2dad89
3
+ metadata.gz: 46c74f6db535f9acd7b8067779fc5490645dfd23
4
+ data.tar.gz: 169106242b943df64bf062a4437a11693ac7c39a
5
5
  SHA512:
6
- metadata.gz: 73045b2b84bab15dc927568badecb9cd742c944e233b54c31508921df49318686edc21c2ddd383cb7d8fd087bab5537184ab565a01917d38fd8b2c98b61d20b3
7
- data.tar.gz: 6ca18df1625df56305d802e4227e0afee2aefa256806938161c21a459604a9cc6d6f8671289c66955e0b2e3f23d0b37f56c3cef0c5b3ac5b04e246bc4e5841eb
6
+ metadata.gz: bc167074eab4b8e6f11a15a93fcb0c73daa9fc53f1bc8ef94aac708ff3ee3b9709042277fe9e6a9242b34afe4c85845f54a396b25161e1f767d3257a1232c109
7
+ data.tar.gz: 59fd3a0c4a998ab50814d48599a8589de5af9b2cb0d61525a3834d61c3c6b87b9a8aef7e1142e5c84547eb4230de2666355e638d3193c8a30ae8269649202d94
@@ -275,6 +275,31 @@ module ACTV
275
275
  end
276
276
  end
277
277
 
278
+ # Returns results with multiple queries
279
+ # @param options list of search options
280
+ # @example ACTV.multi_search({category: 'event', per_page: 4}, {category: 'articles OR quiz', per_page: 5})
281
+ def multi_search(*options)
282
+ results = []
283
+ query_index = 0
284
+
285
+ options_hash = options.inject({}) do |hash, options|
286
+ hash.merge! "query_#{query_index}" => "[#{URI.encode_www_form options}]"
287
+ query_index += 1
288
+ hash
289
+ end
290
+
291
+ if options_hash.present?
292
+ response = get("/v2/multisearch", options_hash)
293
+ response[:body].each_value do |sub_query|
294
+ sub_query[:results].each do |asset|
295
+ results << ACTV::Asset.from_response(body: asset)
296
+ end
297
+ end
298
+ end
299
+
300
+ results
301
+ end
302
+
278
303
  def asset_stats asset_id
279
304
  response = get("/v2/assets/#{asset_id}/stats")
280
305
  ACTV::AssetStatsResult.new response[:body]
@@ -1,3 +1,3 @@
1
1
  module ACTV
2
- VERSION = "2.10.6"
2
+ VERSION = "2.10.7"
3
3
  end
@@ -329,6 +329,16 @@ describe ACTV::Client do
329
329
  end
330
330
  end
331
331
 
332
+ describe '#multi_search' do
333
+ it 'sends get request to a3pi with encoded string' do
334
+ expect(client).to receive(:get).with('/v2/multisearch',
335
+ {'query_0' => '[category=articles+OR+quiz&per_page=2]',
336
+ 'query_1' => '[category=event&per_page=3]'
337
+ }) {{body: {}}}
338
+ client.multi_search({category: 'articles OR quiz', per_page: 2}, {category: 'event', per_page: 3})
339
+ end
340
+ end
341
+
332
342
  ACTV::Configurable::CONFIG_KEYS.each do |key|
333
343
  it "has a default #{key.to_s.gsub('_', ' ')}" do
334
344
  expect(client.send key).to eq ACTV::Default.options[key]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actv
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.6
4
+ version: 2.10.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Barnes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-23 00:00:00.000000000 Z
11
+ date: 2017-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday