launchdarkly_api_helper 0.7.0 → 0.8.0

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: cc0c1b25efd8bceafce66fca401b054433d58bd16057952a5af5454f71c723aa
4
- data.tar.gz: 2366bb57ed059ea241df1488c3300fd2ccd2f7803a03a04dd90915c199f7fab4
3
+ metadata.gz: 76248b30b1edaa307a8bb4e1975cccb94c7e28f00535e46de2a199884f97987c
4
+ data.tar.gz: 3ea7fbdc37be4d4f7de4de14c1e1c0101907383a52fbd64e577da8eb01c68197
5
5
  SHA512:
6
- metadata.gz: 31921892456f509b895c2119873daa5b6a9d8d566baacc6721f1e5b307d7413156e7100dd8a890606621433305ea43def942d86d0ab01fe98ef660febd55f51f
7
- data.tar.gz: 8ed558e1a93bf0f3e1b42b17ea767f700436b73438aa48eb02de30598f0683c020f98a97172e39249a6c474a0cbcac7c85d806b47a4095c59cf336264b1cd985
6
+ metadata.gz: 9f21e3dd1dcc6acda981da928e169872964650f00f928909fbd7e25e4d44daf04c0b54307f9d87c23f2823a5b9ec8c0ce446ba3208b167ee1d5449ca974daeed
7
+ data.tar.gz: 54fb63330243f55083d1f02636a696ebf3bb717264745878184ac1e6d8af8fa2b5a65a24d798e6754fccea728dccef97a48e9a204c65cc7e0039b3cbf192375b
data/README.md CHANGED
@@ -8,9 +8,11 @@
8
8
  </a>
9
9
  </div>
10
10
 
