Module: Medusa::Resource

Includes:
Uuidable
Included in:
Collection, Directory, File, FileGroup, Repository
Defined in:
lib/medusa/resource.rb

Overview

Remote Medusa resource, identifiable by #id or #uuid.

Instance Method Summary collapse

Methods included from Uuidable

#uuid_url

Instance Method Details

#exists?Boolean

Returns Whether the instance exists in Medusa.

Returns:

  • (Boolean)

    Whether the instance exists in Medusa.



13
14
15
16
17
18
# File 'lib/medusa/resource.rb', line 13

def exists?
  load
  true
rescue Medusa::NotFoundError
  false
end

#idInteger

Returns Medusa database ID.

Returns:

  • (Integer)

    Medusa database ID.



23
24
25
26
# File 'lib/medusa/resource.rb', line 23

def id
  load if @uuid && !@id
  @id
end

#uuidString

Returns Medusa UUID.

Returns:

  • (String)

    Medusa UUID.



31
32
33
34
# File 'lib/medusa/resource.rb', line 31

def uuid
  load if @id && !@uuid
  @uuid
end