Sha256: 5e1bbae71ca0cc6a335dee5d6b37f22eaa1318ee7bef1093f5f49bb4f7c93f03

Contents?: true

Size: 918 Bytes

Versions: 17

Compression:

Stored size: 918 Bytes

Contents

require 'multi_json'

module Seahorse
  module Client
    module Plugins

      # This plugin performs two trivial translations:
      #
      # * The request parameters are serialized as JSON for the request body
      # * The response body is deserialized as JSON for the response data
      #
      # No attempt is made to extract errors from the HTTP response body.
      # Parsing the response only happens for a successful response.
      #
      class JsonSimple < Plugin

        # @api private
        class Handler < Client::Handler

          def call(context)
            context.http_request.body = MultiJson.dump(context.params)
            @handler.call(context).on_success do |response|
              response.error = nil
              response.data = MultiJson.load(context.http_response.body_contents)
            end
          end

        end

        handler(Handler)

      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.10 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.9 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.8 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.7 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.6 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.5 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.4 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.3 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.2 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.1 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc16 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc15 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc14 lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc13 vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc12 vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc11 vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb