bw_status_board_api 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5e487fe194eb83bdcfb1a9bdc308caecf9003e3
4
- data.tar.gz: 5165623308736693ee65b76e37eade4fc1c4534f
3
+ metadata.gz: a835820c177cd4db36dd774de38c6b7fa6f8fb2f
4
+ data.tar.gz: be7d7de5bfab59891bdcad3dc5d7bf767ffb177c
5
5
  SHA512:
6
- metadata.gz: 68ba44ea521c74c9d9e4b11d85eac3bc93aeb19d7da9abc84b9b9049b9bbaeea5b3584ff83a738127cc571098c23deeadc3b51b2f3e21dfd841b5c433f259c7d
7
- data.tar.gz: ec3a688534b51212564567ed012f1b57c76d7811af5ff086909b129c769fe73a92199872aa3329f7cae4dbf846dfa81fdfa1ce39b1afed1636de2ce04afdaea9
6
+ metadata.gz: 67a4624d8996bbf22c081decc6463a7cb72b9dcaeb8eddb561af360f72cc6c636f5420054519ec23144b045ec10327ea01e07b19b2e7e52a662b7db186df0d80
7
+ data.tar.gz: e2afceac5ffbec1694e51e72ea09150f7e543d70e5f3b829cce0681554879dbe910a8179591e49ea8a63d4e77232cc66f9567659d9adb4fdd1c29dbf80f33db0
data/CHANGELOG.md CHANGED
@@ -1,15 +1,27 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## 2.0.0
5
+ ### Updated
6
+ * Updated endpoints following latest updates to status board api endpoints
7
+
8
+ ## 1.1.0
9
+ ### Added
10
+ * Added additional endpoints for boards, environments and services
11
+ * Added new metrics module for useful statistics
12
+
13
+ ### Fixed
14
+ * Fixed error.rb so messages returned from API are displayed
15
+
4
16
  ## 1.0.2
5
17
  ### Added
6
- * NoTask - added cops configuration to .rubocop.yml
7
- * NoTask - added Gemfile.lock to .gitignore
18
+ * Added cops configuration to .rubocop.yml
19
+ * Added Gemfile.lock to .gitignore
8
20
 
9
21
  ## 1.0.1
10
22
  ### Fixed
11
- * NoTask - fixed conflict with bwapi gem middleware
23
+ * Fixed conflict with bwapi gem middleware
12
24
 
13
25
  ## 1.0.0
14
26
  ### Added
15
- * NoTask - Initial version of the bw_status_board_api gem
27
+ * Initial version of the bw_status_board_api gem
@@ -10,16 +10,22 @@ module BWStatusBoardAPI
10
10
 
11
11
  # Get boards
12
12
  #
13
+ # @param opts [Hash] options hash of parameters
14
+ # @option opts [Integer] page the page
15
+ # @option opts [Integer] pageSize the page size
16
+ # @option opts [String] orderBy the parameter to order by
17
+ # @option opts [String] orderDirection the direction to order
18
+ # @option opts [String] fields the fields to return
13
19
  # @return [Hash] boards
14
- def boards
15
- get 'boards'
20
+ def boards(opts = {})
21
+ get 'boards', opts
16
22
  end
17
23
 
18
24
  # Returns boards name list
19
25
  #
20
26
  # @return [Array] environments
21
27
  def boards_summary
22
- filter(boards, true)
28
+ filter(boards['results'], true)
23
29
  end
24
30
 
25
31
  # Get board
@@ -10,17 +10,24 @@ module BWStatusBoardAPI
10
10
  # Get environment services
11
11
  #
12
12
  # @param environment_id [Integer] environment id
13
+ # @param opts [Hash] options hash of parameters
14
+ # @option opts [Integer] page the page
15
+ # @option opts [Integer] pageSize the page size
16
+ # @option opts [String] orderBy the parameter to order by
17
+ # @option opts [String] orderDirection the direction to order
18
+ # @option opts [String] fields the fields to return
13
19
  # @return [Hash] services
14
- def services(environment_id)
15
- get "environments/#{environment_id}/services"
20
+ def services(environment_id, opts = {})
21
+ get "environments/#{environment_id}/services", opts
16
22
  end
17
23
 
18
24
  # Returns services name list
19
25
  #
20
26
  # @param environment_id [Integer] environment id
27
+ # @param opts [Hash] options hash of parameters
21
28
  # @return [Array] the environments
22
29
  def services_summary(environment_id)
23
- filter(services(environment_id), true)
30
+ filter(services(environment_id)['results'], true)
24
31
  end
25
32
 
26
33
  # Get environment service
@@ -36,11 +43,15 @@ module BWStatusBoardAPI
36
43
  #
37
44
  # @param environment_id [Integer] environment id
38
45
  # @param opts [Hash] options hash of parameters
46
+ # @option opts [String] environment the id of the environment
39
47
  # @option opts [String] name name of the service
40
48
  # @option opts [String] shortName short name of the service
41
49
  # @option opts [String] status status of the service
