Class: Github::Client::Repos::Releases

Inherits:
API
  • Object
show all
Defined in:
lib/github_api/client/repos/releases.rb

Overview

The Releases API

Defined Under Namespace

Classes: Assets, Tags

Constant Summary

Constants included from MimeType

MimeType::MEDIA_LOOKUP

Constants included from Github::Constants

Github::Constants::ACCEPT, Github::Constants::ACCEPTED_OAUTH_SCOPES, Github::Constants::ACCEPT_CHARSET, Github::Constants::CACHE_CONTROL, Github::Constants::CONTENT_LENGTH, Github::Constants::CONTENT_TYPE, Github::Constants::DATE, Github::Constants::ETAG, Github::Constants::HEADER_LAST, Github::Constants::HEADER_LINK, Github::Constants::HEADER_NEXT, Github::Constants::LOCATION, Github::Constants::META_FIRST, Github::Constants::META_LAST, Github::Constants::META_NEXT, Github::Constants::META_PREV, Github::Constants::META_REL, Github::Constants::OAUTH_SCOPES, Github::Constants::PARAM_PAGE, Github::Constants::PARAM_PER_PAGE, Github::Constants::PARAM_START_PAGE, Github::Constants::RATELIMIT_LIMIT, Github::Constants::RATELIMIT_REMAINING, Github::Constants::RATELIMIT_RESET, Github::Constants::SERVER, Github::Constants::USER_AGENT

Instance Attribute Summary

Attributes inherited from API

#current_options

Instance Method Summary collapse

Methods inherited from API

after_callbacks, after_request, #api_methods_in, #arguments, before_callbacks, before_request, clear_request_methods!, #execute, extend_with_actions, extra_methods, #extract_basic_auth, extract_class_name, #filter_callbacks, inherited, #initialize, internal_methods, method_added, #method_missing, #module_methods_in, namespace, request_methods, root!, #run_callbacks, #set, #yield_or_eval

Methods included from Github::ClassMethods

#configuration, #configure, #require_all

Methods included from RateLimit

#ratelimit, #ratelimit_remaining, #ratelimit_reset

Methods included from Request::Verbs

#delete_request, #get_request, #head_request, #options_request, #patch_request, #post_request, #put_request

Methods included from MimeType

#lookup_media, #parse

Methods included from Authorization

#auth_code, #authenticated?, #authentication, #authorize_url, #basic_authed?, #client, #get_token

Constructor Details

This class inherits a constructor from Github::API

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Github::API

Instance Method Details

#create(*args) ⇒ Object

Create a release

Users with push access to the repository can create a release.

Examples:

github = Github.new
github.repos.releases.create 'owner', 'repo',
  tag_name: "v1.0.0",
  target_commitish: "master",
  name: "v1.0.0",
  body: "Description of the release",
  draft: false,
  prerelease: false

Parameters:

See Also:


90
91
92
93
94
95
96
97
# File 'lib/github_api/client/repos/releases.rb', line 90

def create(*args)
  arguments(args, required: [:owner, :repo]) do
    assert_required :tag_name
  end

  post_request("/repos/#{arguments.owner}/#{arguments.repo}/releases",
               arguments.params)
end

#delete(*args) ⇒ Object

Delete a release

Users with push access to the repository can delete a release.

Examples:

github = Github.new
github.repos.releases.delete 'owner', 'repo', 'id'

Parameters:

  • :owner (String)
  • :repo (String)
  • :id (Integer)

See Also:


160
161
162
163
164
# File 'lib/github_api/client/repos/releases.rb', line 160

def delete(*args)
  arguments(args, required: [:owner, :repo, :id]).params

  delete_request("/repos/#{arguments.owner}/#{arguments.repo}/releases/#{arguments.id}", arguments.params)
end

#edit(*args) ⇒ Object Also known as: update

Edit a release

Users with push access to the repository can edit a release.

Examples:

github = Github.new
github.repos.releases.edit 'owner', 'repo', 'id',
  tag_name: "v1.0.0",
  target_commitish: "master",
  name: "v1.0.0",
  body: "Description of the release",
  draft: false,
  prerelease: false

Parameters:

  • :owner (String)
  • :repo (String)
  • :id (Integer)
  • params (Hash)

See Also:


138
139
140
141
142
# File 'lib/github_api/client/repos/releases.rb', line 138

def edit(*args)
  arguments(args, required: [:owner, :repo, :id])

  patch_request("/repos/#{arguments.owner}/#{arguments.repo}/releases/#{arguments.id}", arguments.params)
end

#get(*args) ⇒ Object Also known as: find

Get a single release

Examples:

github = Github.new
github.repos.releases.get 'owner', 'repo', 'id'

See Also:


47
48
49
50
51
# File 'lib/github_api/client/repos/releases.rb', line 47

def get(*args)
  arguments(args, required: [:owner, :repo, :id]).params

  get_request("/repos/#{arguments.owner}/#{arguments.repo}/releases/#{arguments.id}" , arguments.params)
end

#latest(*args) ⇒ Object

Get the latest release

View the latest published full release for the repository. Draft releases and prereleases are not returned.

Examples:

github = Github.new
github.repos.releases.latest 'owner', 'repo'

Parameters:

  • :owner (String)
  • :repo (String)

See Also:


181
182
183
184
185
# File 'lib/github_api/client/repos/releases.rb', line 181

def latest(*args)
  arguments(args, required: [:owner, :repo]).params

  get_request("repos/#{arguments.owner}/#{arguments.repo}/releases/latest", arguments.params)
end

#list(*args) ⇒ Object Also known as: all

List releases for a repository

Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only.

Examples:

github = Github.new
github.repos.releases.list 'owner', 'repo'
github.repos.releases.list 'owner', 'repo' { |release| ... }

See Also:


29
30
31
32
33
34
35
# File 'lib/github_api/client/repos/releases.rb', line 29

def list(*args)
  arguments(args, required: [:owner, :repo])

  response = get_request("/repos/#{arguments.owner}/#{arguments.repo}/releases", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end