module MaintenanceHelpers
to do the replace string, should convert this to a class
Public Instance Methods
filter_by_top_value(calls, key, value)
click to toggle source
# File lib/m1_api/maintenance_helpers.rb, line 35 def filter_by_top_value(calls, key, value) if value.is_a? Regexp calls.select { |call| call if call[:request][key].match?(value) } else calls.select { |call| call if call[:request][key].include?(value) } end end
load_har(path_to_file)
click to toggle source
# File lib/m1_api/maintenance_helpers.rb, line 15 def load_har(path_to_file) out = [] JSON.parse(File.read(path_to_file))['log']['entries'].each do |call| out << { start_time: call['startTime'], request: { method: call['request']['method'], url: call['request']['url'], headers: call['request']['headers'], body: call['request']['postData'] }, response: { status: call['response']['status'], content: call['response']['content'] } } end out end
replace_value_with_key(data, matcher, key)
click to toggle source
# File lib/m1_api/maintenance_helpers.rb, line 43 def replace_value_with_key(data, matcher, key) end