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.27 lib/octobat/singleton_api_resource.rb
octobat-2.0.26 lib/octobat/singleton_api_resource.rb
octobat-2.0.25 lib/octobat/singleton_api_resource.rb
octobat-2.0.24 lib/octobat/singleton_api_resource.rb
octobat-2.0.23 lib/octobat/singleton_api_resource.rb
octobat-2.0.22 lib/octobat/singleton_api_resource.rb
octobat-2.0.21 lib/octobat/singleton_api_resource.rb
octobat-2.0.20 lib/octobat/singleton_api_resource.rb
octobat-2.0.19 lib/octobat/singleton_api_resource.rb
octobat-2.0.18 lib/octobat/singleton_api_resource.rb
octobat-2.0.17 lib/octobat/singleton_api_resource.rb
octobat-2.0.16 lib/octobat/singleton_api_resource.rb
octobat-2.0.15 lib/octobat/singleton_api_resource.rb
octobat-2.0.14 lib/octobat/singleton_api_resource.rb
octobat-2.0.12 lib/octobat/singleton_api_resource.rb
octobat-2.0.11 lib/octobat/singleton_api_resource.rb
octobat-2.0.10 lib/octobat/singleton_api_resource.rb
octobat-2.0.9 lib/octobat/singleton_api_resource.rb
octobat-2.0.8 lib/octobat/singleton_api_resource.rb
octobat-2.0.7 lib/octobat/singleton_api_resource.rb