Sha256: 18117d2bf7a676f335eeea2f5ec2f8c5684e289b566ac23341e41c986c61b35e

Contents?: true

Size: 754 Bytes

Versions: 3

Compression:

Stored size: 754 Bytes

Contents

module Grendel
  class LinkedDocument < Document
    attr_accessor :linked_user, :owner

    # create a new linked document
    # user - linked user
    # params:
    # :name => document name
    # :uri => linked document uri
    # :owner => {
    #   :id => owner id
    #   :uri => owner uri
    # }
    def initialize(linked_user, params)
      params = Mash.new(params)
      @owner = User.new(linked_user.client, params[:owner])
      super(@owner, params)
      @linked_user = linked_user
      @name = params[:name]
      @uri = params[:uri] ?
        URI.parse(params[:uri]).path :
        ["/linked-documents", @owner.id, name].join("/")
    end

    # delete this linked document
    def delete
      @linked_user.delete(@uri)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grendel-ruby-0.1.5 lib/grendel/linked_document.rb
grendel-ruby-0.1.4 lib/grendel/linked_document.rb
grendel-ruby-0.1.3 lib/grendel/linked_document.rb