Module: Octokit::Client::Gists
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/gists.rb
Instance Method Summary collapse
- #create_gist(options = {}) ⇒ Object
- #delete_gist(gist, options = {}) ⇒ Object
- #edit_gist(gist, options = {}) ⇒ Object
- #fork_gist(gist, options = {}) ⇒ Object
- #gist(gist, options = {}) ⇒ Object
-
#gist_starred?(gist, options = {}) ⇒ Boolean
Returns
true
ifgist
is starred,false
otherwise. - #gists(username = nil, options = {}) ⇒ Object
- #public_gists(options = {}) ⇒ Object
-
#star_gist(gist, options = {}) ⇒ Object
Returns
true
orfalse
based on success. - #starred_gists(options = {}) ⇒ Object
-
#unstar_gist(gist, options = {}) ⇒ Object
Returns
true
orfalse
based on success.
Instance Method Details
#create_gist(options = {}) ⇒ Object
5 6 7 |
# File 'lib/octokit/client/gists.rb', line 5 def create_gist(={}) post 'gists', , 3 end |
#delete_gist(gist, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/octokit/client/gists.rb', line 9 def delete_gist(gist, ={}) response = delete("gists/#{Gist.new gist}", , 3, true, true) response.status == 204 end |
#edit_gist(gist, options = {}) ⇒ Object
14 15 16 |
# File 'lib/octokit/client/gists.rb', line 14 def edit_gist(gist, ={}) patch "gists/#{Gist.new gist}", , 3 end |
#fork_gist(gist, options = {}) ⇒ Object
40 41 42 |
# File 'lib/octokit/client/gists.rb', line 40 def fork_gist(gist, ={}) post "gists/#{Gist.new gist}/fork", , 3 end |
#gist(gist, options = {}) ⇒ Object
18 19 20 |
# File 'lib/octokit/client/gists.rb', line 18 def gist(gist, ={}) get "gists/#{Gist.new gist}", , 3 end |
#gist_starred?(gist, options = {}) ⇒ Boolean
Returns true
if gist
is starred, false
otherwise.
31 32 33 34 35 36 37 38 |
# File 'lib/octokit/client/gists.rb', line 31 def gist_starred?(gist, ={}) begin get("gists/#{Gist.new gist}/star", , 3, true, true) return true rescue Octokit::NotFound return false end end |
#gists(username = nil, options = {}) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/octokit/client/gists.rb', line 22 def gists(username=nil, ={}) if username.nil? get 'gists', , 3 else get "users/#{username}/gists", , 3 end end |
#public_gists(options = {}) ⇒ Object
44 45 46 |
# File 'lib/octokit/client/gists.rb', line 44 def public_gists(={}) get 'gists', , 3 end |
#star_gist(gist, options = {}) ⇒ Object
Returns true
or false
based on success.
53 54 55 56 |
# File 'lib/octokit/client/gists.rb', line 53 def star_gist(gist, ={}) response = put("gists/#{Gist.new gist}/star", , 3, true, true) response.status == 204 end |
#starred_gists(options = {}) ⇒ Object
48 49 50 |
# File 'lib/octokit/client/gists.rb', line 48 def starred_gists(={}) get 'gists/starred', , 3 end |