Class: Resync::Metadata

Inherits:
Descriptor show all
Includes:
XML::Mapping
Defined in:
lib/resync/metadata.rb

Overview

Metadata about a resource or ResourceSync document. See section 7, Sitemap Document Formats, in the ResourceSync specification.

Instance Attribute Summary collapse

Attributes inherited from Descriptor

#encoding, #hashes, #length, #mime_type, #modified_time, #path

Instance Method Summary collapse

Methods inherited from Descriptor

#hash, hash_of_hashcodes

Constructor Details

#initialize(at_time: nil, from_time: nil, until_time: nil, completed_time: nil, modified_time: nil, length: nil, mime_type: nil, encoding: nil, hashes: {}, change: nil, capability: nil, path: nil) ⇒ Metadata

Returns a new instance of Metadata.

Parameters:

  • at_time (Time) (defaults to: nil)

    the datetime at which assembling a resource list began (including resource list indices, resource dumps, etc.)

  • from_time (Time) (defaults to: nil)

    the beginning of the time range represented by a change list (including change list indices, change dumps, etc.)

  • until_time (Time) (defaults to: nil)

    the end of the time range represented by a change list (including change list indices, change dumps, etc.)

  • completed_time (Time) (defaults to: nil)

    the datetime at which assembling a resource list ended (including resource list indices, resource dumps, etc.)

  • modified_time (Time) (defaults to: nil)

    The date and time when the referenced resource was last modified.

  • length (Integer) (defaults to: nil)

    The content length of the referenced resource.

  • mime_type (MIME::Type) (defaults to: nil)

    The media type of the referenced resource.

  • encoding (String) (defaults to: nil)

    Any content encoding (if any) applied to the data in the referenced resource (e.g. for compression)

  • hashes (Hash<String, String>) (defaults to: {})

    Fixity information for the referenced resource, as a map from hash algorithm tokens (e.g. md5, sha-256) to hex-encoded digest values.

  • change (Change) (defaults to: nil)

    the type of change to a resource reported in a change list (including change list indices, change dumps, etc.)

  • capability (String) (defaults to: nil)

    identifies the type of a ResourceSync document.

  • path (String) (defaults to: nil)

    For ResourceDumpManifests and ChangeDumpManifests, the path to the referenced resource within the dump ZIP file.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/resync/metadata.rb', line 66

def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
    at_time: nil,
    from_time: nil,
    until_time: nil,
    completed_time: nil,
    modified_time: nil,

    length: nil,
    mime_type: nil,
    encoding: nil,
    hashes: {},

    change: nil,
    capability: nil,
    path: nil
)
  super(modified_time: modified_time, length: length, mime_type: mime_type, encoding: encoding, hashes: hashes, path: path)

  self.at_time = at_time
  self.from_time = from_time
  self.until_time = until_time
  self.completed_time = completed_time

  self.change = change
  self.capability = capability
end

Instance Attribute Details

#at_timeTime

Returns the datetime at which assembling a resource list began (including resource list indices, resource dumps, etc.).

Returns:

  • (Time)

    the datetime at which assembling a resource list began (including resource list indices, resource dumps, etc.)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/resync/metadata.rb', line 27

