GET /projects/new
 GET /projects/new.json
762437
def new
      @project = Project.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @project }
      end
    end
794207
function get(req, res, next) {
  var params = {
    appId: req.params.projectid || req.params.id
  };

  forms.getAppFormsForApp(_.extend(req.connectionOptions, params), formsResultHandlers(constants.resultTypes.formProjects, req, next));
}
823399
def project(self, key):
        
        url = 'rest/api/1.0/projects/{0}'.format(key)
        return (self.get(url) or {}).get('values')
1059076
def refresh
      json = JSON(Net::HTTP.get(URI.parse(base_url)))
      unpack(json)
    end
192538
def all(self):
        
        project_list = self.fetch('projects.json').get("projects")
        obj_list = []
        for proj in project_list:
            proj['_connection'] = self._connection
            proj = Project(proj)
            obj_list.append(proj)
        return obj_list
872471
def new
      @channel = Channel.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @channel }
      end
    end
1158669
def new
      @snippet = Snippet.new

      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @snippet }
      end
    end
507245
function updateResource(project, slug, xlfFile, apiHostname, credentials) {
    return new Promise((resolve, reject) => {
        const data = JSON.stringify({ content: xlfFile.contents.toString() });
        const options = {
            hostname: apiHostname,
            path: `/api/2/project/${project}/resource/${slug}/content`,
            headers: {
                'Content-Type': 'application/json',
                'Content-Length': Buffer.byteLength(data)
            },
            auth: credentials,
            method: 'PUT'
        };
        let request = https.request(options, (res) => {
            if (res.statusCode === 200) {
                res.setEncoding('utf8');
                let responseBuffer = '';
                res.on('data', function (chunk) {
                    responseBuffer += chunk;
                });
                res.on('end', () => {
                    const response = JSON.parse(responseBuffer);
                    log(`Resource ${project}/${slug} successfully updated on Transifex. Strings added: ${response.strings_added}, updated: ${response.strings_added}, deleted: ${response.strings_added}`);
                    resolve();
                });
            }
            else {
                reject(`Something went wrong in the request updating ${slug} in ${project}. ${res.statusCode}`);
            }
        });
        request.on('error', (err) => {
            reject(`Failed to update ${project}/${slug} on Transifex: ${err}`);
        });
        request.write(data);
        request.end();
    });
}
576736
def get_projects(self, **kwargs):
        

        _login = kwargs.get('login', self._login)
        search_url = SEARCH_URL.format(login=_login)
        return self._request_api(url=search_url).json()
1013974
public function getProjects($refresh = null)
    {
        $cacheKey = sprintf('%s:projects', $this->sessionId);

        /** @var Project[] $projects */
        $projects = [];

        $cached = $this->cache->fetch($cacheKey);

        if ($refresh === false && !$cached) {
            return [];
        } elseif ($refresh || !$cached) {
            foreach ($this->getClient()->getProjects() as $project) {
                $projects[$project->id] = $project;
            }

            $cachedProjects = [];
            foreach ($projects as $id => $project) {
                $cachedProjects[$id] = $project->getData();
                $cachedProjects[$id]['_endpoint'] = $project->getUri(true);
            }

            $this->cache->save($cacheKey, $cachedProjects, $this->config->get('api.projects_ttl'));
        } else {
            $guzzleClient = $this->getHttpClient();
            foreach ((array) $cached as $id => $data) {
                $projects[$id] = new Project($data, $data['_endpoint'], $guzzleClient);
            }
        }

        return $projects;
    }
821844
function getProjects() {
		$getUserProjectsRequest = new getUserProjects ();
		$getUserProjectsRequest->isSubProjectIncluded = TRUE;
		$projects = $this->projectService->getUserProjects ( $getUserProjectsRequest )->return;

		$i = 0;
		$proj_arr = array ();
		if (is_array ( $projects )) {
			foreach ( $projects as $project ) {
				$pdproject = new PDProject ( $project );
				$proj_arr [$i ++] = $pdproject;
			}
		} else {
			$fullProject = $this->getProject ( $projects->projectInfo->shortCode );
			$proj_arr [0] = $fullProject;
		}
		
		return $proj_arr;
	}
101461
def project(*names)
      new(names.map { |name| name.is_a?(Symbol) ? self[name] : name })
    end
646241
def create(self, project, slug, content, **attrs):
        
        attrs.update({'project': project, 'slug': slug, 'content': content})
        return self._new_resource(payload=attrs)
227585
function findProjectRoot(currentPath) {
  var result = undefined;

  try {
    var packageStats = lstatSync(path.join(currentPath, 'package.json'));

    if (packageStats.isFile()) {
      result = currentPath;
    }
  } catch (error) {
    if (currentPath !== path.resolve('/')) {
      result = findProjectRoot(path.join(currentPath, '..'));
    }
  }

  return result;
}
1358368
function getProjectName(dir) {
    return fs.readFileAsync(path.join(dir, 'package.json'))
        .then(JSON.parse & _.name)
        .catchThrow(new Error('Failed to parse package.json from the project'));
}
800635
def fetch_pull_request_url(repo_slug, build_number, token)
      build_json = fetch_build(repo_slug, build_number, token)
      pull_requests = build_json[:pull_requests]
      return nil unless pull_requests.first
      pull_requests.first[:url]
    end
758139
function (project) {
  assert(project.id !== undefined, 'expected project.id to be defined')
  assert(project.gcloud !== undefined, 'expected project.gcloud to be defined')

  this.project = project
  this.gcloud = project.gcloud
  this.collection = collection('deployment', this.gcloud,
    ['deployment-manager', 'deployments'],
    '--project=' + this.project.id)
}