Sha256: ff619ee437661853e812acdc678933e4aaa5098952727bbc0b71a83e091b0104

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

module DropboxApi::Metadata
  # Example of a serialized {MediaInfo} object:
  #   {
  #     ".tag": "video",
  #     "dimensions": {
  #       "height": 1500,
  #       "width": 1500
  #     },
  #     "location": {
  #       "latitude": 10.123456,
  #       "longitude": 5.123456
  #     }
  #     "time_taken": "2016-09-04T17:00:27Z",
  #     "duration": 6000
  #   }
  # }
  class MediaMetadata < Base
    class << self
      def new(data)
        tag = data['.tag']
        class_for(tag.to_sym).new(data)
      end

      private

      def class_for(tag)
        case tag
        when :photo
          DropboxApi::Metadata::PhotoMetadata
        when :video
          DropboxApi::Metadata::VideoMetadata
        else
          raise ArgumentError, "Unable to build individual result with `#{tag}`"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dropbox_api-0.1.10 lib/dropbox_api/metadata/media_metadata.rb