Class: ProjectReport

Inherits:
Domain::Model show all
Defined in:
lib/domain/project/model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::Model

columns, from_csv, from_json, headers, table_name, #to_csv, #to_hash, #to_s, view

Constructor Details

#initialize(attributes = {}) ⇒ ProjectReport

Returns a new instance of ProjectReport.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/domain/project/model.rb', line 31

def initialize(attributes = {})
  remapped_attributes = attributes.transform_keys do |key|
    case key
    when 'report_id' then 'id'
    when 'report_name' then 'name'
    when 'report_description' then 'description'
    when 'report_filename' then 'file_name'
    when 'report_status' then 'status'
    when 'created_date' then 'created_on'
    when 'created_user_firstname' then 'created_by_first_name'
    when 'created_user_lastname' then 'created_by_last_name'
    else key # For all other keys that do not need remapping
    end
  end
  super(remapped_attributes) # Call the superclass's initialize method
end

Instance Attribute Details

#created_by_first_nameObject

Returns the value of attribute created_by_first_name.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def created_by_first_name
  @created_by_first_name
end

#created_by_last_nameObject

Returns the value of attribute created_by_last_name.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def created_by_last_name
  @created_by_last_name
end

#created_onObject

Returns the value of attribute created_on.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def created_on
  @created_on
end

#descriptionObject

Returns the value of attribute description.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def description
  @description
end

#file_nameObject

Returns the value of attribute file_name.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def file_name
  @file_name
end

#idObject

Returns the value of attribute id.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def id
  @id
end

#nameObject

Returns the value of attribute name.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def name
  @name
end

#project_idObject

Returns the value of attribute project_id.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def project_id
  @project_id
end

#statusObject

Returns the value of attribute status.



28
29
30
# File 'lib/domain/project/model.rb', line 28

def status
  @status
end

Class Method Details

.primary_keyObject



48
49
50
# File 'lib/domain/project/model.rb', line 48

def self.primary_key
  %w[id project_id]
end

.url_path(id) ⇒ Object



52
53
54
# File 'lib/domain/project/model.rb', line 52

def self.url_path(id)
  "/projects/#{id}/reports"
end