editmode 0.0.10.14 → 0.0.10.15

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
  SHA256:
3
- metadata.gz: 5a65751ad76225c8f430e7ff2a34b956ed7f656ba601d160f59878b4b53f655e
4
- data.tar.gz: 5f443b35f70f917bd0616de2a59202abb78b3c16c73302611a98a794dbf7e74b
3
+ metadata.gz: feb3922328fd985e4aec3156ba98021dbd194c3fdf58a9b51b63de2b7f7dc535
4
+ data.tar.gz: f52847ef24647300e4bde80f71a90f557e67e7caa40b55ded07fe1276ca759e2
5
5
  SHA512:
6
- metadata.gz: 57028a84200543b6dba3d732af81c36be495ad55f1d6f85e34f2f4a082d995634cd2edf7e533882d0616f68fbba5ca17e153a31a602ede1b5978a01e7fee696d
7
- data.tar.gz: 2c5da69cd042ccc113591d6cba2c5c05cf8ddfd835bc80d226d7c323082129fa3740c2b22fe1ff30e379b068aa591b3a5020f5328e5e1e14c2d82c9d0a38ae83
6
+ metadata.gz: 573b7952ccdb805057e3cdeffe11f9d19af12fc578d166916a95f14e0d3508b868b8c4f37348a2550bc1563abba2bd218b53d416f628c9422a19db6c08e656c2
7
+ data.tar.gz: 3a690c5d2a0427596f29fdf1154f1715da067611c27ad95dbe86a8ef4c5a296e5cbc6c96e170ce0442f9f32c9fea835233ab276a5cc28be98e7f7caa2e84c8ee
@@ -14,23 +14,26 @@ module Editmode
14
14
 
15
15
  def chunk_collection(collection_identifier, **options)
16
16
  branch_params = params[:em_branch_id].present? ? "branch_id=#{params[:em_branch_id]}" : ""
17
- tags = options[:tags] || []
17
+ branch_id = params[:em_branch_id].presence
18
+ tags = options[:tags].presence || []
19
+ limit = options[:limit].presence
20
+
18
21
  begin
19
- url = "#{api_root_url}/chunks?collection_identifier=#{collection_identifier}&#{branch_params}"
22
+ url_params = {
23
+ :collection_identifier => collection_identifier,
24
+ :branch_id => branch_id,
25
+ :limit => limit,
26
+ :tags => tags
27
+ }.to_query
28
+
29
+ url = URI(api_root_url)
30
+ url.path = '/chunks'
31
+ url.query = url_params
32
+
20
33
  response = HTTParty.get(url)
34
+
21
35
  raise "No response received" unless response.code == 200
22
36
  chunks = response["chunks"]
23
- if chunks.any?
24
- # Collection item limit
25
- limit = options[:limit] || chunks.size
26
-
27
- chunks = chunks.take(limit)
28
- chunks.shuffle! if options[:shuffle]
29
- end
30
-
31
- if tags.any?
32
- chunks.select!{|c| (tags - c['tags']).size < tags.size }
33
- end
34
37
 
35
38
  return chunks
36
39
  rescue => error
@@ -1,3 +1,3 @@
1
1
  module Editmode
2
- VERSION = "0.0.10.14"
2
+ VERSION = "0.0.10.15"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: editmode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10.14
4
+ version: 0.0.10.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Ennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-29 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler