Class: Services::MdsPullAccountsController

Inherits:
ServiceBaseController show all
Includes:
StatusMasking
Defined in:
app/controllers/services/mds_pull_accounts_controller.rb

Constant Summary

Constants included from StatusMasking

StatusMasking::NEGATE_MASK, StatusMasking::STATUS_MASK

Constants inherited from ApplicationController

ApplicationController::MAX_LIST_LENGTH

Instance Attribute Summary collapse

Attributes inherited from ServiceBaseController

#service

Instance Method Summary collapse

Methods included from StatusMasking

#determine_status_operator

Instance Attribute Details

#configured_accountObject (readonly)

Returns the value of attribute configured_account.



6
7
8
# File 'app/controllers/services/mds_pull_accounts_controller.rb', line 6

def 
  @configured_account
end

#service_definitionObject (readonly)

Returns the value of attribute service_definition.



6
7
8
# File 'app/controllers/services/mds_pull_accounts_controller.rb', line 6

def service_definition
  @service_definition
end

Instance Method Details

#indexObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/services/mds_pull_accounts_controller.rb', line 11

def index
  status, operator = determine_status_operator(params[:status])

  if .present?

    @mds_pull_accounts = .mds_pull_accounts.
      order("created_at DESC").
      limit(MAX_LIST_LENGTH)

  elsif service_definition.present?

    @mds_pull_accounts = MdsPullAccount.
      joins(:configured_account).
      where("services_configured_accounts.service_definition_id" => service_definition.id).
      order("created_at DESC").
      limit(MAX_LIST_LENGTH)

  else

    @mds_pull_accounts = MdsPullAccount.
      joins(:configured_account, :service_definition).
      where("services_service_definitions.service_id" => service.id).
      order("created_at DESC").
      limit(MAX_LIST_LENGTH)

  end
  @mds_pull_accounts = @mds_pull_accounts.where("status #{operator} ?", status).order("created_at DESC").limit(MAX_LIST_LENGTH) if status.present?
end