Module: LaunchdarklyApiHelper
- Defined in:
- lib/launchdarkly_api_helper.rb,
lib/launchdarkly_api_helper/version.rb
Overview
LaunchDarklyApiHelper provides you a way to access your Launch Darkly account using API token to view, edit or delete them accordingly.
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
'0.8.0'
Instance Method Summary collapse
-
#ld_access_token(access_token, project_name = 'default', log_file = 'launchdarkly.log') ⇒ Object
set your LD API token and log file to capture logs.
-
#ld_add_values_to_clause(env, flag, clause_name, clause_value) ⇒ Object
this method will help you to add a value to a particular clause by searching for clause_name in response.
-
#ld_create_flag(key, name = key, description = key, tags = ['created_via_regression_api']) ⇒ Object
this method will create a new feature flag, NOTE: feature falg are created at global level and environment resides inside feature flag.
-
#ld_delete_flag(flag) ⇒ Object
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).
-
#ld_fetch_flag_details(env, flag) ⇒ Object
this method will give you entire details about a flag for that particular environment.
-
#ld_fetch_flag_toggle_status(env, flag) ⇒ Object
this method will return the status of the flag, whether it is on or off viz set to true or false.
-
#ld_flag_variation_served(env, flag) ⇒ Object
this method will get important parameters from the response.
-
#ld_get_values_from_clauses(env, flag, clause_name) ⇒ Object
this method will return values inside a particular clause by searching for clause_name in response.
-
#ld_remove_values_from_clause(env, flag, clause_name, clause_value) ⇒ Object
this method will help you to remove a value to a particular clause by searching for clause_name in response.
-
#ld_rules_clauses_index(env, flag, clause_name) ⇒ Object
this method will return the index of rules and clauses by searching for clause_name in response.
-
#ld_toggle_specific_environment(env, flag, flag_value = true) ⇒ Object
this method will be used to toggle status of feature flag either on / off for a particular environment.
Instance Method Details
#ld_access_token(access_token, project_name = 'default', log_file = 'launchdarkly.log') ⇒ Object
set your LD API token and log file to capture logs
33 34 35 |
# File 'lib/launchdarkly_api_helper.rb', line 33 def ld_access_token(access_token, project_name = 'default', log_file = 'launchdarkly.log') @launchdarkly_helper = LaunchdarklyApiHelperClass.new(access_token, project_name, log_file) end |
#ld_add_values_to_clause(env, flag, clause_name, clause_value) ⇒ Object
this method will help you to add a value to a particular clause by searching for clause_name in response
73 74 75 |
# File 'lib/launchdarkly_api_helper.rb', line 73 def ld_add_values_to_clause(env, flag, clause_name, clause_value) @launchdarkly_helper.add_values_to_clause(env, flag, clause_name, clause_value) end |
#ld_create_flag(key, name = key, description = key, tags = ['created_via_regression_api']) ⇒ Object
this method will create a new feature flag, NOTE: feature falg are created at global level and environment resides inside feature flag
48 49 50 |
# File 'lib/launchdarkly_api_helper.rb', line 48 def ld_create_flag(key, name = key, description = key, = ['created_via_regression_api']) @launchdarkly_helper.create_flag(key, name, description, ) end |
#ld_delete_flag(flag) ⇒ Object
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)
83 84 85 |
# File 'lib/launchdarkly_api_helper.rb', line 83 def ld_delete_flag(flag) @launchdarkly_helper.delete_flag(flag) end |
#ld_fetch_flag_details(env, flag) ⇒ Object
this method will give you entire details about a flag for that particular environment
38 39 40 |
# File 'lib/launchdarkly_api_helper.rb', line 38 def ld_fetch_flag_details(env, flag) @launchdarkly_helper.fetch_flag_details(env, flag) end |
#ld_fetch_flag_toggle_status(env, flag) ⇒ Object
this method will return the status of the flag, whether it is on or off viz set to true or false
43 44 45 |
# File 'lib/launchdarkly_api_helper.rb', line 43 def ld_fetch_flag_toggle_status(env, flag) @launchdarkly_helper.fetch_flag_toggle_status(env, flag) end |
#ld_flag_variation_served(env, flag) ⇒ Object
this method will get important parameters from the response
58 59 60 |
# File 'lib/launchdarkly_api_helper.rb', line 58 def ld_flag_variation_served(env, flag) @launchdarkly_helper.flag_variation_served(env, flag) end |
#ld_get_values_from_clauses(env, flag, clause_name) ⇒ Object
this method will return values inside a particular clause by searching for clause_name in response
68 69 70 |
# File 'lib/launchdarkly_api_helper.rb', line 68 def ld_get_values_from_clauses(env, flag, clause_name) @launchdarkly_helper.get_values_from_clauses(env, flag, clause_name) end |
#ld_remove_values_from_clause(env, flag, clause_name, clause_value) ⇒ Object
this method will help you to remove a value to a particular clause by searching for clause_name in response
78 79 80 |
# File 'lib/launchdarkly_api_helper.rb', line 78 def ld_remove_values_from_clause(env, flag, clause_name, clause_value) @launchdarkly_helper.remove_values_from_clause(env, flag, clause_name, clause_value) end |
#ld_rules_clauses_index(env, flag, clause_name) ⇒ Object
this method will return the index of rules and clauses by searching for clause_name in response
63 64 65 |
# File 'lib/launchdarkly_api_helper.rb', line 63 def ld_rules_clauses_index(env, flag, clause_name) @launchdarkly_helper.rules_clauses_index(env, flag, clause_name) end |
#ld_toggle_specific_environment(env, flag, flag_value = true) ⇒ Object
this method will be used to toggle status of feature flag either on / off for a particular environment
53 54 55 |
# File 'lib/launchdarkly_api_helper.rb', line 53 def ld_toggle_specific_environment(env, flag, flag_value = true) @launchdarkly_helper.toggle_specific_environment(env, flag, flag_value) end |