lib/skydrive/audio.rb in skydrive-0.0.1 vs lib/skydrive/audio.rb in skydrive-0.0.2

- old
+ new

@@ -1,8 +1,8 @@ module Skydrive # A user's audio file in SkyDrive. - class Audio < Skydrive::Object + class Audio < Skydrive::File # The size, in bytes, of the audio # @return [Integer] def size object["size"] @@ -18,16 +18,10 @@ # @return [Boolean] def comments_enabled object["comments_enabled"] end - # A value that indicates whether this audio can be embedded - # @return [Boolean] - def is_embeddable - object["is_embeddable"] - end - # The URL to use to download the audio from SkyDrive # @return [String] def source object["source"] end @@ -70,9 +64,22 @@ # A URL to view the audio's picture on SkyDrive # @return [String] def picture object["picture"] + end + + # The link that can be used to download the audio file + # @return [String] + def download_link + url = client.get("/#{id}/content", :download => true, :suppress_redirects => true)["location"] + end + + # Download the audio file + def download + uri = URI(download_link) + response = HTTParty.get("http://#{uri.host}#{uri.path}?#{uri.query}") + response.parsed_response end end end \ No newline at end of file