cased-ruby 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3404d2c5e8385e78dfd4a65f7cfc8a2f6554271a782cb693b19f11ad49c9bd97
4
- data.tar.gz: 0f181045afaef98ccf76a78b7622b48d0d9d325dbe11ac8d57c052db646a3124
3
+ metadata.gz: a98d48b740d571c68ad950fe60ecd5af5126fa9567b80030c50bc9cf3f7428c3
4
+ data.tar.gz: b1fdbda8126943f5421176269d42d60144425790c22d57179abe6cf892e99cb6
5
5
  SHA512:
6
- metadata.gz: ad8b59c1a598c4e131207fdec357059511446924f2606a198cc3a55f438d8ad4f777e4b1a372c6bb20a31270ea305f39ec90b590505ee5f387f3dc7e69574b3b
7
- data.tar.gz: e492c1719d7a3fac650830d93a11735a0474852c790db6f503621eedff135c4ba5f4aae5bafffb344f12ea5cb18355a97b79dc83fa68db1cf988c211e090dc4b
6
+ metadata.gz: b519bd5dac037cc8ae8c5e795f44d658f44f44ad879e0456e1368dd18378323e5e9f4c8c8ea2e23a12958c4acc7c4c78a0b18afc95a57b6b78be8fe535bbfb0a
7
+ data.tar.gz: 9ce3b66f202ea6b431ae70d28cc4c22327eb4c5b25ac100a320a733964d91c08b139ecc75fbf4a5932f3603cc796983b9a9de39d68a80c54c80ada772bc7f3c3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cased-ruby (0.4.5)
4
+ cased-ruby (0.4.6)
5
5
  activesupport (~> 6)
6
6
  dotpath (= 0.1.0)
7
7
  faraday (~> 1.0)
@@ -38,7 +38,7 @@ GEM
38
38
  faraday_middleware (1.0.0)
39
39
  faraday (~> 1.0)
40
40
  hashdiff (1.0.1)
41
- i18n (1.8.9)
41
+ i18n (1.8.10)
42
42
  concurrent-ruby (~> 1.0)
43
43
  jaro_winkler (1.5.4)
44
44
  json (2.5.1)
