Module: Octokit::Preview

Included in:
Client
Defined in:
lib/octokit/preview.rb

Overview

Default setup options for preview features

Constant Summary collapse

PREVIEW_TYPES =
{
  :branch_protection      => 'application/vnd.github.loki-preview+json'.freeze,
  :commit_search          => 'application/vnd.github.cloak-preview+json'.freeze,
  :migrations             => 'application/vnd.github.wyandotte-preview+json'.freeze,
  :licenses               => 'application/vnd.github.drax-preview+json'.freeze,
  :source_imports         => 'application/vnd.github.barred-rock-preview'.freeze,
  :reactions              => 'application/vnd.github.squirrel-girl-preview'.freeze,
  :issue_timelines        => 'application/vnd.github.mockingbird-preview+json'.freeze,
  :nested_teams           => 'application/vnd.github.hellcat-preview+json'.freeze,
  :pages                  => 'application/vnd.github.mister-fantastic-preview+json'.freeze,
  :projects               => 'application/vnd.github.inertia-preview+json'.freeze,
  :traffic                => 'application/vnd.github.spiderman-preview'.freeze,
  :integrations           => 'application/vnd.github.machine-man-preview+json'.freeze,
  :topics                 => 'application/vnd.github.mercy-preview+json'.freeze
}

Instance Method Summary collapse

Instance Method Details

#ensure_api_media_type(type, options) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/octokit/preview.rb', line 22

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

#warn_preview(type) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/octokit/preview.rb', line 30

def warn_preview(type)
  octokit_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