Module: Octokit::Preview

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

Overview

Default setup options for preview features

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#ensure_api_media_type(type, options) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/octokit/preview.rb', line 11

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

#warn_preview(type) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/octokit/preview.rb', line 19

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