Class: Pingpp::SingletonAPIResource

Inherits:
APIResource show all
Defined in:
lib/pingpp/singleton_api_resource.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResource

class_name, object_name, #refresh, uri_object_name

Methods included from APIOperations::Request

included

Methods inherited from PingppObject

#==, #[], #[]=, #_dump, _load, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #respond_to?, #serialize_params, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from Pingpp::PingppObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Pingpp::PingppObject

Class Method Details

.resource_url(opts = {}) ⇒ Object



3
4
5
6
7
8
# File 'lib/pingpp/singleton_api_resource.rb', line 3

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

.retrieve(opts = {}) ⇒ Object



14
15
16
17
18
# File 'lib/pingpp/singleton_api_resource.rb', line 14

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

Instance Method Details

#resource_url(opts = {}) ⇒ Object



10
11
12
# File 'lib/pingpp/singleton_api_resource.rb', line 10

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