Module: BWStatusBoardAPI::Client::Metrics

Includes:
Boards, Environments, Environments::Services, Helpers
Included in:
BWStatusBoardAPI::Client
Defined in:
lib/bw_status_board_api/client/metrics.rb

Overview

Metrics module

Instance Method Summary collapse

Methods included from Helpers

#filter

Methods included from Environments::Services

#create_service, #delete_service, #failing_services, #patch_service, #service, #services, #services_summary, #successful_services, #update_service

Methods included from Environments

#create_environment, #delete_environment, #environment, #environments, #environments_summary, #failing_environments, #partially_successful_environments, #patch_environment, #successful_environments, #update_environment

Methods included from Boards

#board, #boards, #boards_summary, #create_board, #delete_board, #patch_board, #update_board

Instance Method Details

#total_boardsInteger

Returns total boards

Returns:

  • (Integer)

    total



18
19
20
# File 'lib/bw_status_board_api/client/metrics.rb', line 18

def total_boards
  boards['results'].size
end

#total_environment_services(environment_id) ⇒ Integer

Returns total services for environment

Parameters:

  • environment_id (Integer)

    environment id

Returns:

  • (Integer)

    total



61
62
63
# File 'lib/bw_status_board_api/client/metrics.rb', line 61

def total_environment_services(environment_id)
  services(environment_id)['results'].size
end

#total_environmentsInteger

Returns total environments

Returns:

  • (Integer)

    total



25
26
27
# File 'lib/bw_status_board_api/client/metrics.rb', line 25

def total_environments
  environments['results'].size
end

#total_failing_environmentsInteger

Returns total failing environments

Returns:

  • (Integer)

    total



32
33
34
# File 'lib/bw_status_board_api/client/metrics.rb', line 32

def total_failing_environments
  filter(environments['results'], false, 'status', 'failure').size
end

#total_failing_servicesInteger

Returns total failing services

Returns:

  • (Integer)

    total



68
69
70
# File 'lib/bw_status_board_api/client/metrics.rb', line 68

def total_failing_services
  filter(all_services, false, 'status', 'failure').size
end

#total_partially_successful_environmentsInteger

Returns total partially successful environments

Returns:

  • (Integer)

    total



39
40
41
# File 'lib/bw_status_board_api/client/metrics.rb', line 39

def total_partially_successful_environments
  filter(environments['results'], false, 'status', 'partialSuccess').size
end

#total_servicesInteger

Returns total services

Returns:

  • (Integer)

    total



53
54
55
# File 'lib/bw_status_board_api/client/metrics.rb', line 53

def total_services
  environments['results'].map { |environment| environment['services'].size }.inject(:+)
end

#total_successful_environmentsInteger

Returns total successful environments

Returns:

  • (Integer)

    total



46
47
48
# File 'lib/bw_status_board_api/client/metrics.rb', line 46

def total_successful_environments
  filter(environments['results'], false, 'status', 'success').size
end

#total_successful_servicesInteger

Returns total successful services

Returns:

  • (Integer)

    total



75
76
77
# File 'lib/bw_status_board_api/client/metrics.rb', line 75

def total_successful_services
  filter(all_services, false, 'status', 'success').size
end