matterhorn_whymper 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmExMTI3YjhlYjFlMjYyYzg0YWEzOWY0ODkxOTZjZjU2OTJlMDZkYw==
4
+ Yzg4Y2YxYzliNDRkMzg2Yzk4OGViZThkYWVkNWNlY2E4Y2Y3NDliZA==
5
5
  data.tar.gz: !binary |-
6
- OGU4YjZhZjJkNWY1OGM5NjhmYzllYmIxZTcyOWZjNGM5ZDEwZjNhYQ==
6
+ MThlMWRkNjQ0ZWZmMWI3ZWI5NDA0MjdmZmZjOWNkMDQ3MmJlZTZlMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWMzY2JiODkxNDA2ZWY0MzMxYTgwMTc3Nzk3MjgxMDkxYjQ1ZjhhYTYyMGEx
10
- ZjA1MmRmOWNmMzljNDlkN2I1NzRkNTdlZDAzM2NkZGIwM2UyNmM0MDMwOTIx
11
- M2NjOGYzOTk1MjdkNDllMTE4YTAzNjUxMDY3MWRhMTAzYzA1Mjg=
9
+ NmU2OGQxOGU1ZmE0ODlmYWNlMjdmODc0ZmZhMDk3YjUzMWQ2MDIzMTg3YTUx
10
+ OWNkMDc2YjYxMzEyZDlhNjNlN2IzZjA4ZTAxNmUzYTk0NDRjMzE3MjZiMTBm
11
+ NjQyYTg0MGZkMjA1NjA3MDAwZmRhNjgwMzFmYTc4MjFlNGQyOWE=
12
12
  data.tar.gz: !binary |-
13
- NTI3MGY1NzZkZDUxODFlOWRkNDYxNzk5OTJmMjQ0YjBjZjA0M2E1MTRkZjMy
14
- NWMwNDBiMDk5NmE3Y2IwYjc3ZWI5ODc3Zjg1NDUxMThmODdmYzZmZjZkZjM2
15
- ZTkxN2YwMGNkNjczNThhZWM3ZjdjMjRhZjRjYWY3MThmZDhmYWI=
13
+ YzQ1ODRjZWJmODBjOWQ5YjMwOTk2OWJhZTljYTQxZTM0Yzk5Yzk0OTk1YWI2
14
+ Y2I1ZDA0M2QxOGVhZjZiNDRjNDE0NjYyMDZhNWMzOWNmM2YxMDY3OTJkNDg2
15
+ NzEzYWU3ZDRlYWI4YjJiYjdmYzgyZWI1ZDM1ZmI0N2QzYTMzOTA=
@@ -0,0 +1,111 @@
1
+ require 'json'
2
+
3
+ # ==================================================================== Matterhorn::Endpoint::Acl ===
4
+
5
+ class Matterhorn::Endpoint::Acl < Matterhorn::Endpoint
6
+
7
+
8
+ # -------------------------------------------------------------------------- endpoint methodes ---
9
+
10
+ # ------------------------------------------------------------------------------------- create ---
11
+
12
+ # Create a new acl with name and acl list.
13
+ #
14
+ def create(name, acl)
15
+ ret_acl = false
16
+ begin
17
+ split_response http_endpoint_client.post(
18
+ "acl-manager/acl",
19
+ { 'name' => name.to_s, 'acl' => acl.to_json }
20
+ )
21
+ ret_acl = JSON.parse(response_body)
22
+ rescue => ex
23
+ exception_handler('create', ex, {
24
+ 400 => "Unable to parse the ACL!",
25
+ 409 => "An ACL with the same name[#{name}] already exists!"
26
+ }
27
+ )
28
+ end
29
+ ret_acl
30
+ end
31
+
32
+
33
+ # --------------------------------------------------------------------------------------- read ---
34
+
35
+ def index
36
+ acls = {}
37
+ begin
38
+ split_response http_endpoint_client.get(
39
+ "acl-manager/acl/acls.json"
40
+ )
41
+ acls = JSON.parse(response_body)
42
+ rescue => ex
43
+ exception_handler('index', ex, {})
44
+ end
45
+ acls
46
+ end
47
+
48
+
49
+ def get(acl_id)
50
+ acl = {}
51
+ begin
52
+ split_response http_endpoint_client.get(
53
+ "acl-manager/acl/#{acl_id}"
54
+ )
55
+ acl = JSON.parse(response_body)
56
+ rescue => ex
57
+ exception_handler('index', ex, {
58
+ 404 => "The Acl[#{acl_id}] has not been found!"
59
+ }
60
+ )
61
+ end
62
+ acl
63
+ end
64
+
65
+
66
+ # ------------------------------------------------------------------------------------- update ---
67
+
68
+ def update(acl_id, name, acl)
69
+ ret_acl = false
70
+ begin
71
+ split_response http_endpoint_client.put(
72
+ "acl-manager/acl/#{acl_id}",
73
+ { 'name' => name.to_s, 'acl' => acl.to_json }
74
+ )
75
+ ret_acl = JSON.parse(response_body)
76
+ rescue => ex
77
+ exception_handler('create', ex, {
78
+ 400 => "Unable to parse the ACL!",
79
+ 404 => "The Acl[#{acl_id}] has not been found!"
80
+ }
81
+ )
82
+ end
83
+ ret_acl
84
+ end
85
+
86
+
87
+ # ------------------------------------------------------------------------------------- delete ---
88
+
89
+ def delete(acl_id)
90
+ done = false
91
+ begin
92
+ split_response http_endpoint_client.delete(
93
+ "acl-manager/acl/#{acl_id}"
94
+ )
95
+ done = true
96
+ rescue => ex
97
+ exception_handler('create', ex, {
98
+ 404 => "The Acl[#{acl_id}] has not been found!",
99
+ 409 => "The Acl[#{acl_id}] could not be deleted, there are still references on it!"
100
+ }
101
+ )
102
+ end
103
+ done
104
+ end
105
+
106
+
107
+ # ---------------------------------------------------------------------------- private section ---
108
+ private
109
+
110
+
111
+ end # ------------------------------------------------------------ end Matterhorn::Endpoint::Acl ---
@@ -5,7 +5,7 @@ module MatterhornWhymper
5
5
 
6
6
  # -------------------------------------------------------------------------- const definitions ---
7
7
 
8
- VERSION = "1.5.1"
8
+ VERSION = "1.6.0"
9
9
 
10
10
 
11
11
  end # -------------------------------------------------------------------- end MatterhornWhymper ---
@@ -8,6 +8,7 @@ require 'matterhorn_whymper/version'
8
8
  require 'matterhorn/acl'
9
9
  require 'matterhorn/dublin_core'
10
10
  require 'matterhorn/endpoint'
11
+ require 'matterhorn/endpoint/acl'
11
12
  require 'matterhorn/endpoint/event'
12
13
  require 'matterhorn/endpoint/group'
13
14
  require 'matterhorn/endpoint/ingest'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matterhorn_whymper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Fritschi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-29 00:00:00.000000000 Z
11
+ date: 2015-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -143,6 +143,7 @@ files:
143
143
  - lib/matterhorn/acl.rb
144
144
  - lib/matterhorn/dublin_core.rb
145
145
  - lib/matterhorn/endpoint.rb
146
+ - lib/matterhorn/endpoint/acl.rb
146
147
  - lib/matterhorn/endpoint/event.rb
147
148
  - lib/matterhorn/endpoint/group.rb
148
149
  - lib/matterhorn/endpoint/ingest.rb