Sha256: 4c6fd6f889181359ea0ba81d97380baef365e5349bb6117252ea55e8f1e741a9
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
require 'swagger_client' api_token = 'api-efa95241-ff7f-4d4e-b38f-a5b0452a85ca' project_key = 'default' environment_key = 'production' flag_key = 'sort.order' SwaggerClient.configure do |config| config.api_key['Authorization'] = api_token #config.debugging = true end flag_api = SwaggerClient::FeatureFlagsApi.new # begin # flag = flag_api.get_feature_flag(project_key, flag_key) # puts "Flag key: #{flag_key}, name: #{flag.name}, description: #{flag.description}" # rescue SwaggerClient::ApiError => e # puts "API returned error: #{e}" # end # property_path = "/environments/#{environment_key}/on" # patches = [ SwaggerClient::PatchOperation.new(op: 'replace', path: property_path, value: false) ] # patch_and_comment = SwaggerClient::PatchComment.new(patch: patches, comment: 'turning flag on') # flag_api.patch_feature_flag(project_key, flag_key, patch_and_comment) audit_log_api = SwaggerClient::AuditLogApi.new current_time_millis = (Time.now.to_f * 1000).to_i one_hour_ago = current_time_millis - (60 * 60 * 1000) opts = { after: one_hour_ago, #before: 8, # Float | A timestamp filter, expressed as a Unix epoch time in milliseconds. All entries returned will have before this timestamp. #after: 8, # Float | A timestamp filter, expressed as a Unix epoch time in milliseconds. All entries returned will have occured after this timestamp. #q: "text to search for", # can be the full or partial name of a resource, or email address of the user who made the change limit: 10.0 # maximum number of entries to return } begin #Get a list of all audit log entries. The query parameters allow you to restrict the returned results by date ranges, resource specifiers, or a full-text search query. result = audit_log_api.get_audit_log_entries(opts) puts "Audit log entries from the last hour:" result.items.each { |item| puts item.title } rescue SwaggerClient::ApiError => e puts "Exception when calling AuditLogApi->get_audit_log_entries: #{e.message} #{e.response_body}" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
launchdarkly_api-2.0.3 | test.rb |