module Subjoin::Inheritable::ClassMethods
Class methods for objects that include this mixin
Public Instance Methods
type_id()
click to toggle source
@return [String] JSON-API type corresponding to this class. Lower-cased name of the class unless TYPE_PATH is specified
# File lib/subjoin/inheritable.rb, line 60 def type_id return self.to_s.downcase.gsub(/^.*::/, '') if self::TYPE_PATH.nil? return self::TYPE_PATH end
type_url()
click to toggle source
@return [URI] URI for requesting an object of this type, based of ROOT_URI and {#type_id}
# File lib/subjoin/inheritable.rb, line 67 def type_url if self.class == Resource raise Subjoin::SubclassError.new "Class must be a subclass of Resource to use this method" end if self::ROOT_URI.nil? raise Subjoin::SubclassError.new "#{self.class} or a parent of #{self.class} derived from Subjoin::Resource must override ROOT_URI to use this method" end return URI([self::ROOT_URI, self::type_id].join('/')) end