dor-services 5.3.1 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f006d110ed66d7b3fcde6749b7a52d867637f124
4
- data.tar.gz: e393c3917969413c2cd9832f6a2c359b6eadcd04
3
+ metadata.gz: b4612df0551e79474ccb0e568de29cf05c42f6f7
4
+ data.tar.gz: cf816af8f863af33f717fc63e9ec4ede906eb758
5
5
  SHA512:
6
- metadata.gz: baa38904fa1e4fa8b38b9caa1d42f65f6bd08848775dc735ecb31e2b11d807d450bc0e1d05ffd2c7a2f1c7cb0320f003530b1097f5628d484b02c05cd90cc74b
7
- data.tar.gz: a9a8b7913940c7762afbb24b4ac7c79154507ecb7c1338a17085d9ddb40f560ee214568f77d9348dee6372f3819ff5291d08cab592fc9e879a75e684a9848540
6
+ metadata.gz: 91ada9a335362058cf16d42eb6fcd9e99542fc288577bd1cf1942004985302747dd19df89690c94ed0f476cd392f4a3e19b0426414ebc251969ae1a139849eed
7
+ data.tar.gz: 0341a7e1b9590783c3df4fd5d50fdc8872aecf4da3966375b2d35127edfccb42b61ec0b09347fe637d102147b6723da3ed551980dd8650854c037eb94ac8df3b
@@ -40,18 +40,22 @@ class IdentityMetadataDS < ActiveFedora::OmDatastream
40
40
  node ? [node['source'], node.text].join(':') : nil
41
41
  end
42
42
 
43
+ # @param [String, Nil] New value, or nil/empty string to delete sourceId node
44
+ # @return [String, Nil] The same value, as per Ruby convention for assignment operators
45
+ # @note The actual values assigned will have leading/trailing whitespace stripped.
43
46
  def sourceId=(value)
44
47
  node = find_by_terms(:sourceId).first
45
- unless value.present? # so setting it to '' is the same as removal: worth documenting maybe?
48
+ unless value.present? # so setting it to '' is the same as removal: worth documenting maybe?
46
49
  node.remove unless node.nil?
47
50
  return nil
48
51
  end
49
- (source, val) = value.split(/:/, 2)
50
- raise ArgumentError, "Source ID must follow the format namespace:value, not '#{value}'" unless source.present? && val.present?
52
+ parts = value.split(':').map(&:strip)
53
+ # parts = value.split(/:/, 2).map(&:strip) # if we needed to allow colons in values or bunched colon separators
54
+ raise ArgumentError, "Source ID must follow the format 'namespace:value', not '#{value}'" unless
55
+ parts.length == 2 && parts[0].present? && parts[1].present?
51
56
  node ||= ng_xml.root.add_child('<sourceId/>').first
52
- node['source'] = source
53
- node.content = val
54
- node
57
+ node['source'] = parts[0]
58
+ node.content = parts[1]
55
59
  end
56
60
 
57
61
  def tags
@@ -90,9 +90,20 @@ module Dor
90
90
  end
91
91
  end
92
92
 
93
- def set_source_id(source_id)
93
+ # Convenience method
94
+ def source_id
95
+ identityMetadata.sourceId
96
+ end
97
+
98
+ # Convenience method
99
+ # @param [String] source_id the new source identifier
100
+ # @return [String] same value, as per Ruby assignment convention
101
+ # @raise [ArgumentError] see IdentityMetadataDS for logic
102
+ def source_id=(source_id)
94
103
  identityMetadata.sourceId = source_id
95
104
  end
105
+ alias_method :set_source_id, :source_id=
106
+ deprecate set_source_id: 'Use source_id= instead'
96
107
 
97
108
  def add_other_Id(type, val)
98
109
  if identityMetadata.otherId(type).length > 0
@@ -144,7 +155,6 @@ module Dor
144
155
  if dupe_existing_tag
145
156
  raise "An existing tag (#{dupe_existing_tag}) is the same, consider using update_tag?"
146
157
  end
147
-
148
158
  normalized_tag
149
159
  end
150
160
 
@@ -153,11 +163,9 @@ module Dor
153
163
  # @return [Array] the tag split into an array via ':'
154
164
  def validate_tag_format(tag_str)
155
165
  tag_arr = split_tag_to_arr(tag_str)
156
-
157
166
  if tag_arr.length < 2
158
167
  raise ArgumentError, "Invalid tag structure: tag '#{tag_str}' must have at least 2 elements"
159
168
  end
160
-
161
169
  if tag_arr.detect {|str| str.empty?}
162
170
  raise ArgumentError, "Invalid tag structure: tag '#{tag_str}' contains empty elements"
163
171
  end
@@ -103,7 +103,7 @@ module Dor
103
103
  Dor::WorkflowService.get_milestones('dor', pid)
104
104
  end
105
105
 
106
- # @return [Hash] including :current_version, :status_code and :status_time
106
+ # @return [Hash{Symbol => Object}] including :current_version, :status_code and :status_time
107
107
  def status_info
108
108
  current_version = '1'
109
109
  begin
@@ -146,9 +146,8 @@ module Dor
146
146
  result
147
147
  end
148
148
 
149
- # return the text translation of the status code, minus any trailing parenthetical explanation
150
- # e.g. 'In accessioning (described)' and 'In accessioning (described, published)' both come back
151
- # as 'In accessioning'
149
+ # @return [String] text translation of the status code, minus any trailing parenthetical explanation
150
+ # e.g. 'In accessioning (described)' and 'In accessioning (described, published)' both return 'In accessioning'
152
151
  def simplified_status_code_disp_txt(status_code)
153
152
  STATUS_CODE_DISP_TXT[status_code].gsub(/\(.*\)$/, '').strip
154
153
  end
data/lib/dor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dor
2
- VERSION = '5.3.1'
2
+ VERSION = '5.3.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.1
4
+ version: 5.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2016-01-23 00:00:00.000000000 Z
17
+ date: 2016-01-27 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: active-fedora