Class: Resources::MdsPullAccount

Inherits:
BaseResource show all
Includes:
ConfiguredAccountPrompter, ServiceDefinitionPrompter, ServicePrompter
Defined in:
lib/pvdgm-svc-client/resources/mds_pull_account.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#options, #prompter

Instance Method Summary collapse

Methods included from ConfiguredAccountPrompter

#configured_account_id

Methods included from ServiceDefinitionPrompter

#service_definition_id

Methods included from ServicePrompter

#service_id

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from BaseResource

Instance Method Details

#listObject



8
9
10
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
# File 'lib/pvdgm-svc-client/resources/mds_pull_account.rb', line 8

def list
  result = nil
  sv_id = service_id
  sd_id = service_definition_id(true)
  if sd_id > 0
    ca_id = (true)
    if ca_id > 0
      result = get("services/services/#{sv_id}/service_definitions/#{sd_id}/configured_accounts/#{ca_id}/mds_pull_accounts#{status_prompt}")
    else
      result = get("services/services/#{sv_id}/service_definitions/#{sd_id}/mds_pull_accounts#{status_prompt}")
    end
  else
    result = get("services/services/#{sv_id}/mds_pull_accounts#{status_prompt}")
  end
  puts "\nMds Pull Accounts"
  table = Terminal::Table.new headings: [ 'CA Id', 'Account', 'Status', 'Attempt', 'Created', 'Updated' ] do |t|
    result.each do |  |
      t << [ ['configured_account_id'],
             "#{['account_name']} (#{['account_id']})",
             ['status'],
             ['attempt'],
             ['created_at'],
             ['updated_at'] ]
      
    end
  end
  prompter.say table.to_s
  puts
end

#status_promptObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/pvdgm-svc-client/resources/mds_pull_account.rb', line 38

def status_prompt
  puts 
  status = prompter.choose do | menu |
    menu.prompt = "Select the status to filter the results with: "
    menu.choice("Do not filter by status") { -1 }
    menu.choice("New") { 0 }
    menu.choice("Providers Identified") { 1 }
    menu.choice("Assessments Requested") { 2 }
    menu.choice("Files Identified") { 3 }
    menu.choice("Files Downloaded") { 4 }
    menu.choice("Submitted to abaqis") { 5 }
    menu.choice("File System Clean") { 6 }
    menu.choice("Remote Clean") { 7 }
    menu.choice("Not Remote Clean") { 0x17 }
  end
  status < 0 ? "" : "?status=#{status}"
end