Class: TestProjectGenerator

Inherits:
Object
  • Object
show all
Defined in:
app/services/test_project_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user:, number:, project_prefix:) ⇒ TestProjectGenerator

Returns a new instance of TestProjectGenerator.



5
6
7
8
9
10
# File 'app/services/test_project_generator.rb', line 5

def initialize(user:, number:, project_prefix:)
  @user = user
  @number = number
  @sequence = number.to_s.rjust(5, "0")
  @project_prefix = project_prefix
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



3
4
5
# File 'app/services/test_project_generator.rb', line 3

def number
  @number
end

#project_prefixObject (readonly)

Returns the value of attribute project_prefix.



3
4
5
# File 'app/services/test_project_generator.rb', line 3

def project_prefix
  @project_prefix
end

#sequenceObject (readonly)

Returns the value of attribute sequence.



3
4
5
# File 'app/services/test_project_generator.rb', line 3

def sequence
  @sequence
end

#userObject (readonly)

Returns the value of attribute user.



3
4
5
# File 'app/services/test_project_generator.rb', line 3

def user
  @user
end

Instance Method Details

#generateObject



12
13
14
15
16
17
# File 'app/services/test_project_generator.rb', line 12

def generate
  project = create_project
  project.save_in_mediaflux(user: user)
  project.save!
  project
end