Class: Ape::Service
- Inherits:
-
Object
- Object
- Ape::Service
- Includes:
- Util::InstanceMethods
- Defined in:
- lib/ape/service.rb
Instance Attribute Summary collapse
-
#reporter ⇒ Object
Returns the value of attribute reporter.
-
#service ⇒ Object
Returns the value of attribute service.
Instance Method Summary collapse
- #collections(uri = @uri) ⇒ Object
-
#initialize(opts = {}) ⇒ Service
constructor
uri = nil, authent = nil).
Methods included from Util::InstanceMethods
Constructor Details
#initialize(opts = {}) ⇒ Service
uri = nil, authent = nil)
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ape/service.rb', line 12 def initialize(opts = {}) #uri = nil, authent = nil) @authent = opts[:authent] @reporter = opts[:reporter] if opts[:uri] @uri = opts[:uri] resource = check_resource(@uri, 'Service document', Names::AppMediaType, @reporter) raise StandardError, "Service document not found at: #{@uri}" unless resource @service = REXML::Document.new(resource.body, { :raw => nil }) end end |
Instance Attribute Details
#reporter ⇒ Object
Returns the value of attribute reporter.
10 11 12 |
# File 'lib/ape/service.rb', line 10 def reporter @reporter end |
#service ⇒ Object
Returns the value of attribute service.
10 11 12 |
# File 'lib/ape/service.rb', line 10 def service @service end |
Instance Method Details
#collections(uri = @uri) ⇒ Object
24 25 26 27 |
# File 'lib/ape/service.rb', line 24 def collections(uri = @uri) nodes = REXML::XPath.match(@service, '//app:collection', Names::XmlNamespaces) nodes.collect { |n| CollElement.new(n, uri) } end |