Class: Helio::SingletonAPIResource

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

Instance Attribute Summary

Attributes inherited from APIResource

#save_with_parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResource

class_name, #refresh, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from HelioObject

#==, #[], #[]=, #as_json, construct_from, #deleted?, #dirty!, #each, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #refresh_from, #serialize_params, serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Helio::HelioObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Helio::HelioObject

Class Method Details

.resource_urlObject



5
6
7
8
9
10
# File 'lib/helio/singleton_api_resource.rb', line 5

def self.resource_url
  if self == SingletonAPIResource
    raise NotImplementedError, "SingletonAPIResource is an abstract class.  You should perform actions on its subclasses (Account, etc.)"
  end
  "/#{CGI.escape(class_name.downcase)}"
end

.retrieve(opts = {}) ⇒ Object



16
17
18
19
20
# File 'lib/helio/singleton_api_resource.rb', line 16

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

Instance Method Details

#resource_urlObject



12
13
14
# File 'lib/helio/singleton_api_resource.rb', line 12

def resource_url
  self.class.resource_url
end