Sha256: 8c163bdb81a2da460d7ea3ba013b413308324b42554027193f19f981956e2a0b

Contents?: true

Size: 820 Bytes

Versions: 5

Compression:

Stored size: 820 Bytes

Contents

module Paysio
  class Client
    class << self
      @mock_rest_client = nil
      def mock_rest_client(mock_client)
        @mock_rest_client = mock_client
      end

      alias_method :execute!, :execute
      def execute(opts)
        get_params = (opts[:headers] || {})[:params]
        post_params = opts[:payload]
        case opts[:method]
        when :get then @mock_rest_client.get opts[:url], get_params, post_params
        when :post then @mock_rest_client.post opts[:url], get_params, post_params
        when :put then @mock_rest_client.put opts[:url], get_params, post_params
        when :delete then @mock_rest_client.delete opts[:url], get_params, post_params
        end
      end
    end
  end
end
def authorized_paysio_client
  Paysio.api_key = 'paysio'
  Paysio::Client.mock_rest_client(mock)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
paysio-1.0.10 spec/support/paysio.rb
paysio-1.0.9 spec/support/paysio.rb
paysio-1.0.8 spec/support/paysio.rb
paysio-1.0.7 spec/support/paysio.rb
paysio-1.0.6 spec/support/paysio.rb