class Yandex::Disk::Client::Request::Space

Constants

BODY
HEADERS

Public Class Methods

new(http) click to toggle source
# File lib/yandex/disk/client/request/space.rb, line 14
def initialize http
  @http = http
end

Public Instance Methods

perform() click to toggle source
# 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

Private Instance Methods

parse(body) click to toggle source
# File lib/yandex/disk/client/request/space.rb, line 48
def parse body
  attributes_parser = AttributesParser.new

  parser = Nokogiri::XML::SAX::Parser.new(attributes_parser)
  parser.parse(body)

  attributes_parser
end