class Metadata < Descriptor
  include ::XML::Mapping

  # ------------------------------------------------------------
  # Attributes

  root_element_name 'md'

  time_node :at_time, '@at', default_value: nil
  time_node :from_time, '@from', default_value: nil
  time_node :until_time, '@until', default_value: nil
  time_node :completed_time, '@completed', default_value: nil
  typesafe_enum_node :change, '@change', class: Types::Change, default_value: nil
  text_node :capability, '@capability', default_value: nil

  # ------------------------------------------------------------
  # Initializer

  # @param at_time [Time] the datetime at which assembling a resource list
  #   began (including resource list indices, resource dumps, etc.)
  # @param from_time [Time] the beginning of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param until_time [Time] the end of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param completed_time [Time] the datetime at which assembling a resource list
  #   ended (including resource list indices, resource dumps, etc.)
  # @param modified_time [Time] The date and time when the referenced resource was last modified.
  # @param length [Integer] The content length of the referenced resource.
  # @param mime_type [MIME::Type] The media type of the referenced resource.
  # @param encoding [String] Any content encoding (if any) applied to the data in the
  #   referenced resource (e.g. for compression)
  # @param hashes [Hash<String, String>] Fixity information for the referenced
  #   resource, as a map from hash algorithm tokens (e.g. +md5+, +sha-256+)
  #   to hex-encoded digest values.
  # @param change [Change] the type of change to a resource reported in
  #   a change list (including change list indices, change dumps, etc.)
  # @param capability [String] identifies the type of a ResourceSync document.
  # @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
  #   the path to the referenced resource within the dump ZIP file.
  def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
      at_time: nil,
      from_time: nil,
      until_time: nil,
      completed_time: nil,
      modified_time: nil,

      length: nil,
      mime_type: nil,
      encoding: nil,
      hashes: {},

      change: nil,
      capability: nil,
      path: nil
  )
    super(modified_time: modified_time, length: length, mime_type: mime_type, encoding: encoding, hashes: hashes, path: path)

    self.at_time = at_time
    self.from_time = from_time
    self.until_time = until_time
    self.completed_time = completed_time

    self.change = change
    self.capability = capability
  end

  # ------------------------------------------------------------
  # Custom setters

  def at_time=(value)
    @at_time = time_or_nil(value)
  end

  def from_time=(value)
    @from_time = time_or_nil(value)
  end

  def until_time=(value)
    @until_time = time_or_nil(value)
  end

  def completed_time=(value)
    @completed_time = time_or_nil(value)
  end
end

#capabilityString

Returns identifies the type of a ResourceSync document.

Returns:

  • (String)

    identifies the type of a ResourceSync document.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/resync/metadata.rb', line 27

class Metadata < Descriptor
  include ::XML::Mapping

  # ------------------------------------------------------------
  # Attributes

  root_element_name 'md'

  time_node :at_time, '@at', default_value: nil
  time_node :from_time, '@from', default_value: nil
  time_node :until_time, '@until', default_value: nil
  time_node :completed_time, '@completed', default_value: nil
  typesafe_enum_node :change, '@change', class: Types::Change, default_value: nil
  text_node :capability, '@capability', default_value: nil

  # ------------------------------------------------------------
  # Initializer

  # @param at_time [Time] the datetime at which assembling a resource list
  #   began (including resource list indices, resource dumps, etc.)
  # @param from_time [Time] the beginning of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param until_time [Time] the end of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param completed_time [Time] the datetime at which assembling a resource list
  #   ended (including resource list indices, resource dumps, etc.)
  # @param modified_time [Time] The date and time when the referenced resource was last modified.
  # @param length [Integer] The content length of the referenced resource.
  # @param mime_type [MIME::Type] The media type of the referenced resource.
  # @param encoding [String] Any content encoding (if any) applied to the data in the
  #   referenced resource (e.g. for compression)
  # @param hashes [Hash<String, String>] Fixity information for the referenced
  #   resource, as a map from hash algorithm tokens (e.g. +md5+, +sha-256+)
  #   to hex-encoded digest values.
  # @param change [Change] the type of change to a resource reported in
  #   a change list (including change list indices, change dumps, etc.)
  # @param capability [String] identifies the type of a ResourceSync document.
  # @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
  #   the path to the referenced resource within the dump ZIP file.
  def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
      at_time: nil,
      from_time: nil,
      until_time: nil,
      completed_time: nil,
      modified_time: nil,

      length: nil,
      mime_type: nil,
      encoding: nil,
      hashes: {},

      change: nil,
      capability: nil,
      path: nil
  )
    super(modified_time: modified_time, length: length, mime_type: mime_type, encoding: encoding, hashes: hashes, path: path)

    self.at_time = at_time
    self.from_time = from_time
    self.until_time = until_time
    self.completed_time = completed_time

    self.change = change
    self.capability = capability
  end

  # ------------------------------------------------------------
  # Custom setters

  def at_time=(value)
    @at_time = time_or_nil(value)
  end

  def from_time=(value)
    @from_time = time_or_nil(value)
  end

  def until_time=(value)
    @until_time = time_or_nil(value)
  end

  def completed_time=(value)
    @completed_time = time_or_nil(value)
  end
