clio_client 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clio_client/api/crudable.rb +8 -1
- data/lib/clio_client/version.rb +1 -1
- data/spec/api/crudable_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d7e257d3fd36625d61a721b2ef33be6626b703c
|
4
|
+
data.tar.gz: a5b8cc0f0adf55727737ff284f19e160b25c3c4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65f9ad1f1cbc95582564d50961e52840668236adbf84820bd79cf7b978511c5fca2d50d82404e814759aebd35cee0167954ede7065b3d7229c6ee84c2d49d3b2
|
7
|
+
data.tar.gz: ae98c77ab3931b6638cf05629d1b8ef534578874b12583a1e5a93eb6f31963219621bada96a69a82ef4413f46b081a6210dd429c10152fc3cb997f9c1f429395
|
@@ -40,7 +40,14 @@ module ClioClient
|
|
40
40
|
|
41
41
|
def create_plural(params)
|
42
42
|
response = session.post(end_point_url, {plural_resource => params}.to_json)
|
43
|
-
response[plural_resource].map
|
43
|
+
response[plural_resource].map do |resource|
|
44
|
+
# Errors are presented inline when doing bulk create via the Clio API
|
45
|
+
if resource.key?("errors")
|
46
|
+
resource
|
47
|
+
else
|
48
|
+
data_item(resource)
|
49
|
+
end
|
50
|
+
end
|
44
51
|
end
|
45
52
|
|
46
53
|
end
|
data/lib/clio_client/version.rb
CHANGED
data/spec/api/crudable_spec.rb
CHANGED
@@ -21,6 +21,9 @@ describe ClioClient::Api::Crudable do
|
|
21
21
|
let(:response) do
|
22
22
|
{ "dummy" => { string: "1" } }
|
23
23
|
end
|
24
|
+
let(:inline_error_response) do
|
25
|
+
{ "errors" => { "base" => ["Something went wrong"] } }
|
26
|
+
end
|
24
27
|
|
25
28
|
it "issues with create request" do
|
26
29
|
session.stub(:post).with("test", {"dummy" => params}.to_json).and_return(response)
|
@@ -28,6 +31,18 @@ describe ClioClient::Api::Crudable do
|
|
28
31
|
expect(record).to be_kind_of TestResource
|
29
32
|
expect(record.string).to eql "1"
|
30
33
|
end
|
34
|
+
|
35
|
+
context "when errors are returned" do
|
36
|
+
it "should parse them inline" do
|
37
|
+
session.stub(:post).with("test", {"dummies" => [params, params]}.to_json).and_return({"dummies" => [response["dummy"], inline_error_response]})
|
38
|
+
records = subject.create([params, params])
|
39
|
+
expect(records[0]).to be_kind_of TestResource
|
40
|
+
expect(records[0].string).to eql "1"
|
41
|
+
|
42
|
+
expect(records[1]).to be_kind_of Hash
|
43
|
+
expect(records[1]["errors"]["base"][0]).to eql "Something went wrong"
|
44
|
+
end
|
45
|
+
end
|
31
46
|
end
|
32
47
|
|
33
48
|
describe "#update" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clio_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle d'Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
235
|
version: '0'
|
236
236
|
requirements: []
|
237
237
|
rubyforge_project:
|
238
|
-
rubygems_version: 2.
|
238
|
+
rubygems_version: 2.4.3
|
239
239
|
signing_key:
|
240
240
|
specification_version: 4
|
241
241
|
summary: A simple ruby library to interact with Clio's Api
|