Class: Resync::CapabilityList
- Inherits:
-
BaseResourceList
- Object
- Augmented
- BaseResourceList
- Resync::CapabilityList
- Includes:
- XML::Mapping
- Defined in:
- lib/resync/capability_list.rb
Overview
A capability list. See section 9, “Advertising Capabilities”, in the ResourceSync specification.
Constant Summary collapse
- CAPABILITY =
The capability provided by this type.
'capabilitylist'.freeze
Instance Attribute Summary
Attributes inherited from BaseResourceList
Attributes inherited from Augmented
Instance Method Summary collapse
-
#initialize(resources: [], links: [], metadata: nil) ⇒ CapabilityList
constructor
Creates a new
BaseResourceList. -
#resource_for(capability:) ⇒ Resource
Gets the resource for the specified capability.
-
#resources=(value) ⇒ Object
Sets the
resourceslist. -
#source_description ⇒ URI
Gets the URI of the description of the source whose capabilities are identified by this list.
Methods inherited from BaseResourceList
#capability, inherited, #metadata=, #pre_save, #resources_for, #resources_in
Methods inherited from Augmented
#at_time, #change, #completed_time, #from_time, #link_for, #links_for, #until_time
Constructor Details
#initialize(resources: [], links: [], metadata: nil) ⇒ CapabilityList
Creates a new BaseResourceList.
28 29 30 31 |
# File 'lib/resync/capability_list.rb', line 28 def initialize(resources: [], links: [], metadata: nil) super(resources: resources, links: links, metadata: ) @source_description = source_description_from(self.links) end |
Instance Method Details
#resource_for(capability:) ⇒ Resource
Gets the resource for the specified capability.
49 50 51 |
# File 'lib/resync/capability_list.rb', line 49 def resource_for(capability:) @capabilities[capability] end |
#resources=(value) ⇒ Object
Sets the resources list. nil is treated as an empty list.
39 40 41 42 |
# File 'lib/resync/capability_list.rb', line 39 def resources=(value) @capabilities = to_capability_map(value || []) super(@capabilities.values) end |
#source_description ⇒ URI
Gets the URI of the description of the source whose capabilities are identified by this list.
59 60 61 |
# File 'lib/resync/capability_list.rb', line 59 def source_description @source_description ||= source_description_from(links) end |