end

#changeChange

Returns the type of change to a resource reported in a change list (including change list indices, change dumps, etc.).

Returns:

  • (Change)

    the type of change to a resource reported in a change list (including change list indices, change dumps, etc.)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/resync/metadata.rb', line 27

class Metadata < Descriptor
  include ::XML::Mapping

  # ------------------------------------------------------------
  # Attributes

  root_element_name 'md'

  time_node :at_time, '@at', default_value: nil
  time_node :from_time, '@from', default_value: nil
  time_node :until_time, '@until', default_value: nil
  time_node :completed_time, '@completed', default_value: nil
  typesafe_enum_node :change, '@change', class: Types::Change, default_value: nil
  text_node :capability, '@capability', default_value: nil

  # ------------------------------------------------------------
  # Initializer

  # @param at_time [Time] the datetime at which assembling a resource list
  #   began (including resource list indices, resource dumps, etc.)
  # @param from_time [Time] the beginning of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param until_time [Time] the end of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param completed_time [Time] the datetime at which assembling a resource list
  #   ended (including resource list indices, resource dumps, etc.)
  # @param modified_time [Time] The date and time when the referenced resource was last modified.
  # @param length [Integer] The content length of the referenced resource.
  # @param mime_type [MIME::Type] The media type of the referenced resource.
  # @param encoding [String] Any content encoding (if any) applied to the data in the
  #   referenced resource (e.g. for compression)
  # @param hashes [Hash<String, String>] Fixity information for the referenced
  #   resource, as a map from hash algorithm tokens (e.g. +md5+, +sha-256+)
  #   to hex-encoded digest values.
  # @param change [Change] the type of change to a resource reported in
  #   a change list (including change list indices, change dumps, etc.)
  # @param capability [String] identifies the type of a ResourceSync document.
  # @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
  #   the path to the referenced resource within the dump ZIP file.
  def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
      at_time: nil,
      from_time: nil,
      until_time: nil,
      completed_time: nil,
      modified_time: nil,

      length: nil,
      mime_type: nil,
      encoding: nil,
      hashes: {},

      change: nil,
      capability: nil,
      path: nil
  )
    super(modified_time: modified_time, length: length, mime_type: mime_type, encoding: encoding, hashes: hashes, path: path)

    self.at_time = at_time
    self.from_time = from_time
    self.until_time = until_time
    self.completed_time = completed_time

    self.change = change
    self.capability = capability
  end

  # ------------------------------------------------------------
  # Custom setters

  def at_time=(value)
    @at_time = time_or_nil(value)
  end

  def from_time=(value)
    @from_time = time_or_nil(value)
  end

  def until_time=(value)
    @until_time = time_or_nil(value)
  end

  def completed_time=(value)
    @completed_time = time_or_nil(value)
  end
end

#completed_timeObject

Returns the datetime at which assembling a resource list ended (including resource list indices, resource dumps, etc.).

Returns:

  • the datetime at which assembling a resource list ended (including resource list indices, resource dumps, etc.)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/resync/metadata.rb', line 27

