Module: BWStatusBoardAPI::Client::Environments

Includes:
Services, Helpers
Included in:
BWStatusBoardAPI::Client, Metrics
Defined in:
lib/bw_status_board_api/client/environments.rb,
lib/bw_status_board_api/client/environments/services.rb

Overview

Environments module for environments endpoints

Defined Under Namespace

Modules: Services

Instance Method Summary collapse

Methods included from Services

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

Methods included from Helpers

#filter

Instance Method Details

#create_environment(opts = {}) ⇒ Hash

Create environment

Parameters:

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • name (String)

    name of the environment

  • shortName (String)

    short name of the environment

  • services (Array)

    services within the board

  • status (String)

    status of the environment

  • slackNotify (Boolean)

    notify on slack flag

  • slackUsersToNotify (Array)

    users to notify on status change

  • slackChannelsToNotify (Array)

    channels to notify on status change

  • enabled (Boolean)

    environment enabled flag

Returns:

  • (Hash)

    environment



51
52
53
# File 'lib/bw_status_board_api/client/environments.rb', line 51

def create_environment(opts = {})
  post 'environments', opts
end

#delete_environment(environment_id) ⇒ Hash

Delete environment

Parameters:

  • environment_id (Integer)

    environment id

Returns:

  • (Hash)

    environment



93
94
95
# File 'lib/bw_status_board_api/client/environments.rb', line 93

def delete_environment(environment_id)
  delete "environments/#{environment_id}"
end

#environment(environment_id) ⇒ Hash

Get environment

Parameters:

  • environment_id (Integer)

    environment id

Returns:

  • (Hash)

    environment



35
36
37
# File 'lib/bw_status_board_api/client/environments.rb', line 35

def environment(environment_id)
  get "environments/#{environment_id}"
end

#environments(opts = {}) ⇒ Hash

Get environments

Parameters:

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • page (Integer)

    the page

  • pageSize (Integer)

    the page size

  • orderBy (String)

    the parameter to order by

  • orderDirection (String)

    the direction to order

  • fields (String)

    the fields to return

Returns:

  • (Hash)

    environments



20
21
22
# File 'lib/bw_status_board_api/client/environments.rb', line 20

def environments(opts = {})
  get 'environments', opts
end

#environments_summaryArray

Returns environments name list

Returns:

  • (Array)

    environments



27
28
29
# File 'lib/bw_status_board_api/client/environments.rb', line 27

def environments_summary
  filter(environments['results'], true)
end

#failing_environments(summary = true) ⇒ Array

Returns failing environments

Parameters:

  • summary (Boolean) (defaults to: true)

    summary flag

Returns:

  • (Array)

    environments



101
102
103
# File 'lib/bw_status_board_api/client/environments.rb', line 101

def failing_environments(summary = true)
  filter(environments['results'], summary, 'status', 'failure')
end

#partially_successful_environments(summary = true) ⇒ Array

Returns partially successful environments

Parameters:

  • summary (Boolean) (defaults to: true)

    summary flag

Returns:

  • (Array)

    environments



109
110
111
# File 'lib/bw_status_board_api/client/environments.rb', line 109

def partially_successful_environments(summary = true)
  filter(environments['results'], summary, 'status', 'partialSuccess')
end

#patch_environment(environment_id, opts = {}) ⇒ Hash

Patch environment

Parameters:

  • environment_id (Integer)

    environment id

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • name (String)

    name of the environment

  • shortName (String)

    short name of the environment

  • services (Array)

    services within the board

  • status (String)

    status of the environment

  • slackNotify (Boolean)

    notify on slack flag

  • slackUsersToNotify (Array)

    users to notify on status change

  • slackChannelsToNotify (Array)

    channels to notify on status change

  • enabled (Boolean)

    environment enabled flag

Returns:

  • (Hash)

    environment



85
86
87
# File 'lib/bw_status_board_api/client/environments.rb', line 85

def patch_environment(environment_id, opts = {})
  patch "environments/#{environment_id}", opts
end

#successful_environments(summary = true) ⇒ Array

Returns successful environments

Parameters:

  • summary (Boolean) (defaults to: true)

    summary flag

Returns:

  • (Array)

    environments



117
118
119
# File 'lib/bw_status_board_api/client/environments.rb', line 117

def successful_environments(summary = true)
  filter(environments['results'], summary, 'status', 'success')
end

#update_environment(environment_id, opts = {}) ⇒ Hash

Update environment

Parameters:

  • environment_id (Integer)

    environment id

  • opts (Hash) (defaults to: {})

    options hash of parameters

Options Hash (opts):

  • name (String)

    name of the environment

  • shortName (String)

    short name of the environment

  • services (Array)

    services within the board

  • status (String)

    status of the environment

  • slackNotify (Boolean)

    notify on slack flag

  • slackUsersToNotify (Array)

    users to notify on status change

  • slackChannelsToNotify (Array)

    channels to notify on status change

  • enabled (Boolean)

    environment enabled flag

Returns:

  • (Hash)

    environment



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

def update_environment(environment_id, opts = {})
  put "environments/#{environment_id}", opts
end