ncore 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/ncore.rb +1 -1
- data/lib/ncore/base.rb +1 -0
- data/lib/ncore/client.rb +4 -1
- data/lib/ncore/exceptions.rb +1 -0
- data/lib/ncore/methods/delete_bulk.rb +26 -0
- data/lib/ncore/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f3d6a794a49da4166e2b53d68a6d4c0b672c252
|
4
|
+
data.tar.gz: afd4fe0120f932d16d1d1695440eb18c252191bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9191e55d316d0b1155dac584ce3f2ba46cd85c0f02cb16e982a9d5ed98dbdb3a254b5ab3722e99126bee0f438abbcd0bd773515cfea855f8f4172d204bd64780
|
7
|
+
data.tar.gz: ec0beb95fc9f16435ca8f8164514c0bdc4e9d804d9b0007d94cafc7f45ec17f18e6434deb8b423b8ac655672eba6c156c8a690a63fc85dd72e84b7d136100fb2
|
data/CHANGELOG.md
CHANGED
data/lib/ncore.rb
CHANGED
@@ -7,7 +7,7 @@ require 'pp'
|
|
7
7
|
require "ncore/#{f}"
|
8
8
|
end
|
9
9
|
|
10
|
-
%w(all build count create delete delete_single find find_single update).each do |f|
|
10
|
+
%w(all build count create delete delete_bulk delete_single find find_single update).each do |f|
|
11
11
|
require "ncore/methods/#{f}"
|
12
12
|
end
|
13
13
|
|
data/lib/ncore/base.rb
CHANGED
@@ -18,6 +18,7 @@ module NCore
|
|
18
18
|
include Count if types.include? :count
|
19
19
|
include Create if types.include? :create
|
20
20
|
include Delete if types.include? :delete
|
21
|
+
include DeleteBulk if types.include? :delete_bulk
|
21
22
|
include Find if types.include? :find
|
22
23
|
include Update if types.include? :update
|
23
24
|
end
|
data/lib/ncore/client.rb
CHANGED
@@ -194,7 +194,7 @@ module NCore
|
|
194
194
|
case e.message
|
195
195
|
when /Unable to verify certificate/
|
196
196
|
raise parent::ConnectionError, "Unable to verify certificate for #{host_for_error rest_opts[:url]} : verify URL or disable SSL certificate verification (insecure)."
|
197
|
-
when /Name or service not known/
|
197
|
+
when /Name or service not known/, /No address associated with hostname/
|
198
198
|
raise parent::ConnectionError, "DNS error for #{host_for_error rest_opts[:url]} : check network and DNS or visit #{status_page}."
|
199
199
|
when /Errno::ECONNREFUSED/
|
200
200
|
raise parent::ConnectionError, "Connection error for #{host_for_error rest_opts[:url]} : check network and DNS or visit #{status_page}."
|
@@ -262,6 +262,9 @@ module NCore
|
|
262
262
|
metadata = nil
|
263
263
|
end
|
264
264
|
end
|
265
|
+
if response.status == 215
|
266
|
+
metadata, json = json, {}.with_indifferent_access
|
267
|
+
end
|
265
268
|
if [409, 422].include?(response.status) && errors.empty?
|
266
269
|
errors.push 'Validation error'
|
267
270
|
end
|
data/lib/ncore/exceptions.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module NCore
|
2
|
+
module DeleteBulk
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
def bulk_delete!(ids, params={})
|
7
|
+
raise(parent::RecordNotFound, "ids must not be empty") if ids.blank?
|
8
|
+
params[:ids] = ids
|
9
|
+
params = parse_request_params(params)
|
10
|
+
parsed, creds = request(:delete, url, params)
|
11
|
+
if parsed[:errors].any?
|
12
|
+
raise parent::BulkActionError, parsed[:errors]
|
13
|
+
else
|
14
|
+
parsed[:metadata]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def bulk_delete(ids, params={})
|
19
|
+
bulk_delete!(ids, params)
|
20
|
+
rescue parent::RecordNotFound, parent::BulkActionError
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
data/lib/ncore/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ncore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Notioneer Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/ncore/methods/count.rb
|
108
108
|
- lib/ncore/methods/create.rb
|
109
109
|
- lib/ncore/methods/delete.rb
|
110
|
+
- lib/ncore/methods/delete_bulk.rb
|
110
111
|
- lib/ncore/methods/delete_single.rb
|
111
112
|
- lib/ncore/methods/find.rb
|
112
113
|
- lib/ncore/methods/find_single.rb
|