class Metadata < Descriptor
  include ::XML::Mapping

  # ------------------------------------------------------------
  # Attributes

  root_element_name 'md'

  time_node :at_time, '@at', default_value: nil
  time_node :from_time, '@from', default_value: nil
  time_node :until_time, '@until', default_value: nil
  time_node :completed_time, '@completed', default_value: nil
  typesafe_enum_node :change, '@change', class: Types::Change, default_value: nil
  text_node :capability, '@capability', default_value: nil

  # ------------------------------------------------------------
  # Initializer

  # @param at_time [Time] the datetime at which assembling a resource list
  #   began (including resource list indices, resource dumps, etc.)
  # @param from_time [Time] the beginning of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param until_time [Time] the end of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param completed_time [Time] the datetime at which assembling a resource list
  #   ended (including resource list indices, resource dumps, etc.)
  # @param modified_time [Time] The date and time when the referenced resource was last modified.
  # @param length [Integer] The content length of the referenced resource.
  # @param mime_type [MIME::Type] The media type of the referenced resource.
  # @param encoding [String] Any content encoding (if any) applied to the data in the
  #   referenced resource (e.g. for compression)
  # @param hashes [Hash<String, String>] Fixity information for the referenced
  #   resource, as a map from hash algorithm tokens (e.g. +md5+, +sha-256+)
  #   to hex-encoded digest values.
  # @param change [Change] the type of change to a resource reported in
  #   a change list (including change list indices, change dumps, etc.)
  # @param capability [String] identifies the type of a ResourceSync document.
  # @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
  #   the path to the referenced resource within the dump ZIP file.
  def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
      at_time: nil,
      from_time: nil,
      until_time: nil,
      completed_time: nil,
      modified_time: nil,

      length: nil,
      mime_type: nil,
      encoding: nil,
      hashes: {},

      change: nil,
      capability: nil,
      path: nil
  )
    super(modified_time: modified_time, length: length, mime_type: mime_type, encoding: encoding, hashes: hashes, path: path)

    self.at_time = at_time
    self.from_time = from_time
    self.until_time = until_time
    self.completed_time = completed_time

    self.change = change
    self.capability = capability
  end

  # ------------------------------------------------------------
  # Custom setters

  def at_time=(value)
    @at_time = time_or_nil(value)
  end

  def from_time=(value)
    @from_time = time_or_nil(value)
  end

  def until_time=(value)
    @until_time = time_or_nil(value)
  end

  def completed_time=(value)
    @completed_time = time_or_nil(value)
  end
end

#from_timeTime

Returns the beginning of the time range represented by a change list (including change list indices, change dumps, etc.).

Returns:

  • (Time)

    the beginning of the time range represented by a change list (including change list indices, change dumps, etc.)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/resync/metadata.rb', line 27

class Metadata < Descriptor
  include ::XML::Mapping

  # ------------------------------------------------------------
  # Attributes

  root_element_name 'md'

  time_node :at_time, '@at', default_value: nil
  time_node :from_time, '@from', default_value: nil
  time_node :until_time, '@until', default_value: nil
  time_node :completed_time, '@completed', default_value: nil
  typesafe_enum_node :change, '@change', class: Types::Change, default_value: nil
  text_node :capability, '@capability', default_value: nil

  # ------------------------------------------------------------
  # Initializer

  # @param at_time [Time] the datetime at which assembling a resource list
  #   began (including resource list indices, resource dumps, etc.)
  # @param from_time [Time] the beginning of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param until_time [Time] the end of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param completed_time [Time] the datetime at which assembling a resource list
  #   ended (including resource list indices, resource dumps, etc.)
  # @param modified_time [Time] The date and time when the referenced resource was last modified.
  # @param length [Integer] The content length of the referenced resource.
  # @param mime_type [MIME::Type] The media type of the referenced resource.
  # @param encoding [String] Any content encoding (if any) applied to the data in the
  #   referenced resource (e.g. for compression)
  # @param hashes [Hash<String, String>] Fixity information for the referenced
  #   resource, as a map from hash algorithm tokens (e.g. +md5+, +sha-256+)
  #   to hex-encoded digest values.
  # @param change [Change] the type of change to a resource reported in
  #   a change list (including change list indices, change dumps, etc.)
  # @param capability [String] identifies the type of a ResourceSync document.
  # @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
  #   the path to the referenced resource within the dump ZIP file.
  def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
      at_time: nil,
      from_time: nil,
      until_time: nil,
      completed_time: nil,
      modified_time: nil,

      length: nil,
      mime_type: nil,
      encoding: nil,
      hashes: {},

      change: nil,
      capability: nil,
      path: nil
  )
    super(modified_time: modified_time, length: length, mime_type: mime_type, encoding: encoding, hashes: hashes, path: path)

    self.at_time = at_time
    self.from_time = from_time
    self.until_time = until_time
    self.completed_time = completed_time

    self.change = change
    self.capability = capability
  end

  # ------------------------------------------------------------
  # Custom setters

  def at_time=(value)
    @at_time = time_or_nil(value)
  end

  def from_time=(value)
    @from_time = time_or_nil(value)
  end

  def until_time=(value)
    @until_time = time_or_nil(value)
  end

  def completed_time=(value)
    @completed_time = time_or_nil(value)
  end
