Sha256: 56d5e06beea77f708248281cc17b2fc93ab9776f429b54fa7c05b016676c90cf
Contents?: true
Size: 648 Bytes
Versions: 5
Compression:
Stored size: 648 Bytes
Contents
module DomoscioRails # @abstract class Resource class << self def class_name name.split('::')[-1] end def url(id = nil, util_name = nil) if self == Resource raise NotImplementedError.new('Resource is an abstract class. Do not use it directly.') end build_url = "/v1/instances/#{DomoscioRails.configuration.client_id}" build_url << "/#{class_name.underscore}s" if util_name build_url << "/#{util_name}" end if id build_url << "/#{CGI.escape(id.to_s)}" end return build_url end end end end
Version data entries
5 entries across 5 versions & 1 rubygems