Sha256: d4dbb1c36116e361cff3b6d86c323f5c8a952f176f0c1c8dac803d0b89344d7f
Contents?: true
Size: 860 Bytes
Versions: 15
Compression:
Stored size: 860 Bytes
Contents
module CiviCrm 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_civicrm_client CiviCrm.api_key = 'civicrm' CiviCrm.site_key = 'civicrm' CiviCrm::Client.mock_rest_client(double) end
Version data entries
15 entries across 15 versions & 1 rubygems