42
50
  # @option opts [String] url url of the service
43
51
  # @option opts [Integer] successStatusCode success status code of the service
52
+ # @option opts [Boolean] slackNotify notify on slack flag
53
+ # @option opts [Array] slackUsersToNotify users to notify on status change
54
+ # @option opts [Array] slackChannelsToNotify channels to notify on status change
44
55
  # @option opts [Boolean] enabled service enabled flag
45
56
  # @return [Hash] service
46
57
  def create_service(environment_id, opts = {})
@@ -52,11 +63,15 @@ module BWStatusBoardAPI
52
63
  # @param environment_id [Integer] environment id
53
64
  # @param service_id [Integer] service id
54
65
  # @param opts [Hash] options hash of parameters
66
+ # @option opts [String] environment the id of the environment
55
67
  # @option opts [String] name name of the service
56
68
  # @option opts [String] shortName short name of the service
57
69
  # @option opts [String] status status of the service
58
70
  # @option opts [String] url url of the service
59
71
  # @option opts [Integer] successStatusCode success status code of the service
72
+ # @option opts [Boolean] slackNotify notify on slack flag
73
+ # @option opts [Array] slackUsersToNotify users to notify on status change
74
+ # @option opts [Array] slackChannelsToNotify channels to notify on status change
60
75
  # @option opts [Boolean] enabled service enabled flag
61
76
  # @return [Hash] service
62
77
  def update_service(environment_id, service_id, opts = {})
@@ -68,11 +83,15 @@ module BWStatusBoardAPI
68
83
  # @param environment_id [Integer] environment id
69
84
  # @param service_id [Integer] service id
70
85
  # @param opts [Hash] options hash of parameters
86
+ # @option opts [String] environment the id of the environment
71
87
  # @option opts [String] name name of the service
72
88
  # @option opts [String] shortName short name of the service
73
89
  # @option opts [String] status status of the service
74
90
  # @option opts [String] url url of the service
75
91
  # @option opts [Integer] successStatusCode success status code of the service
92
+ # @option opts [Boolean] slackNotify notify on slack flag
93
+ # @option opts [Array] slackUsersToNotify users to notify on status change
94
+ # @option opts [Array] slackChannelsToNotify channels to notify on status change
76
95
  # @option opts [Boolean] enabled service enabled flag
77
96
  # @return [Hash] service
78
97
  def patch_service(environment_id, service_id, opts = {})
@@ -94,7 +113,7 @@ module BWStatusBoardAPI
94
113
  # @param summary [Boolean] summary flag
95
114
  # @return [Array] services
96
115
  def failing_services(environment_id, summary = true)
97
- filter(services(environment_id), summary, 'status', 'failure')
116
+ filter(services(environment_id)['results'], summary, 'status', 'failure')
98
117
  end
99
118
 
100
119
  # Returns successful services for environment
@@ -103,7 +122,7 @@ module BWStatusBoardAPI
103
122
  # @param summary [Boolean] summary flag
104
123
  # @return [Array] services
105
124
  def successful_services(environment_id, summary = true)
106
- filter(services(environment_id), summary, 'status', 'success')
125
+ filter(services(environment_id)['results'], summary, 'status', 'success')
107
126
  end
108
127
  end
109
128
  end
@@ -10,16 +10,22 @@ module BWStatusBoardAPI
10
10
 
11
11
  # Get environments
12
12
  #
13
+ # @param opts [Hash] options hash of parameters
14
+ # @option opts [Integer] page the page
15
+ # @option opts [Integer] pageSize the page size
16
+ # @option opts [String] orderBy the parameter to order by
17
+ # @option opts [String] orderDirection the direction to order
18
+ # @option opts [String] fields the fields to return
13
19
  # @return [Hash] environments
14
- def environments
15
- get 'environments'
20
+ def environments(opts = {})
21
+ get 'environments', opts
16
22
  end
17
23
 
18
24
  # Returns environments name list
19
25
  #
20
26
  # @return [Array] environments
21
27
  def environments_summary
22
- filter(environments, true)
28
+ filter(environments['results'], true)
23
29
  end
24
30
 
25
31
  # Get environment
@@ -37,6 +43,9 @@ module BWStatusBoardAPI
37
43
  # @option opts [String] shortName short name of the environment
38
44
  # @option opts [Array] services services within the board
39
45
  # @option opts [String] status status of the environment
46
+ # @option opts [Boolean] slackNotify notify on slack flag
47
+ # @option opts [Array] slackUsersToNotify users to notify on status change
48
+ # @option opts [Array] slackChannelsToNotify channels to notify on status change
40
49
  # @option opts [Boolean] enabled environment enabled flag
41
50
  # @return [Hash] environment
42
51
  def create_environment(opts = {})
@@ -51,6 +60,9 @@ module BWStatusBoardAPI
51
60
  # @option opts [String] shortName short name of the environment
52
61
  # @option opts [Array] services services within the board
53
62
  # @option opts [String] status status of the environment
