Sha256: 5cc7784dec314447337353b7246ba1fcd377aafe6d85ee81b4500be9034904e6

Contents?: true

Size: 674 Bytes

Versions: 13

Compression:

Stored size: 674 Bytes

Contents

module ApiRequestHelper
  def stub_api_request(config, path, body = nil)
    options = {
      :query => {
        :api_key => config[:push_api_key],
        :name => config[:name],
        :environment => config.env,
        :hostname => config[:hostname],
        :gem_version => Appsignal::VERSION
      },
      :headers => {
        'Content-Encoding' => 'gzip',
        'Content-Type' => 'application/json; charset=UTF-8',
      }
    }
    if body.is_a? Hash
      body = Appsignal::Utils::Gzip.compress(Appsignal::Utils::JSON.generate(body))
    end
    options[:body] = body if body
    stub_request(:post, "#{config[:endpoint]}/1/#{path}").with(options)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
appsignal-2.0.6 spec/support/helpers/api_request_helper.rb
appsignal-2.0.5 spec/support/helpers/api_request_helper.rb
appsignal-2.0.5.beta.1 spec/support/helpers/api_request_helper.rb
appsignal-2.1.0.alpha.3 spec/support/helpers/api_request_helper.rb
appsignal-2.1.0.alpha.2 spec/support/helpers/api_request_helper.rb
appsignal-2.1.0.alpha.1 spec/support/helpers/api_request_helper.rb
appsignal-2.0.4 spec/support/helpers/api_request_helper.rb
appsignal-2.0.3 spec/support/helpers/api_request_helper.rb
appsignal-2.0.2 spec/support/helpers/api_request_helper.rb
appsignal-2.0.1 spec/support/helpers/api_request_helper.rb
appsignal-2.0.0 spec/support/helpers/api_request_helper.rb
appsignal-2.0.0.beta.1 spec/support/helpers/api_request_helper.rb
appsignal-1.4.0.beta.1 spec/support/helpers/api_request_helper.rb