Class: Latitude::API::SingletonAPIResource

Inherits:
APIResource
  • Object
show all
Defined in:
lib/latitude/api/singleton_api_resource.rb

Constant Summary

Constants inherited from APIResource

APIResource::READ_ONLY_ATTRIBUTES

Instance Attribute Summary

Attributes inherited from APIResource

#id, #meta, #path_params, #raw_data, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIResource

#==, #[], #[]=, #as_json, #attributes, #changed?, class_url, config_source, construct_from, #delete, execute_request, extract_path_params, #hash, id_prefix, #initialize, #inspect, #method_missing, path_param_keys, #refresh, resource_path, resource_type, #respond_to_missing?, #save, #to_h, #unsaved_attributes, with_config, #write_attribute

Methods included from Attributes::ClassMethods

#attribute, #attribute_specs

Methods included from Attributes::InstanceMethods

#attribute_spec, #read_attribute, #wrap_attribute

Constructor Details

This class inherits a constructor from Latitude::API::APIResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Latitude::API::APIResource

Class Method Details

.instance_url(_id = nil, path_params: {}) ⇒ Object



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

def instance_url(_id = nil, path_params: {})
  class_url(path_params: path_params)
end

.retrieve(opts = {}) ⇒ Object



7
8
9
10
# File 'lib/latitude/api/singleton_api_resource.rb', line 7

def retrieve(opts = {})
  parsed = execute_request(method: :get, path: resource_path, opts: opts)
  construct_from(parsed, opts: opts)
end

Instance Method Details

#resource_urlObject



17
18
19
# File 'lib/latitude/api/singleton_api_resource.rb', line 17

def resource_url
  self.class.resource_path
end