matterhorn_whymper 1.3.0 → 1.4.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
- ODc0MmI0ZTFjZTgyY2MyZWE5MjNmYzE2NzMyMDQzOGM3NWE1YjlkNg==
4
+ YjU3NTlmN2RjOGFhODc3NDY5YWFhMTY5MjhhNTk5MTY0NWZjZTBkNw==
5
5
  data.tar.gz: !binary |-
6
- YWI3YzllZWY4ZGEyMWVlY2Y3Mjk1Yzk0NjBiZjQ3MzkxMmNhZGY4YQ==
6
+ ODNjMTU5OTMxNWVlZjVkOGQ0OTNiYzA5OWU0MTU4NzJmNjY0MDNjOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjkzYzYxZTdiNTE5ZTAyZGJjOGUxMzEwNzVhOTRiZWI4YTg2NDIzY2MxNzVj
10
- ZWYyY2UyOTVjNDcyNmQ2MmQzY2ViNDQ1YmE4N2RlNzQ5ZTY4YTc5Yzc4ZGMw
11
- NjE1ZGNiZjA5ZTA4MGRkNWQ4MTMzZThjMTg4YjQ1YzI2ZGUyMWQ=
9
+ NWFjMDMyZDRkODBkYmU3MTA5Mjg3NzdmYzhkYzhlNzI4NzgyZTZjYmU3YjI0
10
+ MDA5ZjNmNzVkMmE3Nzk1NmYyNWEzYjZlM2MzZTFmODA2YWQ4NzdmYTUzMTk0
11
+ M2Q2OGQwM2MxYzNiNzNjMmE1NTZmNTY5MjZkM2NkYWNiNmQ1ZmY=
12
12
  data.tar.gz: !binary |-
13
- ZWE2ZjY2Mzc5ZDNiZDBhOTUxN2QwOWY5MmE3YzY1ZjUyMDU3ZWJlYjliNTY3
14
- NDczNzdjYzI5NTQ4M2JmOWM0MGQ0Njg3MjE1ODJkYWNjNjk1OTkzYTE2ODRl
15
- YzA4Y2NlMmRhODM4YTRiZTgwMjJlMGQ3ZTFlN2Q1OWNmOWFkNmY=
13
+ MWEyMmYwMzVmMzA4YzQ3MDlhYzQyZmI4NmUzZWJiZGViMGEwZjA2OTc5MGM2
14
+ OGUwYjBlZDVjZjRhYmJhZDczOWI2MjBhN2IwOTg3YjhlYjQ3OTRlODZmMTgy
15
+ OGEwNzA5OGZjNWQxMTcxM2QxMTk1MTNiMmFjYjJiZWE5MDU2NzU=
@@ -64,7 +64,7 @@ class Matterhorn::Endpoint::Ingest < Matterhorn::Endpoint
64
64
  )
65
65
  @media_pkg_xml_remote = response_body
66
66
  rescue => ex
