Class: YandexClient::Dav::PropFindResponse
- Inherits:
-
Object
- Object
- YandexClient::Dav::PropFindResponse
- Includes:
- Enumerable
- Defined in:
- lib/yandex_client/dav/prop_find_response.rb
Defined Under Namespace
Classes: Item
Constant Summary collapse
- SUCCESS_STATUS =
'HTTP/1.1 200 OK'
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(xml) ⇒ PropFindResponse
constructor
A new instance of PropFindResponse.
Constructor Details
#initialize(xml) ⇒ PropFindResponse
Returns a new instance of PropFindResponse.
49 50 51 52 53 54 |
# File 'lib/yandex_client/dav/prop_find_response.rb', line 49 def initialize(xml) @doc = Ox.load( xml.dup.force_encoding('UTF-8'), mode: :hash ) end |
Instance Method Details
#each ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/yandex_client/dav/prop_find_response.rb', line 56 def each @doc[:'d:multistatus'].each do |node| next if (response = node[:'d:response']).nil? name = CGI.unescape(response.fetch(:'d:href')) node_data = response.fetch(:'d:propstat') raise ParseError unless node_data.fetch(:'d:status') == SUCCESS_STATUS yield Item.new(name, node_data.fetch(:'d:prop')) end end |