Class: KalibroGatekeeperClient::Entities::Repository

Inherits:
Model
  • Object
show all
Defined in:
lib/kalibro_gatekeeper_client/entities/repository.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#kalibro_errors

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#==, create, create_array_from_hash, create_objects_array_from_hash, #destroy, #initialize, request, #save, #save!, #to_hash, to_object, to_objects_array

Methods included from RequestMethods::ClassMethods

#exists_action, #find_action, #id_params

Methods included from HashConverters

#convert_to_hash, #date_with_milliseconds, #field_to_hash

Methods included from XMLConverters

#get_xml, #xml_instance_class_name

Methods included from RequestMethods

#destroy_action, #destroy_params, #save_action

Constructor Details

This class inherits a constructor from KalibroGatekeeperClient::Entities::Model

Instance Attribute Details

#addressObject

Returns the value of attribute address.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def address
  @address
end

#configuration_idObject

Returns the value of attribute configuration_id.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def configuration_id
  @configuration_id
end

#descriptionObject

Returns the value of attribute description.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def description
  @description
end

#idObject

Returns the value of attribute id.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def id
  @id
end

#licenseObject

Returns the value of attribute license.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def license
  @license
end

#nameObject

Returns the value of attribute name.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def name
  @name
end

#process_periodObject

Returns the value of attribute process_period.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def process_period
  @process_period
end

#project_idObject

Returns the value of attribute project_id.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def project_id
  @project_id
end

#send_emailObject

Returns the value of attribute send_email.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def send_email
  @send_email
end

#typeObject

Returns the value of attribute type.



23
24
25
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 23

def type
  @type
end

Class Method Details

.allObject



57
58
59
60
61
62
63
64
65
66
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 57

def self.all
  projects = Project.all
  repositories = []

  projects.each do |project|
    repositories.concat(repositories_of(project.id))
  end

  return repositories
end

.exists?(id) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
77
78
79
80
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 74

def self.exists?(id)
  begin
    return true unless find(id).nil?
  rescue KalibroGatekeeperClient::Errors::RecordNotFound
    return false
  end
end

.find(id) ⇒ Object



68
69
70
71
72
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 68

def self.find(id)
  all.each { |repository| return repository if repository.id == id }

  raise KalibroGatekeeperClient::Errors::RecordNotFound
end

.repositories_of(project_id) ⇒ Object



29
30
31
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 29

def self.repositories_of(project_id)
  repositories = create_objects_array_from_hash request('of', {project_id: project_id})['repositories']
end

.repository_typesObject



25
26
27
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 25

def self.repository_types
  request('supported_types', {}, :get)['supported_types'].to_a
end

Instance Method Details

#cancel_processing_of_repositoryObject



53
54
55
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 53

def cancel_processing_of_repository
  self.class.request('cancel_process', {id: self.id})
end

#processObject



49
50
51
# File 'lib/kalibro_gatekeeper_client/entities/repository.rb', line 49

def process
  self.class.request('process', {id: self.id})
end