Class: Gem::Release::Context::Github
- Inherits:
-
Object
- Object
- Gem::Release::Context::Github
- Includes:
- Helper::Http
- Defined in:
- lib/gem/release/context/github.rb
Constant Summary collapse
- URL =
'https://api.github.com/repos/%s/releases'
- MSGS =
{ error: 'GitHub returned %s (body: %p)' }.freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(repo, data) ⇒ Github
constructor
A new instance of Github.
- #release ⇒ Object
Methods included from Helper::Http
Constructor Details
#initialize(repo, data) ⇒ Github
Returns a new instance of Github.
19 20 21 22 |
# File 'lib/gem/release/context/github.rb', line 19 def initialize(repo, data) @repo = repo @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
17 18 19 |
# File 'lib/gem/release/context/github.rb', line 17 def data @data end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
17 18 19 |
# File 'lib/gem/release/context/github.rb', line 17 def repo @repo end |
Instance Method Details
#release ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/gem/release/context/github.rb', line 24 def release # Create a release # https://developer.github.com/v3/repos/releases/#create-a-release resp = post(url, body, headers) status, body = resp # success status code is 201 (created) not 200 (ok) raise Abort, MSGS.fetch(:error) % [status, body] unless status == 201 end |