Commit c9b39d89082b8f446e40c0068b14724561326cf7

Authored by João M. M. da Silva + Alessandro Palmeira + Diego Araújo + Caio Salgado
Committed by Paulo Meireles
1 parent abb1881f

[Mezuro] Added more methods to project.rb

Showing 1 changed file with 19 additions and 1 deletions   Show diff stats
plugins/mezuro/lib/kalibro/project.rb
1 1 class Kalibro::Project < Kalibro::Model
  2 +
2 3 attr_accessor :name, :license, :description, :repository, :configuration_name, :state, :error
3 4  
4 5 def self.all_names
... ... @@ -10,6 +11,23 @@ class Kalibro::Project &lt; Kalibro::Model
10 11 new attributes
11 12 end
12 13  
  14 + def self.destroy(project_name)
  15 + request(:remove_project, {:project_name => project_name})
  16 + end
  17 +
  18 + def self.create (content)
  19 + new({
  20 + :name => content.name,
  21 + :license => content.license,
  22 + :description => content.description,
  23 + :repository => {
  24 + :type => content.repository_type,
  25 + :address => content.repository_url
  26 + },
  27 + :configuration_name => content.configuration_name
  28 + })
  29 + end
  30 +
13 31 def save
14 32 self.class.request(:save_project, {:project => to_hash})
15 33 end
... ... @@ -17,7 +35,7 @@ class Kalibro::Project &lt; Kalibro::Model
17 35 def repository=(value)
18 36 @repository = (value.kind_of?(Hash)) ? Kalibro::Repository.new(value) : value
19 37 end
20   -
  38 +
21 39 private
22 40  
23 41 def self.client
... ...