Class: Backend::Api::Sources::Project — Documentation by YARD 0.9.12

# Class: Backend::Api::Sources::Project

Inherits:
  Object
  - Object
  - Backend::Api::Sources::Project
  show all

Extended by:
  ConnectionHelper

Defined in:
  api/sources/project.rb

## Overview

Class that connect to endpoints related to projects

## Class Method Summary collapse

- .attributes(project_name, revision) ⇒ String

  Returns the attributes for the project.

- .commit(project_name, user_login, options = {}) ⇒ Object

  Commits the request for the project.

- .delete(project_name) ⇒ Object

  Deletes the project and all the packages inside.

- .key_info(project_name) ⇒ String

  Returns the KeyInfo file for the project.

- .list ⇒ Object

  Returns the list of projects.

- .meta(project_name, options = {}) ⇒ String

  Returns the meta file from a project.

- .move(source_project_name, target_project_name) ⇒ String

  Moves the source project to the target.

- .packages(project_name) ⇒ Object

  Returns the list of packages inside the project.

- .patchinfo(project_name) ⇒ String

  Returns the patchinfo for the project.

- .revisions(project_name) ⇒ String

  Returns the revisions (mrev) list for a project.

- .write_attributes(project_name, user_login, content, comment) ⇒ String

  Writes the xml for attributes.

- .write_configuration(project_name, configuration) ⇒ String

  Writes a Project configuration.

- .write_meta(project_name, meta, options = {}) ⇒ String

  Writes a Project meta.

## Class Method Details

### .attributes(project_name, revision) ⇒ `String`

Returns the attributes for the project

Parameters:

- revision (`String`) —

  Revision hash/number.

Returns:

- (`String`)

    11
    12
    13
    14
    15
    # File 'api/sources/project.rb', line 11

    def self.attributes(project_name, revision)
      params = { meta: 1 }
      params[:rev] = revision if revision
      http_get(['/source/:project/_project/_attribute', project_name], params: params)
    end

### .commit(project_name, user_login, options = {}) ⇒ `Object`

Commits the request for the project

    70
    71
    72
    73
    74
    # File 'api/sources/project.rb', line 70

    def self.commit(project_name, user_login, options = {})
      http_post(['/source/:project/_project', project_name],
                defaults: { cmd: :commit, user: user_login },
                params: options, accepted: [:requestid, :rev, :comment])
    end

### .delete(project_name) ⇒ `Object`

Deletes the project and all the packages inside

    87
    88
    89
    # File 'api/sources/project.rb', line 87

    def self.delete(project_name)
      http_delete(['/source/:project', project_name])
    end

### .key_info(project_name) ⇒ `String`

Returns the KeyInfo file for the project

Returns:

- (`String`)

    53
    54
    55
    # File 'api/sources/project.rb', line 53

    def self.key_info(project_name)
      http_get(['/source/:project/_keyinfo', project_name], params: { withsslcert: 1, donotcreatecert: 1 })
    end

### .list ⇒ `Object`

Returns the list of projects

    82
    83
    84
    # File 'api/sources/project.rb', line 82

    def self.list
      http_get('/source')
    end

### .meta(project_name, options = {}) ⇒ `String`

Returns the meta file from a project

Parameters:

- options (`Hash`) (defaults to: `{}`) —

  a customizable set of options

Options Hash (`options`):

- :revision (`String`) —

  Revision hash/number.

- :deleted (`Integer / String`) —

  Search also on deleted projects (Needs to be a 1).

Returns:

- (`String`)

    35
    36
    37
    # File 'api/sources/project.rb', line 35

    def self.meta(project_name, options = {})
      http_get(['/source/:project/_project/_meta', project_name], params: options, accepted: [:revision, :deleted], rename: { revision: :rev })
    end

### .move(source_project_name, target_project_name) ⇒ `String`

Moves the source project to the target

Returns:

- (`String`)

    65
    66
    67
    # File 'api/sources/project.rb', line 65

    def self.move(source_project_name, target_project_name)
      http_post(['/source/:project', target_project_name], params: { cmd: :move, oproject: source_project_name })
    end

### .packages(project_name) ⇒ `Object`

Returns the list of packages inside the project

    77
    78
    79
    # File 'api/sources/project.rb', line 77

    def self.packages(project_name)
      http_get(['/source/:project', project_name])
    end

### .patchinfo(project_name) ⇒ `String`

Returns the patchinfo for the project

Returns:

- (`String`)

    59
    60
    61
    # File 'api/sources/project.rb', line 59

    def self.patchinfo(project_name)
      http_get(['/source/:project/_patchinfo', project_name])
    end

### .revisions(project_name) ⇒ `String`

Returns the revisions (mrev) list for a project

Returns:

- (`String`)

    27
    28
    29
    # File 'api/sources/project.rb', line 27

    def self.revisions(project_name)
      http_get(['/source/:project/_project/_history', project_name], params: { meta: 1, deleted: 1 })
    end

### .write_attributes(project_name, user_login, content, comment) ⇒ `String`

Writes the xml for attributes

Returns:

- (`String`)

    19
    20
    21
    22
    23
    # File 'api/sources/project.rb', line 19

    def self.write_attributes(project_name, user_login, content, comment)
      params = { meta: 1, user: user_login }
      params[:comment] = comment if comment
      http_put(['/source/:project/_project/_attribute', project_name], data: content, params: params)
    end

### .write_configuration(project_name, configuration) ⇒ `String`

Writes a Project configuration

Returns:

- (`String`)

    47
    48
    49
    # File 'api/sources/project.rb', line 47

    def self.write_configuration(project_name, configuration)
      http_put(['/source/:project/_config', project_name], data: configuration)
    end

### .write_meta(project_name, meta, options = {}) ⇒ `String`

Writes a Project meta

Returns:

- (`String`)

    41
    42
    43
    # File 'api/sources/project.rb', line 41

    def self.write_meta(project_name, meta, options = {})
      http_put(['/source/:project/_meta', project_name], data: meta, params: options, accepted: [:user, :comment, :requestid, :lowprio])
    end