Class: Atom::Feed

Inherits:
Element
  • Object
show all
Defined in:
lib/sword2ruby/feed.rb

Overview

Extend existing Atom::Service with Sword methods

Instance Method Summary collapse

Instance Method Details

#sword_stateObject

This method returns the string href of the <sword:state> tag (usually contained in the Sword Statement Atom Feed), or nil if it is not defined.

For more information, see the Sword2 specification: section 11.1.2. “sword:state”.



20
21
22
# File 'lib/sword2ruby/feed.rb', line 20

def sword_state
  Utility.find_element_attribute_value(extensions, "sword:state", "href")
end

#sword_state_categoriesObject

This method returns an array of Atom::Categories of the original deposit (usually contained in the Sword Statement Atom Feed), or an empty array [ ] if none are defined.

For more information, see the Sword2 specification: section 11.4. “Atom Serialisation”.



12
13
14
# File 'lib/sword2ruby/feed.rb', line 12

def sword_state_categories
  Utility.find_elements_by_scheme(categories, "http://purl.org/net/sword/terms/state")
end

#sword_state_descriptionObject

This method returns the string value of the <sword:stateDescription> tag (usually contained in the Sword Statement Atom Feed), or nil if it is not defined.

For more information, see the Sword2 specification: section 11.1.7. “sword:state”.



28
29
30
31
# File 'lib/sword2ruby/feed.rb', line 28

def sword_state_description
  swordstate = Utility.find_element_by_name(extensions, "sword:state")
  swordstate.nil? ? nil : Utility.find_element_text(swordstate.elements, "sword:stateDescription")
end