Sha256: e9d2af4f3394922564679d2364b8889421a3f29da0d538cbf7241b0c62561d84

Contents?: true

Size: 874 Bytes

Versions: 8

Compression:

Stored size: 874 Bytes

Contents

module KrakenClient
  module Requests
    class Post < Base

      def call(url, endpoint_name, options)
        super

        @url           = url
        @endpoint_name = endpoint_name

        response       = HTTParty.post(url, params(options)).parsed_response
        response['error'].empty? ? response['result'] : response['error']
      end

      private

      def params(options = {})
        params           = {}

        header_content   = content_manager::Header.new(config, endpoint_name, options, url)

        params[:headers] = header_content.call
        params[:body]    = body_content(header_content).call

        params
      end

      def content_manager
        KrakenClient::Requests::Content
      end

      def body_content(header_content)
        content_manager::Body.new(header_content.send(:encoded_options))
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kraken_client-1.3.0 lib/kraken_client/requests/post.rb
kraken_client-1.2.1 lib/kraken_client/requests/post.rb
kraken_client-1.2 lib/kraken_client/requests/post.rb
kraken_client-1.1.5 lib/kraken_client/requests/post.rb
kraken_client-1.1.4 lib/kraken_client/requests/post.rb
kraken_client-1.1.3 lib/kraken_client/requests/post.rb
kraken_client-1.1.2 lib/kraken_client/requests/post.rb
kraken_client-1.1.1 lib/kraken_client/requests/post.rb