Sha256: b2917ddb0f28d2b07c6f231ea8f994b3b9cdd42cc8fe4fd66d39bdcb1b6cd294

Contents?: true

Size: 877 Bytes

Versions: 5

Compression:

Stored size: 877 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(200..299) do |resp|
              resp.data = MultiJson.load(context.http_response.body_contents)
            end
          end

        end

        handler(Handler)

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.0.rc10 vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc9 vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc8 vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc7 vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb
aws-sdk-core-2.0.0.rc6 vendor/seahorse/lib/seahorse/client/plugins/json_simple.rb