Sha256: 01b7231940aba2b0ca2c42a9aa3fe22140e597f9f066cbc46bf187080a2bb133

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

module Octokit

  # Default setup options for preview features
  module Preview

    PREVIEW_TYPES = {
      :branch_protection => 'application/vnd.github.loki-preview+json'.freeze,
      :migrations        => 'application/vnd.github.wyandotte-preview+json'.freeze,
      :licenses          => 'application/vnd.github.drax-preview+json'.freeze
    }

    def ensure_api_media_type(type, options)
      if options[:accept].nil?
        options[:accept] = PREVIEW_TYPES[type]
        warn_preview(type)
      end
      options
    end

    def warn_preview(type)
      warn <<-EOS
WARNING: The preview version of the #{type.to_s.capitalize} API is not yet suitable for production use.
You can avoid this message by supplying an appropriate media type in the 'Accept' request
header.
EOS
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/octokit-4.2.0/lib/octokit/preview.rb
octokit-4.2.0 lib/octokit/preview.rb