Sha256: bbaf4e8dd77da0eb81d82f955b1824324c44d830a9351defac3d8bf3d0cc4539

Contents?: true

Size: 500 Bytes

Versions: 8

Compression:

Stored size: 500 Bytes

Contents

module Pingpp
  class SingletonAPIResource < APIResource
    def self.resource_url(opts={})
      if self == SingletonAPIResource
        raise NotImplementedError.new('SingletonAPIResource is an abstract class.')
      end
      "/v1/#{CGI.escape(class_name.downcase)}"
    end

    def resource_url(opts={})
      self.class.resource_url(opts)
    end

    def self.retrieve(opts={})
      instance = self.new(nil, Util.normalize_opts(opts))
      instance.refresh
      instance
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pingpp-2.2.4 lib/pingpp/singleton_api_resource.rb
pingpp-2.2.3 lib/pingpp/singleton_api_resource.rb
pingpp-2.2.2 lib/pingpp/singleton_api_resource.rb
pingpp-2.2.1 lib/pingpp/singleton_api_resource.rb
pingpp-2.2.0 lib/pingpp/singleton_api_resource.rb
pingpp-2.1.3 lib/pingpp/singleton_api_resource.rb
pingpp-2.1.1 lib/pingpp/singleton_api_resource.rb
pingpp-2.1.0 lib/pingpp/singleton_api_resource.rb