Sha256: 3dcca36cfb67d451acfc744629e705f660ed593b24119ef118851aa2e0e917fd

Contents?: true

Size: 498 Bytes

Versions: 38

Compression:

Stored size: 498 Bytes

Contents

module Octobat
  class SingletonAPIResource < APIResource
    def self.url
      if self == SingletonAPIResource
        raise NotImplementedError.new('SingletonAPIResource is an abstract class.  You should perform actions on its subclasses (Account, etc.)')
      end
      "/v1/#{CGI.escape(class_name.downcase)}"
    end

    def url
      self.class.url
    end

    def self.retrieve(api_key=nil)
      instance = self.new(nil, api_key)
      instance.refresh
      instance
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
octobat-2.0.6 lib/octobat/singleton_api_resource.rb
octobat-2.0.5 lib/octobat/singleton_api_resource.rb
octobat-2.0.4 lib/octobat/singleton_api_resource.rb
octobat-2.0.3 lib/octobat/singleton_api_resource.rb
octobat-2.0.2 lib/octobat/singleton_api_resource.rb
octobat-2.0.1 lib/octobat/singleton_api_resource.rb
octobat-2.0.0 lib/octobat/singleton_api_resource.rb
octobat-0.0.12 lib/octobat/singleton_api_resource.rb
octobat-0.0.11 lib/octobat/singleton_api_resource.rb
octobat-0.0.10 lib/octobat/singleton_api_resource.rb
octobat-0.0.9 lib/octobat/singleton_api_resource.rb
octobat-0.0.8 lib/octobat/singleton_api_resource.rb
octobat-0.0.7 lib/octobat/singleton_api_resource.rb
octobat-0.0.6 lib/octobat/singleton_api_resource.rb
octobat-0.0.5 lib/octobat/singleton_api_resource.rb
octobat-0.0.4 lib/octobat/singleton_api_resource.rb
octobat-0.0.3 lib/octobat/singleton_api_resource.rb
octobat-0.0.2 lib/octobat/singleton_api_resource.rb