justrelate_sdk 1.0.0.rc1 → 1.0.0.rc2

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: eba81fd8188714dd632cfa343fdbe5f5cc1e0b62
4
- data.tar.gz: e6a0b2f4ce4ffc2c1fba5b62d0cd5976182f39a5
3
+ metadata.gz: a2dda8be2a0e956b0d94707c97420e25340e8541
4
+ data.tar.gz: 31853e0a6477216e0972f1a778abe68200e5ea35
5
5
  SHA512:
6
- metadata.gz: d1b22ddf77190f946ddbccc1623db6388346ea17e7170ffe628fb1c347e359a119d7250dc584722504b75d4bfd8b9da6a5e98e55d2eb98a76002389ec045fdf2
7
- data.tar.gz: 812fb7877c98fff015f7fa5a48975d53b6619b2f9be336c7a26f416e6a5dff98b487379384bdd373323ba1255b2f292146aef4d0e72c6d7e45c7e7c192281e04
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
- enumerator = Core::ItemEnumerator.new(ids.flatten)
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 = 1000
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 = 1_000
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.rc1
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-02-27 00:00:00.000000000 Z
11
+ date: 2015-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack