Class: Supercast::Singleton
- Inherits:
-
Resource
- Object
- DataObject
- Resource
- Supercast::Singleton
- Defined in:
- lib/supercast/singleton.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Resource
class_name, custom_method, object_name, #object_name, #refresh
Methods included from Operations::Request
Methods inherited from DataObject
#==, #[], #[]=, #as_json, construct_from, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Supercast::DataObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Supercast::DataObject
Class Method Details
.resource_url ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/supercast/singleton.rb', line 5 def self.resource_url if self == Singleton raise NotImplementedError, 'Singleton is an abstract class. You should ' \ 'perform actions on its subclasses (Balance, etc.)' end "/#{self::OBJECT_NAME.downcase}" end |
.retrieve(opts = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/supercast/singleton.rb', line 15 def self.retrieve(opts = {}) instance = new(nil, Util.normalize_opts(opts)) instance.refresh instance end |
Instance Method Details
#resource_url ⇒ Object
21 22 23 |
# File 'lib/supercast/singleton.rb', line 21 def resource_url self.class.resource_url end |