Sha256: f86a015d659752b29fcfb1ec9408efd3565fe0a5e93b650e53b0fc714dccd3a0

Contents?: true

Size: 673 Bytes

Versions: 5

Compression:

Stored size: 673 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

5 entries across 5 versions & 1 rubygems

Version Path
appsignal-2.1.2 spec/support/helpers/api_request_helper.rb
appsignal-2.1.1 spec/support/helpers/api_request_helper.rb
appsignal-2.1.1.beta.1 spec/support/helpers/api_request_helper.rb
appsignal-2.1.0 spec/support/helpers/api_request_helper.rb
appsignal-2.1.0.beta.1 spec/support/helpers/api_request_helper.rb