67
- exception_handler('create', ex, {
67
+ exception_handler('addDCCatalog', ex, {
68
68
  400 => "Media package not valid! / media package:\n#{@media_pkg_xml_remote}"
69
69
  }
70
70
  )
@@ -144,7 +144,7 @@ class Matterhorn::Endpoint::Ingest < Matterhorn::Endpoint
144
144
  )
145
145
  @workflow_inst = response_body
146
146
  rescue => ex
147
- exception_handler('create', ex, {
147
+ exception_handler('ingest', ex, {
148
148
  400 => "Media package not valid! / media package:\n#{@media_pkg_xml_remote}"
149
149
  }
150
150
  )
@@ -34,6 +34,30 @@ class Matterhorn::Endpoint::Series < Matterhorn::Endpoint
34
34
  end
35
35
 
36
36
 
37
+ # Create a new property for a given Series on Mattherhorn.
38
+ # Return no content.
39
+ #
40
+ def create_property(series_id, name, value)
41
+ return false if value.nil? || value.to_s.empty?
42
+ set = false
43
+ begin
44
+ split_response http_endpoint_client.post(
45
+ "series/#{series_id}/property",
46
+ { 'name' => name, 'value' => value.to_s }
47
+ )
48
+ set = true
49
+ rescue => ex
50
+ exception_handler('create_property', ex, {
51
+ 400 => "The required path or form params were missing in the request.",
52
+ 401 => "If the current user is not authorized to perform this action .",
53
+ 404 => "No series with this identifier was found."
54
+ }
55
+ )
56
+ end
57
+ set
58
+ end
59
+
60
+
37
61
  # --------------------------------------------------------------------------------------- read ---
38
62
 
39
63
  def read(series_id)
@@ -64,7 +88,7 @@ class Matterhorn::Endpoint::Series < Matterhorn::Endpoint
64
88
  )
65
89
  acl_model = Matterhorn::Acl.new(response_body)
66
90
  rescue => ex
67
- exception_handler('acl', ex, {
91
+ exception_handler('read_acl', ex, {
68
92
  404 => "The acl of series #{series_id} could not be found."
69
93
  }
70
94
  )
@@ -73,6 +97,24 @@ class Matterhorn::Endpoint::Series < Matterhorn::Endpoint
73
97
  end
74
98
 
75
99
 
100
+ def read_property(series_id, name)
101
+ prop_value = nil
102
+ begin
103
+ split_response http_endpoint_client.get(
104
+ "series/#{series_id}/property/#{name}.json"
105
+ )
106
+ prop_value = response_body
107
+ rescue => ex
108
+ exception_handler('read_property', ex, {
109
+ 401 => "The current user is not authorized to perform this action.",
110
+ 404 => "The series #{series_id} or property #{name} has not been found."
111
+ }
112
+ )
113
+ end
114
+ prop_value
115
+ end
116
+
117
+
76
118
  def find(options)
77
119
  dc_models = []
78
120
  begin
@@ -84,7 +126,7 @@ class Matterhorn::Endpoint::Series < Matterhorn::Endpoint
84
126
  dc_models << Matterhorn::DublinCore.new(dc_elem.to_xml)
85
127
  end
86
128
  rescue => ex
87
- exception_handler('filter', ex, {
129
+ exception_handler('find', ex, {
88
130
  401 => "Unauthorized. It is required to authenticate first, " +
89
131
  "before filter series."
90
132
  }
@@ -170,6 +212,24 @@ class Matterhorn::Endpoint::Series < Matterhorn::Endpoint
170
212
  end
171
213
 
172
214
 
215
+ def delete_property(series_id, name)
216
+ deleted = false
217
+ begin
218
+ split_response http_endpoint_client.delete(
219
+ "series/#{series_id}/property/#{name}"
220
+ )
221
+ deleted = true
222
+ rescue => ex
223
+ exception_handler('delete_property', ex, {
224
+ 401 => "The current user is not authorized to perform this action.",
225
+ 404 => "The series #{series_id} or property #{name} has not been found."
226
+ }
227
+ )
228
+ end
229
+ deleted
230
+ end
231
+
232
+
173
233
  # ---------------------------------------------------------------------------- private section ---
174
234
  private
175
235
 
@@ -22,7 +22,7 @@ class Matterhorn::Endpoint::Staticfiles < Matterhorn::Endpoint
22
22
  )
23
23
  uuid = response_body
24
24
  rescue => ex
25
- exception_handler('create', ex, {
25
+ exception_handler('upload', ex, {
26
26
  400 => "No filename or file to upload found. Or the uploaded size is too big"
27
27
  }
28
28
  )
@@ -42,7 +42,7 @@ class Matterhorn::Endpoint::Staticfiles < Matterhorn::Endpoint
42
42
  )
43
43
  persisted = true
44
44
  rescue => ex
45
- exception_handler('read', ex, {
45
+ exception_handler('persist', ex, {
46
46
  400 => "No file by the given UUID #{uuid} found."
47
47
  }
48
48
  )
@@ -71,7 +71,7 @@ class Matterhorn::Endpoint::Staticfiles < Matterhorn::Endpoint
71
71
  )
72
72
  deleted = true
73
73
  rescue => ex
74
- exception_handler('read', ex, {
74
+ exception_handler('delete', ex, {
75
75
  400 => "No file by the given UUID #{uuid} found."
76
76
  }
77
77
  )
@@ -5,7 +5,7 @@ module MatterhornWhymper
5
5
 
6
6
  # -------------------------------------------------------------------------- const definitions ---
7
7
 
8
- VERSION = "1.3.0"
8
+ VERSION = "1.4.0"
9
9
 
10
10
 
11
11
  end # -------------------------------------------------------------------- end MatterhornWhymper ---
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matterhorn_whymper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Fritschi