data/README.md CHANGED
@@ -9,6 +9,7 @@ A Cased client for Ruby applications in your organization to control and monitor
9
9
  - [Usage](#usage)
10
10
  - [Cased CLI](#cased-cli)
11
11
  - [Starting an approval workflow](#starting-an-approval-workflow)
12
+ - [Attaching metadata to all CLI requests](#attaching-metadata-to-all-cli-requests)
12
13
  - [Audit trails](#audit-trails)
13
14
  - [Publishing events to Cased](#publishing-events-to-cased)
14
15
  - [Retrieving events from a Cased audit trail](#retrieving-events-from-a-cased-audit-trail)
@@ -85,6 +86,17 @@ Cased.configure do |config|
85
86
 
86
87
  # CASED_HTTP_READ_TIMEOUT=10
87
88
  config.http_read_timeout = 10
89
+
90
+ # Attach metadata to all CLI requests. This metadata will appear in Cased and
91
+ # any notification source such as email or Slack.
92
+ #
93
+ # You are limited to 20 properties and cannot be a nested dictionary. Metadata
94
+ # specified in the CLI request overrides any configured globally.
95
+ config.cli.metadata = {
96
+ rails_env: ENV['RAILS_ENV'],
97
+ heroku_application: ENV['HEROKU_APP_NAME'],
98
+ git_commit: ENV['GIT_COMMIT'],
99
+ }
88
100
  end
89
101
  ```
90
102
 
@@ -181,6 +193,27 @@ You no longer need to handle obtaining the user token or asking for a reason up
181
193
  front, `Cased::CLI::InteractiveSession` will prompt the user for any reason
182
194
  being required as necessary.
183
195
 
196
+ #### Attaching metadata to all CLI requests
197
+
198
+ While you can customize the metadata included for each CLI request, it may prove
199
+ useful to specify metadata globally that will be included with each CLI request.
200
+ Some useful information to include may be the current Rails environment, Heroku
201
+ application, Git commit deployed, and more.
202
+
203
+ Metadata is limited to 20 properties and cannot be a nested dictionary.
204
+
205
+ ```ruby
206
+ Cased.configure do |config|
207
+ config.cli.metadata = {
208
+ rails_env: ENV['RAILS_ENV'],
209
+ heroku_application: ENV['HEROKU_APP_NAME'],
210
+ git_commit: ENV['GIT_COMMIT'],
211
+ }
212
+ end
213
+ ```
214
+
215
+ Note: Metadata specified in the CLI request overrides any configured globally.
216
+
184
217
  ### Audit trails
185
218
 
186
219
  #### Publishing events to Cased
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cased
4
+ module CLI
5
+ class Config
6
+ # @example
7
+ # Cased.configure do |config|
8
+ # config.cli.metadata = {
9
+ # rails_env: ENV['RAILS_ENV'],
10
+ # heroku_application: ENV['HEROKU_APP_NAME'],
11
+ # git_commit: ENV['GIT_COMMIT'],
12
+ # }
13
+ # end
14
+ attr_accessor :metadata
15
+
16
+ def initialize
17
+ @metadata = {}
18
+ end
19
+ end
20
+ end
21
+ end
@@ -128,7 +128,7 @@ module Cased
128
128
  @authentication = authentication || Cased::CLI::Authentication.new
129
129
  @reason = reason
130
130
  @command = command || [$PROGRAM_NAME, *ARGV].join(' ')
131
- @metadata = metadata
131
+ @metadata = Cased.config.cli.metadata.merge(metadata)
132
132
  @requester = {}
133
133
  @responder = {}
134
134
  @guard_application = {}
data/lib/cased/config.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cased/cli/config'
4
+
3
5
  module Cased
4
6
  class Config
5
7
  # The amount of time in seconds to allow the HTTP client to open a
@@ -149,6 +151,16 @@ module Cased
149
151
  # end
150
152
  attr_writer :silence
151
153
 
154
+ # @example
155
+ # Cased.configure do |config|
156
+ # config.cli.metadata = {
157
+ # rails_env: ENV['RAILS_ENV'],
158
+ # heroku_application: ENV['HEROKU_APP_NAME'],
159
+ # git_commit: ENV['GIT_COMMIT'],
160
+ # }
161
+ # end
162
+ attr_reader :cli
163
+
152
164
  def initialize
153
165
  @http_read_timeout = ENV.fetch('CASED_HTTP_READ_TIMEOUT', 10).to_i
154
166
  @http_open_timeout = ENV.fetch('CASED_HTTP_OPEN_TIMEOUT', 5).to_i
@@ -172,6 +184,7 @@ module Cased
172
184
  hash[normalized_key] = api_key if api_key
173
185
  end
174
186
  end
187
+ @cli = Cased::CLI::Config.new
175
188
  end
176
189
 
177
190
  # Policy keys are used to query for events from audit trails.
data/lib/cased/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cased
4
- VERSION = '0.4.5'
4
+ VERSION = '0.4.6'
5
5
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cased-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garrett Bjerkhoel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-26 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -305,6 +305,7 @@ files:
305
305
  - lib/cased/cli/asciinema/file.rb
306
306
  - lib/cased/cli/asciinema/writer.rb
307
307
  - lib/cased/cli/authentication.rb
308
+ - lib/cased/cli/config.rb
308
309
  - lib/cased/cli/identity.rb
309
310
  - lib/cased/cli/interactive_session.rb
310
311
  - lib/cased/cli/log.rb
@@ -356,7 +357,7 @@ files:
356
357
  - vendor/cache/faraday-net_http-1.0.1.gem
357
358
  - vendor/cache/faraday_middleware-1.0.0.gem
358
359
  - vendor/cache/hashdiff-1.0.1.gem
359
- - vendor/cache/i18n-1.8.9.gem
360
+ - vendor/cache/i18n-1.8.10.gem
360
361
  - vendor/cache/jaro_winkler-1.5.4.gem
361
362
  - vendor/cache/json-2.5.1.gem
362
363
  - vendor/cache/jwt-2.2.2.gem
Binary file