class Resync::Resource

A resource (i.e., +<url>+ or +<sitemap>+). See section 7, {www.openarchives.org/rs/1.0/resourcesync#DocumentFormats Sitemap Document Formats}, in the ResourceSync specification.

Public Class Methods

all_xml_mapping_nodes(options = { mapping: nil, create: true }) click to toggle source

ResourceSync schema requires '##other' elements to appear last

# File lib/resync/resource.rb, line 67
def self.all_xml_mapping_nodes(options = { mapping: nil, create: true })
  xml_mapping_nodes(options) + superclass.all_xml_mapping_nodes(options)
end
new( uri:, modified_time: nil, changefreq: nil, priority: nil, links: [], metadata: nil ) click to toggle source

@param modified_time [Time] The date and time when the referenced resource was last modified. @param changefreq [ChangeFrequency] how frequently the referenced resource is likely to change. @param priority [Number] the priority of this resource relative to other resources from the

same provider. Allows robots to decide which resources to crawl or harvest.
Values should be in the range 0-1.0 (inclusive), where 0 is the lowest priority
and 1.0 is the highest.

@param links [Array<Link>] related links (i.e. +<rs:ln>+). @param metadata [Metadata] metadata about this resource.

Calls superclass method
# File lib/resync/resource.rb, line 33
def initialize( # rubocop:disable Metrics/ParameterLists
    uri:,
    modified_time: nil,
    changefreq: nil,
    priority: nil,
    links: [],
    metadata: nil
)
  super(links: links)
  self.uri = uri
  self.modified_time = modified_time
  self.changefreq = changefreq
  self.priority = priority
  self.metadata = metadata
end

Public Instance Methods

capability() click to toggle source

Public methods

# File lib/resync/resource.rb, line 59
def capability
  metadata ? metadata.capability : nil
end
uri=(value) click to toggle source

Custom setters

# File lib/resync/resource.rb, line 52
def uri=(value)
  @uri = XML.to_uri(value)
end