Sha256: 8c38a0bfbf1faaa0029db6edb1fd2ac8e128f0a3c3ac62ed1472793c731fbab8

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true
require 'heroics'
require 'rate_throttle_client'

require_relative '../lib/platform-api.rb'

Heroics.default_configuration do |config|
  config.base_url = 'https://api.heroku.com'
  config.module_name = 'PlatformAPI'
  config.schema_filepath = File.join(File.expand_path('../..', __FILE__), 'schema.json')

  PlatformAPI.rate_throttle = ->(&block) {
    @deprecate_on_first ||= begin
      message = String.new("[Warning] Starting in PlatformAPI version 3+, requests will include rate throttling logic\n")
      message << "to opt-out of this behavior set: `PlatformAPI.rate_throttle = RateThrottleClient::Null.new`\n"
      message << "to silence this warning and opt-in to this logic, upgrade to PlatformAPI version 3+"
      warn message
      true
    end
    block.call
  }
  config.rate_throttle = PlatformAPI.rate_throttle
  config.acceptable_status_codes = [429]

  config.headers = {
    'Accept'      => 'application/vnd.heroku+json; version=3',
    'User-Agent'  => "platform-api/#{PlatformAPI::VERSION}"
  }
  config.ruby_name_replacement_patterns = {
    /add[^a-z]+on/i => 'addon',
    /[\s-]+/ => '_',
  }
  # This needs to be in single quotes to avoid interpolation during the client
  # build
  config.cache_path = '#{Dir.home}/.heroics/platform-api'
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
platform-api-2.3.0 config/client-config.rb
platform-api-2.3.0.pre.2 config/client-config.rb