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'
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
Methods inherited from Augmented
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) @source_descripton = source_description_from(links) super(resources: resources, links: links, metadata: ) end |
Instance Method Details
#resource_for(capability:) ⇒ Resource
Gets the resource for the specified capability.
50 51 52 |
# File 'lib/resync/capability_list.rb', line 50 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 43 |
# File 'lib/resync/capability_list.rb', line 39 def resources=(value) resources = value || [] @capabilities = to_capability_map(resources) @resources = @capabilities.values end |
#source_description ⇒ URI
Gets the URI of the description of the source whose capabilities are identified by this list.
60 61 62 |
# File 'lib/resync/capability_list.rb', line 60 def source_description @source_description ||= source_description_from(links) end |