63
+ # @option opts [Boolean] slackNotify notify on slack flag
64
+ # @option opts [Array] slackUsersToNotify users to notify on status change
65
+ # @option opts [Array] slackChannelsToNotify channels to notify on status change
54
66
  # @option opts [Boolean] enabled environment enabled flag
55
67
  # @return [Hash] environment
56
68
  def update_environment(environment_id, opts = {})
@@ -65,6 +77,9 @@ module BWStatusBoardAPI
65
77
  # @option opts [String] shortName short name of the environment
66
78
  # @option opts [Array] services services within the board
67
79
  # @option opts [String] status status of the environment
80
+ # @option opts [Boolean] slackNotify notify on slack flag
81
+ # @option opts [Array] slackUsersToNotify users to notify on status change
82
+ # @option opts [Array] slackChannelsToNotify channels to notify on status change
68
83
  # @option opts [Boolean] enabled environment enabled flag
69
84
  # @return [Hash] environment
70
85
  def patch_environment(environment_id, opts = {})
@@ -84,7 +99,7 @@ module BWStatusBoardAPI
84
99
  # @param summary [Boolean] summary flag
85
100
  # @return [Array] environments
86
101
  def failing_environments(summary = true)
87
- filter(environments, summary, 'status', 'failure')
102
+ filter(environments['results'], summary, 'status', 'failure')
88
103
  end
89
104
 
90
105
  # Returns partially successful environments
@@ -92,7 +107,7 @@ module BWStatusBoardAPI
92
107
  # @param summary [Boolean] summary flag
93
108
  # @return [Array] environments
94
109
  def partially_successful_environments(summary = true)
95
- filter(environments, summary, 'status', 'partialSuccess')
110
+ filter(environments['results'], summary, 'status', 'partialSuccess')
96
111
  end
97
112
 
98
113
  # Returns successful environments
@@ -100,7 +115,7 @@ module BWStatusBoardAPI
100
115
  # @param summary [Boolean] summary flag
101
116
  # @return [Array] environments
102
117
  def successful_environments(summary = true)
103
- filter(environments, summary, 'status', 'success')
118
+ filter(environments['results'], summary, 'status', 'success')
104
119
  end
105
120
  end
106
121
  end
@@ -16,42 +16,42 @@ module BWStatusBoardAPI
16
16
  #
17
17
  # @return [Integer] total
18
18
  def total_boards
19
- boards.size
19
+ boards['results'].size
20
20
  end
21
21
 
22
22
  # Returns total environments
23
23
  #
24
24
  # @return [Integer] total
25
25
  def total_environments
26
- environments.size
26
+ environments['results'].size
27
27
  end
28
28
 
29
29
  # Returns total failing environments
30
30
  #
31
31
  # @return [Integer] total
32
32
  def total_failing_environments
33
- filter(environments, false, 'status', 'failure').size
33
+ filter(environments['results'], false, 'status', 'failure').size
34
34
  end
35
35
 
36
36
  # Returns total partially successful environments
37
37
  #
38
38
  # @return [Integer] total
39
39
  def total_partially_successful_environments
40
- filter(environments, false, 'status', 'partialSuccess').size
40
+ filter(environments['results'], false, 'status', 'partialSuccess').size
41
41
  end
42
42
 
43
43
  # Returns total successful environments
44
44
  #
45
45
  # @return [Integer] total
46
46
  def total_successful_environments
47
- filter(environments, false, 'status', 'success').size
47
+ filter(environments['results'], false, 'status', 'success').size
48
48
  end
49
49
 
50
50
  # Returns total services
51
51
  #
52
52
  # @return [Integer] total
53
53
  def total_services
54
- environments.map { |environment| environment['services'].size }.inject(:+)
54
+ environments['results'].map { |environment| environment['services'].size }.inject(:+)
55
55
  end
56
56
 
57
57
  # Returns total services for environment
@@ -59,7 +59,7 @@ module BWStatusBoardAPI
59
59
  # @param environment_id [Integer] environment id
60
60
  # @return [Integer] total
61
61
  def total_environment_services(environment_id)
62
- services(environment_id).size
62
+ services(environment_id)['results'].size
63
63
  end
64
64
 
65
65
  # Returns total failing services
@@ -79,7 +79,7 @@ module BWStatusBoardAPI
79
79
  private
80
80
 
81
81
  def all_services
82
- environments.map { |environment| environment['services'] }.flatten
82
+ environments['results'].map { |environment| environment['services'] }.flatten
83
83
  end
84
84
  end
85
85
  end
@@ -1,4 +1,4 @@
1
1
  # BW Version
2
2
  module BWStatusBoardAPI
3
- VERSION = '1.1.0'
3
+ VERSION = '2.0.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bw_status_board_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Chrisp
@@ -170,4 +170,3 @@ summary: Brandwatch Status Board API Wrapper
170
170
  test_files:
171
171
  - spec/bw_status_board_api_spec.rb
172
172
  - spec/helper.rb
173
- has_rdoc: