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

Inherits:
Object
  • Object
show all
Extended by:
ConnectionHelper
Defined in:
api/sources/project.rb

Overview

Class that connect to endpoints related to projects

Class Method Summary collapse

Class Method Details

.attributes(project, revision) ⇒ String

Returns the attributes for the project

Parameters:

  • project (String)

    Name of the project.

  • revision (String)

    Revision hash/number.

Returns:

  • (String)

    The XML with the attributes content



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

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

.key_info(project) ⇒ String

Returns the KeyInfo file for the project

Parameters:

  • project (String)

    Name of the project.

Returns:

  • (String)

    The key info file content



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

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

.meta(project, options = {}) ⇒ String

Returns the meta file from a project

Parameters:

  • project (String)

    Name of the project.

  • 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)

    The meta file content



39
40
41
# File 'api/sources/project.rb', line 39

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

.move(source, target) ⇒ String

Moves the source project to the target

Parameters:

  • source (String)

    Name of the source project.

  • target (String)

    Name of the target project.

Returns:

  • (String)


69
70
71
# File 'api/sources/project.rb', line 69

def self.move(source, target)
  post(["/source/:project", target], params: { cmd: :move, oproject: source })
end

.patchinfo(project) ⇒ String

Returns the patchinfo for the project

Parameters:

  • project (String)

    Name of the project.

Returns:

  • (String)

    The patchinfo file content



61
62
63
# File 'api/sources/project.rb', line 61

def self.patchinfo(project)
  get(["/source/:project/_patchinfo", project])
end

.revisions(project) ⇒ String

Returns the revisions (mrev) list for a project

Parameters:

  • project (String)

    Name of the project.

Returns:

  • (String)

    The XML with the revisions list



30
31
32
# File 'api/sources/project.rb', line 30

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

.write_attributes(project, user, content, comment) ⇒ String

Writes the xml for attributes

Parameters:

  • project (String)

    Name of the project.

Returns:

  • (String)


21
22
23
24
25
# File 'api/sources/project.rb', line 21

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

.write_configuration(project, configuration) ⇒ String

Writes a Project configuration

Parameters:

  • project (String)

    Name of the project.

  • configuration (String)

    The content to write in the configuration.

Returns:

  • (String)


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

def self.write_configuration(project, configuration)
  put(["/source/:project/_config", project], data: configuration)
end