end

#until_timeTime

Returns the end of the time range represented by a change list (including change list indices, change dumps, etc.).

Returns:

  • (Time)

    the end of the time range represented by a change list (including change list indices, change dumps, etc.)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/resync/metadata.rb', line 27

class Metadata < Descriptor
  include ::XML::Mapping

  # ------------------------------------------------------------
  # Attributes

  root_element_name 'md'

  time_node :at_time, '@at', default_value: nil
  time_node :from_time, '@from', default_value: nil
  time_node :until_time, '@until', default_value: nil
  time_node :completed_time, '@completed', default_value: nil
  typesafe_enum_node :change, '@change', class: Types::Change, default_value: nil
  text_node :capability, '@capability', default_value: nil

  # ------------------------------------------------------------
  # Initializer

  # @param at_time [Time] the datetime at which assembling a resource list
  #   began (including resource list indices, resource dumps, etc.)
  # @param from_time [Time] the beginning of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param until_time [Time] the end of the time range represented by
  #   a change list (including change list indices, change dumps, etc.)
  # @param completed_time [Time] the datetime at which assembling a resource list
  #   ended (including resource list indices, resource dumps, etc.)
  # @param modified_time [Time] The date and time when the referenced resource was last modified.
  # @param length [Integer] The content length of the referenced resource.
  # @param mime_type [MIME::Type] The media type of the referenced resource.
  # @param encoding [String] Any content encoding (if any) applied to the data in the
  #   referenced resource (e.g. for compression)
  # @param hashes [Hash<String, String>] Fixity information for the referenced
  #   resource, as a map from hash algorithm tokens (e.g. +md5+, +sha-256+)
  #   to hex-encoded digest values.
  # @param change [Change] the type of change to a resource reported in
  #   a change list (including change list indices, change dumps, etc.)
  # @param capability [String] identifies the type of a ResourceSync document.
  # @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
  #   the path to the referenced resource within the dump ZIP file.
  def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
      at_time: nil,
      from_time: nil,
      until_time: nil,
      completed_time: nil,
      modified_time: nil,

      length: nil,
      mime_type: nil,
      encoding: nil,
      hashes: {},

      change: nil,
      capability: nil,
      path: nil
  )
    super(modified_time: modified_time, length: length, mime_type: mime_type, encoding: encoding, hashes: hashes, path: path)

    self.at_time = at_time
    self.from_time = from_time
    self.until_time = until_time
    self.completed_time = completed_time

    self.change = change
    self.capability = capability
  end

  # ------------------------------------------------------------
  # Custom setters

  def at_time=(value)
    @at_time = time_or_nil(value)
  end

  def from_time=(value)
    @from_time = time_or_nil(value)
  end

  def until_time=(value)
    @until_time = time_or_nil(value)
  end

  def completed_time=(value)
    @completed_time = time_or_nil(value)
  end
end