Sha256: 53c600852c89ed22d21e06d5cc89e7343f58e4683a1a8eedc1f55416b66d1683

Contents?: true

Size: 710 Bytes

Versions: 16

Compression:

Stored size: 710 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.respond_to?(:env) ? config.env : config[:environment],
        :hostname => config[:hostname],
        :gem_version => Appsignal::VERSION
      },
      :headers => {
        "Content-Type" => "application/json; charset=UTF-8"
      }
    }
    body = Appsignal::Utils::JSON.generate(body) if body.is_a? Hash
    options[:body] = body if body
    endpoint = config[:endpoint] || Appsignal::Config::DEFAULT_CONFIG[:endpoint]
    stub_request(:post, "#{endpoint}/1/#{path}").with(options)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
appsignal-4.0.5-java spec/support/helpers/api_request_helper.rb
appsignal-4.0.5 spec/support/helpers/api_request_helper.rb
appsignal-4.0.4-java spec/support/helpers/api_request_helper.rb
appsignal-4.0.4 spec/support/helpers/api_request_helper.rb
appsignal-4.0.3-java spec/support/helpers/api_request_helper.rb
appsignal-4.0.3 spec/support/helpers/api_request_helper.rb
appsignal-4.0.2-java spec/support/helpers/api_request_helper.rb
appsignal-4.0.2 spec/support/helpers/api_request_helper.rb
appsignal-4.0.1-java spec/support/helpers/api_request_helper.rb
appsignal-4.0.1 spec/support/helpers/api_request_helper.rb
appsignal-4.0.0-java spec/support/helpers/api_request_helper.rb
appsignal-4.0.0 spec/support/helpers/api_request_helper.rb
appsignal-4.0.0.beta.2-java spec/support/helpers/api_request_helper.rb
appsignal-4.0.0.beta.2 spec/support/helpers/api_request_helper.rb
appsignal-4.0.0.beta.1-java spec/support/helpers/api_request_helper.rb
appsignal-4.0.0.beta.1 spec/support/helpers/api_request_helper.rb