Class: DeploymentsFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/deployments_finder.rb

Constant Summary collapse

ALLOWED_SORT_VALUES =
%w[id iid created_at updated_at ref].freeze
DEFAULT_SORT_VALUE =
'id'.freeze
ALLOWED_SORT_DIRECTIONS =
%w[asc desc].freeze
DEFAULT_SORT_DIRECTION =
'asc'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, params = {}) ⇒ DeploymentsFinder

Returns a new instance of DeploymentsFinder.


12
13
14
15
# File 'app/finders/deployments_finder.rb', line 12

def initialize(project, params = {})
  @project = project
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params


4
5
6
# File 'app/finders/deployments_finder.rb', line 4

def params
  @params
end

#projectObject (readonly)

Returns the value of attribute project


4
5
6
# File 'app/finders/deployments_finder.rb', line 4

def project
  @project
end

Instance Method Details

#executeObject


17
18
19
20
21
22
23
# File 'app/finders/deployments_finder.rb', line 17

def execute
  items = init_collection
  items = by_updated_at(items)
  items = by_environment(items)
  items = by_status(items)
  sort(items)
end