justrelate_sdk 1.0.0.rc1 → 1.0.0.rc2
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 +4 -4
- data/lib/justrelate.rb +7 -2
- data/lib/justrelate/core/item_enumerator.rb +1 -1
- data/lib/justrelate/core/mixins/findable.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2dda8be2a0e956b0d94707c97420e25340e8541
|
4
|
+
data.tar.gz: 31853e0a6477216e0972f1a778abe68200e5ea35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b731764b2f07e38c05749ffb2b54570e55d16c67309cc697dc4c8cf0efe048ca41aa58036cf005050e3eff1eda7458233c5001babdf2873f86d190df3d2faf94
|
7
|
+
data.tar.gz: ffe5e91c0cd0539391943193743a16442d9c2514536a5366a9842d3e892dce21286ba7997bb9d30c5d50d5820c1479e56817947c5fe11977c42508b697e6cc00
|
data/lib/justrelate.rb
CHANGED
@@ -49,7 +49,12 @@ module JustRelate
|
|
49
49
|
# @raise [Errors::ResourceNotFound] if at least one of the IDs could not be found.
|
50
50
|
# @api public
|
51
51
|
def self.find(*ids)
|
52
|
-
|
52
|
+
flattened_ids = ids.flatten
|
53
|
+
if flattened_ids.compact.blank?
|
54
|
+
raise JustRelate::Errors::ResourceNotFound.new(
|
55
|
+
"Items could not be found.", flattened_ids)
|
56
|
+
end
|
57
|
+
enumerator = Core::ItemEnumerator.new(flattened_ids)
|
53
58
|
|
54
59
|
if ids.size == 1 && !ids.first.kind_of?(Array)
|
55
60
|
enumerator.first
|
@@ -113,7 +118,7 @@ module JustRelate
|
|
113
118
|
# @api public
|
114
119
|
def self.search(filters: nil, query: nil, limit: nil, offset: nil, sort_by: nil,
|
115
120
|
sort_order: nil, include_deleted: nil)
|
116
|
-
server_limit =
|
121
|
+
server_limit = 100
|
117
122
|
limit ||= 10
|
118
123
|
limit = Float::INFINITY if limit == :none
|
119
124
|
offset ||= 0
|
@@ -39,7 +39,7 @@ module JustRelate; module Core
|
|
39
39
|
def each(&block)
|
40
40
|
return enum_for(:each) unless block_given?
|
41
41
|
|
42
|
-
server_limit =
|
42
|
+
server_limit = 100
|
43
43
|
@ids.each_slice(server_limit) do |sliced_ids|
|
44
44
|
RestApi.instance.get('mget', {'ids' => sliced_ids}).map do |item|
|
45
45
|
block.call "JustRelate::#{item['base_type']}".constantize.new(item)
|
@@ -16,6 +16,10 @@ module JustRelate; module Core; module Mixins
|
|
16
16
|
# if the ID could not be found or the base type did not match.
|
17
17
|
# @api public
|
18
18
|
def find(id)
|
19
|
+
if id.blank?
|
20
|
+
raise JustRelate::Errors::ResourceNotFound.new(
|
21
|
+
"Items could not be found.", [id])
|
22
|
+
end
|
19
23
|
new({'id' => id}).reload
|
20
24
|
end
|
21
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: justrelate_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infopark AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|