Module: Octokit::Client::Gists
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/gists.rb
Instance Method Summary collapse
-
#create_gist(options = {}) ⇒ Hashie::Mash
Create a gist.
-
#delete_gist(gist, options = {}) ⇒ Boolean
Delete a gist.
-
#edit_gist(gist, options = {}) ⇒ Object
Edit a gist.
-
#fork_gist(gist, options = {}) ⇒ Hashie::Mash
Fork a gist.
-
#gist(gist, options = {}) ⇒ Hash::Mash
Get a single gist.
-
#gist_starred?(gist, options = {}) ⇒ Boolean
Check if a gist is starred.
-
#gists(username = nil, options = {}) ⇒ Array<Hashie::Mash>
(also: #list_gists)
List gists for a user or all public gists.
-
#public_gists(options = {}) ⇒ Array<Hashie::Mash>
List public gists.
-
#star_gist(gist, options = {}) ⇒ Boolean
Star a gist.
-
#starred_gists(options = {}) ⇒ Array<Hashie::Mash>
List the authenticated user’s starred gists.
-
#unstar_gist(gist, options = {}) ⇒ Boolean
Unstar a gist.
Instance Method Details
#create_gist(options = {}) ⇒ Hashie::Mash
Create a gist
59 60 61 |
# File 'lib/octokit/client/gists.rb', line 59 def create_gist(={}) post 'gists', , 3 end |
#delete_gist(gist, options = {}) ⇒ Boolean
Delete a gist
130 131 132 133 |
# File 'lib/octokit/client/gists.rb', line 130 def delete_gist(gist, ={}) response = delete("gists/#{Gist.new gist}", , 3, true, true) response.status == 204 end |
#edit_gist(gist, options = {}) ⇒ Object
Edit a gist
78 79 80 |
# File 'lib/octokit/client/gists.rb', line 78 def edit_gist(gist, ={}) patch "gists/#{Gist.new gist}", , 3 end |
#fork_gist(gist, options = {}) ⇒ Hashie::Mash
Fork a gist
121 122 123 |
# File 'lib/octokit/client/gists.rb', line 121 def fork_gist(gist, ={}) post "gists/#{Gist.new gist}/fork", , 3 end |
#gist(gist, options = {}) ⇒ Hash::Mash
Get a single gist
45 46 47 |
# File 'lib/octokit/client/gists.rb', line 45 def gist(gist, ={}) get "gists/#{Gist.new gist}", , 3 end |
#gist_starred?(gist, options = {}) ⇒ Boolean
Check if a gist is starred
107 108 109 110 111 112 113 114 |
# File 'lib/octokit/client/gists.rb', line 107 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 = {}) ⇒ Array<Hashie::Mash> Also known as: list_gists
List gists for a user or all public gists
14 15 16 17 18 19 20 |
# File 'lib/octokit/client/gists.rb', line 14 def gists(username=nil, ={}) if username.nil? get 'gists', , 3 else get "users/#{username}/gists", , 3 end end |
#public_gists(options = {}) ⇒ Array<Hashie::Mash>
List public gists
29 30 31 |
# File 'lib/octokit/client/gists.rb', line 29 def public_gists(={}) get 'gists/public', , 3 end |
#star_gist(gist, options = {}) ⇒ Boolean
Star a gist
87 88 89 90 |
# File 'lib/octokit/client/gists.rb', line 87 def star_gist(gist, ={}) response = put("gists/#{Gist.new gist}/star", , 3, true, true) response.status == 204 end |
#starred_gists(options = {}) ⇒ Array<Hashie::Mash>
List the authenticated user’s starred gists
36 37 38 |
# File 'lib/octokit/client/gists.rb', line 36 def starred_gists(={}) get 'gists/starred', , 3 end |