11
+ <br>
12
+
11
13
  [LaunchDarklyApiHelper](https://rubygems.org/gems/launchdarkly_api_helper) provides you a way to access your [Launch Darkly](https://apidocs.launchdarkly.com/) account using [API token](https://app.launchdarkly.com/settings/authorization/tokens/new) to view, edit or delete them accordingly.
12
14
 
13
- ![alt text](https://docs.launchdarkly.com/static/de107a76f0cd388da14d5bd650ec1f5c/b8471/settings-access-tokens-obscured-callout.png)
15
+ <br>
14
16
 
15
17
  [Launch Darkly API Documentation](https://apidocs.launchdarkly.com/)
16
18
 
@@ -32,79 +34,54 @@ add `include LaunchdarklyApiHelper` line to access LaunchdarklyApiHelper module
32
34
 
33
35
  To perform any operations such as add, remove, replace, move, copy, test you should have a working knowledge of [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902)
34
36
 
35
- ```ruby
36
- parameters:
37
- access_token (*required): this token will be used to send all requests to LaunchDarkly (string)
38
- project_name: provide project name of your organization (NOTE: for most, it should be `default` unless you have made some explicit changes)
39
- log_file: all logs will be written to file 'launchdarkly.log' by default if no file name specified (string)
37
+ <br>
40
38
 
41
- # set your LD API token and log file to capture logs
42
- def ld_access_token(access_token, project_name = 'default', log_file = 'launchdarkly.log')
43
- # code ...
44
- end
45
- ```
39
+ Projects allow you to manage multiple different software projects under one LaunchDarkly account. Each project has its own unique set of environments and feature flags. To learn more, read [Projects](https://docs.launchdarkly.com/home/organize/projects)
46
40
 
47
- [Get feature flag](https://apidocs.launchdarkly.com/tag/Feature-flags#operation/getFeatureFlag)
41
+ ![alt text](https://docs.launchdarkly.com/static/082f7fa3cbb6ed1081425340586e47ad/fe238/projects-two-app-types.png)
48
42
 
49
- ```ruby
50
- GET REQUEST
51
- https://app.launchdarkly.com/api/v2/flags/default/developer_flag_for_regression
43
+ ![alt text](https://docs.launchdarkly.com/static/55307ea3f0a386269181a1982fcc20ff/75a80/settings-projects-create.png)
52
44
 
53
- Here, 'developer_flag_for_regression' is the feature flag name and `default` is our Project name - eg. AmitSinghBisht
54
- By default, this returns the configurations for all environments
55
- You can filter environments with the env query parameter. For example, setting env=staging restricts the returned configurations to just the staging environment
56
- https://app.launchdarkly.com/api/v2/flags/default/developer_flag_for_regression?env=staging
45
+ <br>
57
46
 
58
- parameters:
59
- env (*required): name of the environment for which you want to get the details (string)
60
- flag (*required): name of the feature flag for which you want to get the details (string)
47
+ ### [Set Access Token](https://apidocs.launchdarkly.com/tag/Access-tokens)
61
48
 
62
- # this method will give you entire details about a flag for that particular environment
63
- def ld_fetch_flag_details(env, flag)
64
- # code ...
65
- end
49
+ ![alt text](https://docs.launchdarkly.com/static/de107a76f0cd388da14d5bd650ec1f5c/b8471/settings-access-tokens-obscured-callout.png)
66
50
 
67
- @return parameter: (response of feature flag details)
68
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}" (string)
69
- ```
51
+ **_parameters for `ld_access_token` method_**
52
+ - **access_token (*required)**: this token will be used to send all requests to LaunchDarkly (string)
53
+ - **project_name**: provide project name of your organization (NOTE: for most, it should be `default` unless you have made some explicit changes)
54
+ - **log_file**: all logs will be written to file 'launchdarkly.log' by default if no file name specified (string)
70
55
 
71
56
  ```ruby
72
- Get toggle status feature flag
73
-
74
- parameters:
75
- env (*required): name of the environment for which you want to get the details (string)
76
- flag (*required): name of the feature flag for which you want to get the details (string)
77
-
78
- # this method will return the status of the flag, whether it is on or off viz set to true or false
79
- def ld_fetch_flag_toggle_status(env, flag)
57
+ # set your LD API token and log file to capture logs
58
+ def ld_access_token(access_token, project_name = 'default', log_file = 'launchdarkly.log')
80
59
  # code ...
81
60
  end
82
-
83
- @return parameter: (response of feature flag toggle status)
84
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}"
85
- response['environments'][env]['on'] (boolean)
86
61
  ```
87
62
 
88
- ```ruby
89
- Create a feature flag
90
- https://apidocs.launchdarkly.com/tag/Feature-flags/#operation/postFeatureFlag
63
+ <br>
64
+
65
+ ### [Create a feature flag](https://apidocs.launchdarkly.com/tag/Feature-flags/#operation/postFeatureFlag)
91
66
 
92
- POST REQUEST
93
- https://app.launchdarkly.com/api/v2/flags/default
67
+ Sample: `https://app.launchdarkly.com/api/v2/flags/<project_name>`
94
68
 
95
- Here, default is our Project name - eg. AmitSinghBisht
69
+ Example: `https://app.launchdarkly.com/api/v2/flags/default`
70
+
71
+ Here, `default` is our Project name - eg. AmitSinghBisht
96
72
 
97
73
  parameters:
98
- key (*required): A unique key used to reference the feature flag in your code (string)
99
- name (*required): A human-friendly name for the feature flag (string)
100
- description: Description of the feature flag. Defaults to an empty string (string)
101
- tags: Tags for the feature flag. Defaults to an empty array (Array of strings)
102
- variations: An array of possible variations for the flag. The variation values must be unique. If omitted, two boolean variations of true and false will be used (Array of objects)
103
74
 
104
- defaults
105
- * onVariation (*required): The index, from the array of variations for this flag, of the variation to serve by default when targeting is on (integer)
106
- * offVariation (*required): The index, from the array of variations for this flag, of the variation to serve by default when targeting is off (integer)
75
+ - **key (*required)**: A unique key used to reference the feature flag in your code (string)
76
+ - **name (*required)**: A human-friendly name for the feature flag (string)
77
+ - **description**: Description of the feature flag. Defaults to an empty string (string)
78
+ - **tags**: Tags for the feature flag. Defaults to an empty array (Array of strings)
79
+ - **variations**: An array of possible variations for the flag. The variation values must be unique. If omitted, two boolean variations of true and false will be used (Array of objects)
80
+ - **defaults**
81
+ - **onVariation** (*required): The index, from the array of variations for this flag, of the variation to serve by default when targeting is on (integer)
82
+ - **offVariation** (*required): The index, from the array of variations for this flag, of the variation to serve by default when targeting is off (integer)
107
83
 
84
+ ```ruby
108
85
  {
109
86
  "key": "developer_flag_for_regression",
110
87
  "name": "developer_flag_for_regression",
@@ -125,70 +102,150 @@ defaults
125
102
  "offVariation": 0
126
103
  }
127
104
  }
105
+ ```
128
106
 
129
- Above code will create a key 'developer_flag_for_regression' with name as 'developer_flag_for_regression' and description as 'developer_flag_for_regression is created via regression api on 18_10_2022'
107
+ Above code will create a key `developer_flag_for_regression` with name as `developer_flag_for_regression` and description as `developer_flag_for_regression is created via regression api on 18_10_2022`
130
108
 
131
- Variations are provided while creating key, by default variation is a boolean value (true and false). once flag with a specific variation is created, its type cannot be modified later, hence choose your variation type smartly (Boolean, String, Number, JSON) In above example we are creating a flag with JSON type and its two values are 'age': 10 and 'age': 20
109
+ Variations are provided while creating key, by default variation is a boolean value (true and false). **once flag with a specific variation is created, its type cannot be modified later, hence choose your variation type smartly (Boolean, String, Number, JSON)** In above example we are creating a flag with JSON type and its two values are 'age': 10 and 'age': 20
132
110
 
133
111
  Also, variation has by default two values, and you must also define two variations while creating your own custom feature flag
134
112
 
135
113
  Default will specify which variation to serve when flag is on or off. In above example when flag is turned on, '1' variation is served [Note: 0 and 1 are index position], so variations at first index ie variations[1] will be served when flag is turned on ie 'age': 20
136
114
 
115
+ **_parameters for `ld_create_flag` method_**
116
+ - **key (*required)**: A unique key used to reference the feature flag in your code (string)
117
+ - **name**: A human-friendly name for the feature flag (string)
118
+ - **description**: Description of the feature flag. Defaults to an empty string (string)
119
+ - **tags**: Tags for the feature flag. Defaults to an empty array (Array of strings)
120
+
121
+ ```ruby
137
122
  # this method will create a new feature flag, NOTE: feature falg are created at global level and environment resides inside feature flag
138
123
  def ld_create_flag(key, name = key, description = key, tags = ['created_via_regression_api'])
139
124
  # code ...
140
125
  end
141
126
  ```
142
127
 
143
- ```ruby
144
- Update feature flag
145
- https://apidocs.launchdarkly.com/tag/Feature-flags#operation/patchFeatureFlag
128
+ **_@return parameter_**: (response of feature flag details)
146
129
 
147
- PATCH REQUEST
148
- https://app.launchdarkly.com/api/v2/flags/default/developer_flag_for_regression
130
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}` (string)
149
131
 
150
- Here, 'developer_flag_for_regression' is the flag key and `default` is our Project name - eg. AmitSinghBisht
151
- You can update any parameter of feature flag using this method
132
+ <br>
152
133
 
153
- parameters:
154
- env (*required): name of the environment for which you want to get the details (string)
155
- flag (*required): name of the feature flag for which you want to get the details (string)
156
- flag_value: status of the feature flag that you want to set either on (true) or off (false) (boolean)
134
+ ### [Get feature flag](https://apidocs.launchdarkly.com/tag/Feature-flags#operation/getFeatureFlag)
157
135
 
158
- # this method will be used to toggle status of feature flag either on / off for a particular environment
159
- def ld_toggle_specific_environment(env, flag, flag_value = true)
136
+ Sample: `https://app.launchdarkly.com/api/v2/flags/<project_name>/<feature_flag_name>`
137
+
138
+ Example: `https://app.launchdarkly.com/api/v2/flags/default/developer_flag_for_regression`
139
+
140
+ <br>
141
+
142
+ **1. GET FEATURE FLAG DETAILS**
143
+
144
+ Here, `developer_flag_for_regression` is the feature flag name and `default` is our Project name - eg. AmitSinghBisht
145
+
146
+ By default, this returns the configurations for all environments
147
+
148
+ You can filter environments with the env query parameter. For example, setting env=staging restricts the returned configurations to just the staging environment
149
+ `https://app.launchdarkly.com/api/v2/flags/default/developer_flag_for_regression?env=staging`
150
+
151
+ **_parameters for `ld_fetch_flag_details` method_**
152
+ - **env** (*required): name of the environment for which you want to get the details (string)
153
+ - **flag** (*required): name of the feature flag for which you want to get the details (string)
154
+
155
+ ```ruby
156
+ # this method will give you entire details about a flag for that particular environment
157
+ def ld_fetch_flag_details(env, flag)
160
158
  # code ...
161
159
  end
162
-
163
- @return parameter: (response of feature flag toggle status)
164
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}"
165
- response['environments'][env]['on'] (boolean)
166
160
  ```
167
161
 
162
+ **_@return parameter_**: (response of feature flag details)
163
+
164
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}` (string)
165
+
166
+ <br>
167
+
168
+ **2. GET FEATURE FLAG TOGGLE STATUS DETAILS**
169
+
170
+ **_parameters for `ld_fetch_flag_details` method_**
171
+ - **env** (*required): name of the environment for which you want to get the details (string)
172
+ - **flag** (*required): name of the feature flag for which you want to get the details (string)
173
+
168
174
  ```ruby
169
- Get status of feature flag
170
- https://apidocs.launchdarkly.com/tag/Feature-flags#operation/patchFeatureFlag
175
+ # this method will return the status of the flag, whether it is on or off viz set to true or false
176
+ def ld_fetch_flag_toggle_status(env, flag)
177
+ # code ...
178
+ end
179
+ ```
171
180
 
172
- parameters:
173
- env (*required): name of the environment for which you want to get the details (string)
174
- flag (*required): name of the feature flag for which you want to get the details (string)
181
+ **_@return parameter_**: (response of feature flag toggle status viz. response_on)
182
+
183
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}`
184
+ - response_on = `response['environments'][env]['on']` (boolean)
175
185
 
186
+ <br>
187
+
188
+ **3. GET FEW IMPORTANT PARAMETERS FROM FEATURE FLAG**
189
+
190
+ **_parameters for `ld_fetch_flag_details` method_**
191
+ - **env** (*required): name of the environment for which you want to get the details (string)
192
+ - **flag** (*required): name of the feature flag for which you want to get the details (string)
193
+
194
+ ```ruby
176
195
  # this method will get important parameters from the response
177
196
  def flag_variation_served(env, flag)
178
197
  # code ...
179
198
  end
180
-
181
- @returns: [fetch_flag_toggle_status_response, feature_flag_variation_index_response, feature_flag_variation_value_response, feature_flag_variation_name_response]
182
- @return parameter:
183
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}"
184
- fetch_flag_toggle_status_response: response['environments'][env]['on'] (boolean)
185
- feature_flag_variation_index_response: response (integer)
186
- feature_flag_variation_value_response: response['variations'][feature_flag_variation_index_response]['value'] (string)
187
- feature_flag_variation_name_response: response['variations'][feature_flag_variation_index_response]['name'] (string)
188
199
  ```
189
200
 
201
+ **@returns**: [fetch_flag_toggle_status_response, feature_flag_variation_index_response, feature_flag_variation_value_response, feature_flag_variation_name_response]
202
+
203
+ **_@return parameter_**:
204
+
205
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}`
206
+ - fetch_flag_toggle_status_response: `response['environments'][#{env}]['on']` (boolean)
207
+ - feature_flag_variation_index_response: `response` (integer)
208
+ - feature_flag_variation_value_response: `response['variations'][#{feature_flag_variation_index_response}]['value']` (string)
209
+ - feature_flag_variation_name_response: `response['variations'][#{feature_flag_variation_index_response}]['name']` (string)
210
+
211
+ <br>
212
+
213
+ ### [Update feature flag](https://apidocs.launchdarkly.com/tag/Feature-flags#operation/patchFeatureFlag)
214
+
215
+ Sample: `https://app.launchdarkly.com/api/v2/flags/<project_name>/<feature_flag_name>`
216
+
217
+ Example: `https://app.launchdarkly.com/api/v2/flags/default/developer_flag_for_regression`
218
+
219
+ <br>
220
+
221
+ **1. UPDATE FEATURE FLAG TOGGLE STATUS**
222
+
223
+ Here, `developer_flag_for_regression` is the flag key and `default` is our Project name - eg. AmitSinghBisht
224
+
225
+ You can update any parameter of feature flag using this method
226
+
227
+ **_parameters for `ld_toggle_specific_environment` method_**
228
+ - **env** (*required): name of the environment for which you want to get the details (string)
229
+ - **flag** (*required): name of the feature flag for which you want to get the details (string)
230
+ - **flag_value**: status of the feature flag that you want to set either on (true) or off (false) (boolean)
231
+
190
232
  ```ruby
233
+ # this method will be used to toggle status of feature flag either on / off for a particular environment
234
+ def ld_toggle_specific_environment(env, flag, flag_value = true)
235
+ # code ...
236
+ end
237
+ ```
238
+
239
+ **_@return parameter_**: (response of feature flag toggle status viz. response_on)
240
+
241
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}`
242
+ - response_on = `response['environments'][env]['on']` (boolean)
243
+
244
+ <br>
191
245
 
246
+ **2. UPDATE FEATURE FLAG VALUES INSIDE CLAUSES INSIDE RULES**
247
+
248
+ ```ruby
192
249
  "rules": [
193
250
  { # rules/0
194
251
  "variation": 0,
@@ -222,96 +279,129 @@ feature_flag_variation_name_response: response['variations'][feature_flag_variat
222
279
  ]
223
280
  }
224
281
  ]
282
+ ```
225
283
 
226
- parameters:
227
- env (*required): name of the environment for which you want to get the details (string)
228
- flag (*required): name of the feature flag for which you want to get the details (string)
229
- clause_name (*required): name of clause that you want to search for in response
284
+ <br>
230
285
 
286
+ **2.a. TO UPDATE FEATURE FLAG - FIRST, GET THE INDEX OF RULES AND CLAUSE INSIDE WHICH VALUE RESIDES**
287
+
288
+ **_parameters for `ld_rules_clauses_index` method_**:
289
+ - **env** (*required): name of the environment for which you want to get the details (string)
290
+ - **flag** (*required): name of the feature flag for which you want to get the details (string)
291
+ - **clause_name** (*required): name of clause that you want to search for in response (string)
292
+
293
+ ```ruby
231
294
  # this method will return the index of rules and clauses by searching for clause_name in response
232
295
  def ld_rules_clauses_index(env, flag, clause_name)
233
296
  # code ...
234
297
  end
235
-
236
- @returns: [rule_at_index, clause_at_index]
237
- @return parameter:
238
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}" ['environments'][env]['rules']
239
- rule_at_index = response[rule_index] (integer) # index at which rule is found
240
- clause_at_index = response[rule_index]['clauses'][clause_index] (integer) # index at which clause is found
241
298
  ```
242
299
 
243
- ```ruby
244
- parameters:
245
- env (*required): name of the environment for which you want to get the details (string)
246
- flag (*required): name of the feature flag for which you want to get the details (string)
247
- clause_name (*required): name of clause that you want to search for in response
300
+ **@returns**: [rule_at_index, clause_at_index]
301
+
302
+ **_@return parameter_**:
303
+
304
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}`
305
+ - response_rules = `response['environments'][#{env}]['rules']`
306
+ - rule_at_index = `response_rules[rule_index]` (integer) # index at which rule is found
307
+ - clause_at_index = `response_rules[rule_index]['clauses'][clause_index]` (integer) # index at which clause is found
248
308
 
309
+ <br>
310
+
311
+ **2.b. GET VALUES INSIDE A CLAUSE BY ITERATING THROUGH REQUIRED INDEX OF RULES AND CLAUSES**
312
+
313
+ **_parameters for `ld_get_values_from_clauses` method_**:
314
+ - **env** (*required): name of the environment for which you want to get the details (string)
315
+ - **flag** (*required): name of the feature flag for which you want to get the details (string)
316
+ - **clause_name** (*required): name of clause that you want to search for in response (string)
317
+
318
+ ```ruby
249
319
  # this method will return values inside a particular clause by searching for clause_name in response
250
320
  def ld_get_values_from_clauses(env, flag, clause_name)
251
321
  # code ...
252
322
  end
253
-
254
- @return parameter: values_for_clause_name
255
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}" ['environments'][env]['rules']
256
- values_for_clause_name = response[rule_at_index]['clauses'][clause_at_index]['values'] (string)
257
323
  ```
258
324
 
259
- ```ruby
260
- parameters:
261
- env (*required): name of the environment for which you want to get the details (string)
262
- flag (*required): name of the feature flag for which you want to get the details (string)
263
- clause_name (*required): name of clause that you want to search for in response
264
- clause_value (*required): value that you want to add to a particular clause (NOTE: it will be appened at zeroth 0th index)
325
+ **@return parameter**: values_for_clause_name
326
+
327
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}`
328
+ - response_rules = `response['environments'][#{env}]['rules']`
329
+ - values_for_clause_name = `response_rules[rule_at_index]['clauses'][clause_at_index]['values']` (string)
330
+
331
+ <br>
265
332
 
333
+ **2.c. ADD VALUES TO A PARTICULAR CLAUSE**
334
+
335
+ **_parameters for `ld_add_values_to_clause` method_**:
336
+ - **env** (*required): name of the environment for which you want to get the details (string)
337
+ - **flag** (*required): name of the feature flag for which you want to get the details (string)
338
+ - **clause_name** (*required): name of clause that you want to search for in response (string)
339
+ - **clause_value** (*required): value that you want to add to a particular clause (NOTE: it will be appended at zeroth 0th index) (string or number or json or object)
340
+
341
+ ```ruby
266
342
  # this method will help you to add a value to a particular clause by searching for clause_name in response
267
343
  def ld_add_values_to_clause(env, flag, clause_name, clause_value)
268
344
  # code ...
269
345
  end
270
-
271
- @return parameter: (response of feature flag details)
272
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}"
273
- response[rule_at_index]['clauses'][clause_at_index]['values'] (string)
274
346
  ```
275
347
 
276
- ```ruby
277
- parameters:
278
- env (*required): name of the environment for which you want to get the details (string)
279
- flag (*required): name of the feature flag for which you want to get the details (string)
280
- clause_name (*required): name of clause that you want to search for in response
281
- clause_value (*required): value that you want to add to a particular clause (NOTE: it will be appened at zeroth 0th index)
348
+ **@return parameter**: (response of feature flag details viz. updated_clause_value)
349
+
350
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}`
351
+ - response_rules = `response['environments'][#{env}]['rules']`
352
+ - updated_clause_value = `response_rules[rule_at_index]['clauses'][clause_at_index]['values']` (string)
353
+
354
+ <br>
282
355
 
356
+ **2.d. DELETE VALUES TO A PARTICULAR CLAUSE**
357
+
358
+ **_parameters for `ld_remove_values_from_clause` method_**:
359
+ - **env** (*required): name of the environment for which you want to get the details (string)
360
+ - **flag** (*required): name of the feature flag for which you want to get the details (string)
361
+ - **clause_name** (*required): name of clause that you want to search for in response (string)
362
+ - **clause_value** (*required): value that you want to add to a particular clause (NOTE: it will be appended at zeroth 0th index) (string or number or json or object)
363
+
364
+
365
+ ```ruby
283
366
  # this method will help you to remove a value to a particular clause by searching for clause_name in response
284
367
  def ld_remove_values_from_clause(env, flag, clause_name, clause_value)
285
368
  # code ...
286
369
  end
287
-
288
- @return parameter: (response of feature flag details)
289
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}"
290
- response[rule_at_index]['clauses'][clause_at_index]['values'] (string)
291
370
  ```
371
+ **@return parameter**: (response of feature flag details viz. updated_clause_value)
292
372
 
293
- ```ruby
294
- Delete feature flag
295
- https://apidocs.launchdarkly.com/tag/Feature-flags#operation/deleteFeatureFlag
373
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}`
374
+ - response_rules = `response['environments'][#{env}]['rules']`
375
+ - updated_clause_value = `response_rules[rule_at_index]['clauses'][clause_at_index]['values']` (string)
296
376
 
297
- DELETE REQUEST
298
- https://app.launchdarkly.com/api/v2/flags/default/developer_flag_for_regression
377
+ <br>
299
378
 
300
- Here, 'developer_flag_for_regression' is the flag key and default is our Project name - eg. AmitSinghBisht
301
- You can delete any feature flag using this method
379
+ ### [Delete feature flag](https://apidocs.launchdarkly.com/tag/Feature-flags#operation/deleteFeatureFlag)
302
380
 
303
- parameters:
304
- flag (*required): name of the feature flag for which you want to get the details (string)
381
+ Sample: `https://app.launchdarkly.com/api/v2/flags/<project_name>/<feature_flag_name>`
382
+
383
+ Example: `https://app.launchdarkly.com/api/v2/flags/default/developer_flag_for_regression`
305
384
 
385
+ Here, `developer_flag_for_regression` is the flag key and default is our Project name - eg. AmitSinghBisht
386
+
387
+ You can delete any feature flag using this method
388
+
389
+ **_parameters for `ld_delete_flag` method_**:
390
+ - **flag** (*required): name of the feature flag you want to delete (NOTE: env resided inside flag which means flag is parent, so deleting a feature flag will delete it from all environment) (string)
391
+
392
+ ```ruby
306
393
  # this method will delete a feature flag in launchdarkly (NOTE: env resided inside flag which means flag is parent, so deleting a feature flag will delete it from all environment)
307
394
  def ld_delete_flag(flag)
308
395
  # code ...
309
396
  end
310
-
311
- @return parameter: (response of feature flag details)
312
- response = "https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}" (string)
313
397
  ```
314
398
 
399
+ **@return parameter**: (response of feature flag details)
400
+
401
+ - response = `https://app.launchdarkly.com/api/v2/flags/default/#{flag}?env=#{env}` (string)
402
+
403
+ <br>
404
+
315
405
  ## Development
316
406
 
317
407
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LaunchdarklyApiHelper
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
5
5
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: launchdarkly_api_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - amit-singh-bisht
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-19 00:00:00.000000000 Z
11
+ date: 2022-11-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: LaunchDarklyApiHelper provides you a way to access your Launch Darkly
14
- account using API token to view, edit or delete them accordingly. https://amit-singh-bisht.github.io/launchdarkly_api_helper_ruby/
14
+ account using API token to view, edit or delete them accordingly. https://bit.ly/ld_doc
15
15
  email:
16
16
  - bishtamitsingh98@gmail.com
17
17
  executables: []
@@ -35,7 +35,7 @@ metadata:
35
35
  homepage_uri: https://github.com/amit-singh-bisht/launchdarkly_api_helper_ruby
36
36
  source_code_uri: https://github.com/amit-singh-bisht/launchdarkly_api_helper_ruby
37
37
  changelog_uri: https://github.com/amit-singh-bisht/launchdarkly_api_helper_ruby/blob/master/README.md
38
- post_install_message:
38
+ post_install_message:
39
39
  rdoc_options: []
40
40
  require_paths:
41
41
  - lib
@@ -50,9 +50,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  requirements: []
53
- rubygems_version: 3.2.3
54
- signing_key:
53
+ rubyforge_project:
54
+ rubygems_version: 2.7.3
55
+ signing_key:
55
56
  specification_version: 4
56
57
  summary: LaunchDarklyApiHelper provides you a way to access your Launch Darkly account
57
- using API token to view, edit or delete them accordingly. https://amit-singh-bisht.github.io/launchdarkly_api_helper_ruby/
58
+ using API token to view, edit or delete them accordingly. https://bit.ly/ld_doc
58
59
  test_files: []