Sha256: 708b2a1bf16c9af28ec36995d955aab98de9a0d963f52aa6706182e6f11e4778

Contents?: true

Size: 676 Bytes

Versions: 8

Compression:

Stored size: 676 Bytes

Contents

module DropboxApi::Metadata
  # Example of a serialized FileMemberAction:
  #
  # ```json
  # {
  #   ".tag": "success",
  #   "success": {
  #     ".tag": "viewer"
  #   }
  # }
  # ```
  class FileMemberAction < Base
    class << self
      def new(data)
        tag = data[".tag"]
        class_for(tag.to_sym).new(data[tag])
      end

      private

      def class_for(tag)
        case tag
        when :success
          DropboxApi::Metadata::AccessLevel
        when :member_error
          DropboxApi::Errors::FileMemberActionError
        else
          raise ArgumentError, "Unable to build individual result with `#{tag}`"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dropbox_api-0.1.18 lib/dropbox_api/metadata/file_member_action.rb
dropbox_api-0.1.17 lib/dropbox_api/metadata/file_member_action.rb
dropbox_api-0.1.16 lib/dropbox_api/metadata/file_member_action.rb
dropbox_api-0.1.15 lib/dropbox_api/metadata/file_member_action.rb
dropbox_api-0.1.14 lib/dropbox_api/metadata/file_member_action.rb
dropbox_api-0.1.13 lib/dropbox_api/metadata/file_member_action.rb
dropbox_api-0.1.12 lib/dropbox_api/metadata/file_member_action.rb
dropbox_api-0.1.11 lib/dropbox_api/metadata/file_member_action.rb