GET /resource_name
187985
def get_resource(resource, options = nil)
      # Prevent resource to be miss spelled
      case resource
      when "correos", "couriers"
        resource_name = "correos"
      when "sucursales"
        resource_name = "sucursales"
      when "provincias", "states"
        resource_name = "provincias"
      when "localidades", "barrios"
        resource_name = "localidades"
      when "paquetes", "packaging", "boxes", "embalaje"
        resource_name = "tipos-de-paquetes"
      when "mis-direcciones", "mi-dreccion", "addresses", "remitiente"
        resource_name = "mis-direcciones"
      when "direcciones-de-envio", "direcciones", "destination"
        resource_name = "direcciones-de-envio"
      else
        resource_name = resource
      end

      # build request
      url = "/#{resource}"
      get_response(url, nil)
    end
73778
async def get_resource(self, resource_id: int) -> dict:
        """"""
        resource = await self.request.get(
            join_path(self._base_path, str(resource_id))
        )
        self._sanitize_resource(self._get_to_actual_data(resource))
        return resource
1261869
def get_resource_name(meta):
    
    if meta.name is None and not meta.is_model:
        msg = "Either name or model for resource.Meta shoud be provided"
        raise ValueError(msg)

    name = meta.name or get_model_name(get_concrete_model(meta.model))
    return name
347740
def get_resource_attribute(self, attr):
        
        if attr not in self.resource_attributes:
            raise KeyError("%s is not in resource attributes" % attr)

        return self.resource_attributes[attr]
120145
def GetResourceIdOrFullNameFromLink(resource_link):
    
    # For named based, the resource link is the full name
    if IsNameBased(resource_link):
        return TrimBeginningAndEndingSlashes(resource_link)
    
    # Padding the resource link with leading and trailing slashes if not already
    if resource_link[-1] != '/':
        resource_link = resource_link + '/'

    if resource_link[0] != '/':
        resource_link = '/' + resource_link

    # The path will be in the form of 
    # /[resourceType]/[resourceId]/ .... /[resourceType]/[resourceId]/ or
    # /[resourceType]/[resourceId]/ .... /[resourceType]/
    # The result of split will be in the form of
    # ["", [resourceType], [resourceId] ... ,[resourceType], [resourceId], ""]
    # In the first case, to extract the resourceId it will the element
    # before last ( at length -2 ) and the the type will before it
    # ( at length -3 )
    # In the second case, to extract the resource type it will the element
    # before last ( at length -2 )
    path_parts = resource_link.split("/")
    if len(path_parts) % 2 == 0:
        # request in form
        # /[resourceType]/[resourceId]/ .... /[resourceType]/[resourceId]/.
        return str(path_parts[-2])
    return None
1118449
def resource_spec(opts):
    
    resources = _load(opts.resources, opts.output_dir)
    if opts.resource_name not in resources:
        sys.stderr.write('Invalid resource name: {}\n'.format(opts.resource_name))
        return 1
    print(resources[opts.resource_name].spec)
459730
def get_by_name(self, name):
        
        managed_sans = self.get_all()
        result = [x for x in managed_sans if x['name'] == name]

        resource = result[0] if result else None
        if resource:
            resource = self.new(self._connection, resource)

        return resource
181332
def get_resource(name):
    
    # get the resource
    resource = resource_string('trimesh',
                               os.path.join('resources', name))
    # make sure we return it as a string
    if hasattr(resource, 'decode'):
        return resource.decode('utf-8')
    return resource
758800
def _get_resource_uri(self, guid=None):
        
        uri = self.uri + '/v1/resource'
        if guid:
            uri += '/' + urllib.quote_plus(guid)
        return uri
996703
def resource_url(self):
        """"""
        if self._iam:
            self._resource_url = self._resource_url or _get_iam_rest_api_url_from_creds(self.rest_client, self.credentials)
        else:
            self._resource_url = self._resource_url or _get_rest_api_url_from_creds(self.session, self.credentials)
        return self._resource_url
1332827
def get_by_resource(self, resource_uri):
        
        uri = self.URI + self.RESOURCES_PATH + '/' + resource_uri
        return self._client.get(id_or_uri=uri)
779750
function getResourceNames() {
        var resourceNames = {};
        var resourcesDir = this.injector.rootDir + '/' + this.injector.servicesDir + '/resources';

        if (!fs.existsSync(path.normalize(resourcesDir))) {
            return resourceNames;
        }

        var names = fs.readdirSync(path.normalize(resourcesDir));
        _.each(names, function (name) {
            if (name.substring(name.length - 3) !== '.js') {  // only dirs, not js files
                resourceNames[utils.getPascalCase(name)] = utils.getCamelCase(name);
            }
        });

        return resourceNames;
    }
169871
public String getName() {
    ResourceServices services = getServices();
    return (services != null) ? services.getResourceName() : null;
  }
247015
def get_route_name(resource_uri):
    
    resource_uri = resource_uri.strip('/')
    resource_uri = re.sub('\W', '', resource_uri)
    return resource_uri
606500
def file_name(self, resource):
        """"""
        warnings.warn(
            "file_name is deprecated; use resource_name instead",
            DeprecationWarning, stacklevel=2)
        return self.resource_name(resource)
1207706
def resource(resource_id):
    """"""
    resource_obj = app.db.resource(resource_id)

    if 'raw' in request.args:
        return send_from_directory(os.path.dirname(resource_obj.path),
                                   os.path.basename(resource_obj.path))

    return render_template('resource.html', resource=resource_obj)
515324
function _parse_resource_name(&$params)
	{

		// split tpl_path by the first colon
		$_resource_name_parts = explode(':', $params['resource_name'], 2);

		if (count($_resource_name_parts) == 1) {
			// no resource type given
			$params['resource_type'] = $this->default_resource_type;
			$params['resource_name'] = $_resource_name_parts[0];
		} else {
			if(strlen($_resource_name_parts[0]) == 1) {
				// 1 char is not resource type, but part of filepath
				$params['resource_type'] = $this->default_resource_type;
				$params['resource_name'] = $params['resource_name'];
			} else {
				$params['resource_type'] = $_resource_name_parts[0];
				$params['resource_name'] = $_resource_name_parts[1];
			}
		}

		if ($params['resource_type'] == 'file') {
			if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $params['resource_name'])) {
				// relative pathname to $params['resource_base_path']
				// use the first directory where the file is found
				foreach ((array)$params['resource_base_path'] as $_curr_path) {
					$_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
					if (file_exists($_fullpath) && is_file($_fullpath)) {
						$params['resource_name'] = $_fullpath;
						return true;
					}
					// didn't find the file, try include_path
					$_params = array('file_path' => $_fullpath);
					require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
					if(smarty_core_get_include_path($_params, $this)) {
						$params['resource_name'] = $_params['new_file_path'];
						return true;
					}
				}
				return false;
			} else {
				/* absolute path */
				return file_exists($params['resource_name']);
			}
		} elseif (empty($this->_plugins['resource'][$params['resource_type']])) {
			$_params = array('type' => $params['resource_type']);
			require_once(SMARTY_CORE_DIR . 'core.load_resource_plugin.php');
			smarty_core_load_resource_plugin($_params, $this);
		}

		return true;
	}