Class: Nextcloud::Ruby::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/nextcloud/ruby/tag.rb

Constant Summary collapse

ALL_XML =
'<?xml version="1.0"?>
<d:propfind
xmlns:d="DAV:"
xmlns:oc="http://owncloud.org/ns"
xmlns:nc="http://nextcloud.org/ns">
  <d:prop>
    <oc:display-name />
    <oc:id />
  </d:prop>
</d:propfind>'.freeze

Class Method Summary collapse

Class Method Details

.allObject



23
24
25
26
# File 'lib/nextcloud/ruby/tag.rb', line 23

def all
  response = Api.request(:propfind, 'systemtags', ALL_XML)
  response.ok? ? parse_all(response) : nil
end

.find(id) ⇒ Object



16
17
18
19
20
21
# File 'lib/nextcloud/ruby/tag.rb', line 16

def find(id)
  uri = Addressable::URI
        .parse("systemtags/#{id}")
  response = Api.request(:propfind, uri, ALL_XML)
  response.ok? ? parse_tag(response.body.xpath('//d:prop')) : nil
end