lib/flipper/adapters/http.rb in flipper-0.26.2 vs lib/flipper/adapters/http.rb in flipper-0.27.0

- old
+ new

@@ -37,11 +37,11 @@ end end def get_multi(features) csv_keys = features.map(&:key).join(',') - response = @client.get("/features?keys=#{csv_keys}") + response = @client.get("/features?keys=#{csv_keys}&exclude_gate_names=true") raise Error, response unless response.is_a?(Net::HTTPOK) parsed_response = JSON.parse(response.body) parsed_features = parsed_response.fetch('features') gates_by_key = parsed_features.each_with_object({}) do |parsed_feature, hash| @@ -55,11 +55,11 @@ end result end def get_all - response = @client.get("/features") + response = @client.get("/features?exclude_gate_names=true") raise Error, response unless response.is_a?(Net::HTTPOK) parsed_response = JSON.parse(response.body) parsed_features = parsed_response.fetch('features') gates_by_key = parsed_features.each_with_object({}) do |parsed_feature, hash| @@ -74,11 +74,11 @@ end result end def features - response = @client.get('/features') + response = @client.get('/features?exclude_gate_names=true') raise Error, response unless response.is_a?(Net::HTTPOK) parsed_response = JSON.parse(response.body) parsed_response['features'].map { |feature| feature['key'] }.to_set end @@ -117,9 +117,17 @@ true end def clear(feature) response = @client.delete("/features/#{feature.key}/clear") + raise Error, response unless response.is_a?(Net::HTTPNoContent) + true + end + + def import(source) + adapter = self.class.from(source) + export = adapter.export(format: :json, version: 1) + response = @client.post("/import", export.contents) raise Error, response unless response.is_a?(Net::HTTPNoContent) true end private