Module: Resteze::ApiResource::ClassMethods

Defined in:
lib/resteze/api_resource.rb

Instance Method Summary collapse

Instance Method Details

#api_path(path) ⇒ Object



53
54
55
# File 'lib/resteze/api_resource.rb', line 53

def api_path(path)
  [service_path, api_version, path].join("/".freeze).squeeze("/".freeze)
end

#api_versionObject



49
50
51
# File 'lib/resteze/api_resource.rb', line 49

def api_version
  api_module.default_api_version(self)
end

#resource_path(id = nil) ⇒ Object



61
62
63
# File 'lib/resteze/api_resource.rb', line 61

def resource_path(id = nil)
  api_path([resource_slug, id].compact.map { |part| CGI.escape(part.to_s) }.join("/".freeze))
end

#resource_slugObject



57
58
59
# File 'lib/resteze/api_resource.rb', line 57

def resource_slug
  api_module.default_resource_slug(self)
end

#retrieve(id) ⇒ Object



65
66
67
# File 'lib/resteze/api_resource.rb', line 65

def retrieve(id)
  new(id).refresh
end

#service_pathObject



45
46
47
# File 'lib/resteze/api_resource.rb', line 45

def service_path
  api_module.default_service_path(self)
end