Sha256: fd8f47886f061bd9dd461ba2aee9aeb094e83b84455c978f24af033bb238e7a3

Contents?: true

Size: 485 Bytes

Versions: 3

Compression:

Stored size: 485 Bytes

Contents

module Skydrive
  # A user's photo in SkyDrive.
  class Photo < Skydrive::File
    # The link that can be used to download the photo
    # @return [String]
    def download_link
      url = client.get("/#{id}/content", :download => true, :suppress_redirects => true)["location"]
    end

    # Download the photo
    def download
      uri = URI(download_link)
      response = HTTParty.get("http://#{uri.host}#{uri.path}?#{uri.query}")
      response.parsed_response
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skydrive-0.1.4 lib/skydrive/photo.rb
skydrive-0.1.0 lib/skydrive/photo.rb
skydrive-0.0.2 lib/skydrive/photo.rb