# File lib/pdc/resource/identity.rb, line 10 def primary_key @primary_key ||= default_primary_key end
module PDC::Resource::Identity::ClassMethods
Public Instance Methods
primary_key()
click to toggle source
primary_key=(value)
click to toggle source
# File lib/pdc/resource/identity.rb, line 14 def primary_key=(value) @primary_key = value end
resource_path()
click to toggle source
returns <version>/<resource-name> from the class.name
# File lib/pdc/resource/identity.rb, line 23 def resource_path @resource_path ||= model_name.collection.sub(%r{^pdc\/}, '').tr('_', '-') end
uri(value = nil)
click to toggle source
# File lib/pdc/resource/identity.rb, line 18 def uri(value = nil) @uri ||= Path.new(value || default_uri).to_s end
Private Instance Methods
default_primary_key()
click to toggle source
default pkey for FooBar is foo_bar_id
# File lib/pdc/resource/identity.rb, line 34 def default_primary_key model_name.foreign_key.to_s end
default_uri()
click to toggle source
# File lib/pdc/resource/identity.rb, line 29 def default_uri resource_path + "/(:#{primary_key})" end