A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://rubydoc.info/github/piotrmurach/github/master/Github/MimeType below:

MimeType – Documentation for piotrmurach/github (master) – RubyDoc.info

Module: Github::MimeType
Included in:
API, ParamsHash
Defined in:
lib/github_api/mime_type.rb
Constant Summary collapse
MEDIA_LOOKUP =
{
  'json' => 'json',
  'blob' => 'raw',
  'raw'  => 'raw+json',
  'text' => 'text+json',
  'html' => 'html+json',
  'full' => 'full+json'
}
Instance Method Summary collapse Instance Method Details #lookup_media(name) ⇒ Object
26
27
28
29
30
# File 'lib/github_api/mime_type.rb', line 26

def lookup_media(name)
  MEDIA_LOOKUP.fetch(name) do
    raise ArgumentError, "Provided Media Type #{name} is not valid"
  end
end
#parse(media) ⇒ Object
17
18
19
20
21
22
23
24
# File 'lib/github_api/mime_type.rb', line 17

def parse(media)
  version = 'v3'
  media.sub!(/^[.]*|[.]*$/,"")
  media = media.include?('+') ? media.split('+')[0] : media
  version, media = media.split('.') if media.include?('.')
  media_type = lookup_media(media)
  "application/vnd.github.#{version}.#{media_type}"
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4