Sha256: 1c97640044ef7c26f18f87278ba540f2268cef05a33b0192f360c0b88ec40324

Contents?: true

Size: 638 Bytes

Versions: 14

Compression:

Stored size: 638 Bytes

Contents

require 'flipper/exporters/json/export'
require 'flipper/api/action'
require 'flipper/api/v1/decorators/feature'

module Flipper
  module Api
    module V1
      module Actions
        class Import < Api::Action
          route %r{\A/import/?\Z}

          def post
            body = request.body.read
            request.body.rewind
            export = Flipper::Exporters::Json::Export.new(contents: body)
            flipper.import(export)
            json_response({}, 204)
          rescue Flipper::Exporters::Json::InvalidError
            json_error_response(:import_invalid)
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
flipper-api-1.2.2 lib/flipper/api/v1/actions/import.rb
flipper-api-1.2.1 lib/flipper/api/v1/actions/import.rb
flipper-api-1.2.0 lib/flipper/api/v1/actions/import.rb
flipper-api-1.1.2 lib/flipper/api/v1/actions/import.rb
flipper-api-1.1.1 lib/flipper/api/v1/actions/import.rb
flipper-api-1.1.0 lib/flipper/api/v1/actions/import.rb
flipper-api-1.0.0 lib/flipper/api/v1/actions/import.rb
flipper-api-1.0.0.pre lib/flipper/api/v1/actions/import.rb
flipper-api-0.28.3 lib/flipper/api/v1/actions/import.rb
flipper-api-0.28.2 lib/flipper/api/v1/actions/import.rb
flipper-api-0.28.1 lib/flipper/api/v1/actions/import.rb
flipper-api-0.28.0 lib/flipper/api/v1/actions/import.rb
flipper-api-0.27.1 lib/flipper/api/v1/actions/import.rb
flipper-api-0.27.0 lib/flipper/api/v1/actions/import.rb