Class: Yandex::Disk::Client::Request::Space

Inherits:
Object
  • Object
show all
Defined in:
lib/yandex/disk/client/request/space.rb

Defined Under Namespace

Classes: AttributesParser

Constant Summary collapse

BODY =
'<D:propfind xmlns:D="DAV:">
  <D:prop>
    <D:quota-available-bytes/>
    <D:quota-used-bytes/>
  </D:prop>
</D:propfind>'
HEADERS =
{
  :Depth => 0
}

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ Space

Returns a new instance of Space.



14
15
16
# File 'lib/yandex/disk/client/request/space.rb', line 14

def initialize http
  @http = http
end

Instance Method Details

#performObject



18
19
20
21
22
23
24
25
# File 'lib/yandex/disk/client/request/space.rb', line 18

def perform
  response = @http.run_request :propfind, '/', BODY, HEADERS
  parse_result = parse(response.body)
  {
    :quota_available_bytes => parse_result.quota_available_bytes,
    :quota_used_bytes => parse_result.quota_used_bytes
  }
end