Sha256: a28ed725a4ef93bf77879ede093de3bada631113d64e81f4c1ea7c19b95957f2

Contents?: true

Size: 707 Bytes

Versions: 83

Compression:

Stored size: 707 Bytes

Contents

module Alula
  class SingletonRestResource < ApiResource
    def self.resource_url
      if self == SingletonRestResource
        raise NotImplementedError, "SingletonRestResource is an abstract class.  You should perform actions on its subclasses (Self, etc.)"
      end
      # Namespaces are separated in object names with periods (.) and in URLs
      # with forward slashes (/), so replace the former with the latter.
      "/rest/v1/#{self.get_resource_path}"
    end

    def resource_url
      self.class.resource_url
    end

    def self.retrieve
      instance = new
      instance.refresh
      instance
    end

    def initialize(attributes = {})
      super(nil, attributes)
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
alula-ruby-1.9.15 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.14 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.13 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.12 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.11 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.10 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.9 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.8 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.7 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.6 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.5 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.4 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.3 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.2 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.1 lib/alula/singleton_rest_resource.rb
alula-ruby-1.9.0 lib/alula/singleton_rest_resource.rb
alula-ruby-1.8.1 lib/alula/singleton_rest_resource.rb
alula-ruby-1.8.0 lib/alula/singleton_rest_resource.rb
alula-ruby-1.7.0 lib/alula/singleton_rest_resource.rb
alula-ruby-1.6.0 lib/alula/singleton_rest_resource.rb