Module: Rooftop::Base::ClassMethods

Defined in:
lib/rooftop/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_endpointObject

Returns the value of attribute api_endpoint.



57
58
59
# File 'lib/rooftop/base.rb', line 57

def api_endpoint
  @api_endpoint
end

#api_namespaceObject

Returns the value of attribute api_namespace.



57
58
59
# File 'lib/rooftop/base.rb', line 57

def api_namespace
  @api_namespace
end

#api_versionObject

Returns the value of attribute api_version.



57
58
59
# File 'lib/rooftop/base.rb', line 57

def api_version
  @api_version
end

Instance Method Details

#firstObject

Allow calling ‘first’



80
81
82
# File 'lib/rooftop/base.rb', line 80

def first
  all.first
end

#reload!Object



84
85
86
# File 'lib/rooftop/base.rb', line 84

def reload!
  self.class.find(self.id) if self.id
end

#setup_path!Object



74
75
76
77
# File 'lib/rooftop/base.rb', line 74

def setup_path!
  @api_endpoint ||= collection_path
  self.collection_path "#{@api_namespace}/v#{@api_version}/#{@api_endpoint}"
end