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.
-
#create_gist_comment(gist_id, comment, options = {}) ⇒ Hashie::Mash
Create gist comment.
-
#delete_gist(gist, options = {}) ⇒ Boolean
Delete a gist.
-
#delete_gist_comment(gist_id, gist_comment_id, options = {}) ⇒ Boolean
Delete gist comment.
-
#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_comment(gist_id, gist_comment_id, options = {}) ⇒ Hashie::Mash
Get gist comment.
-
#gist_comments(gist_id, options = {}) ⇒ Array<Hashie::Mash>
List gist comments.
-
#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.
-
#update_gist_comment(gist_id, gist_comment_id, comment, options = {}) ⇒ Hashie::Mash
Update gist comment.
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', end |
#create_gist_comment(gist_id, comment, options = {}) ⇒ Hashie::Mash
Create gist comment
Requires authenticated client.
162 163 164 165 |
# File 'lib/octokit/client/gists.rb', line 162 def create_gist_comment(gist_id, comment, ={}) .merge!({:body => comment}) post "gists/#{gist_id}/comments", end |
#delete_gist(gist, options = {}) ⇒ Boolean
Delete a gist
124 125 126 |
# File 'lib/octokit/client/gists.rb', line 124 def delete_gist(gist, ={}) boolean_from_response(:delete, "gists/#{Gist.new gist}", ) end |
#delete_gist_comment(gist_id, gist_comment_id, options = {}) ⇒ Boolean
Delete gist comment
Requires authenticated client.
195 196 197 |
# File 'lib/octokit/client/gists.rb', line 195 def delete_gist_comment(gist_id, gist_comment_id, ={}) boolean_from_response(:delete, "gists/#{gist_id}/comments/#{gist_comment_id}", ) 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}", end |
#fork_gist(gist, options = {}) ⇒ Hashie::Mash
Fork a gist
115 116 117 |
# File 'lib/octokit/client/gists.rb', line 115 def fork_gist(gist, ={}) post "gists/#{Gist.new gist}/forks", 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}", end |
#gist_comment(gist_id, gist_comment_id, options = {}) ⇒ Hashie::Mash
Get gist comment
147 148 149 |
# File 'lib/octokit/client/gists.rb', line 147 def gist_comment(gist_id, gist_comment_id, ={}) get "gists/#{gist_id}/comments/#{gist_comment_id}", end |
#gist_comments(gist_id, options = {}) ⇒ Array<Hashie::Mash>
List gist comments
135 136 137 |
# File 'lib/octokit/client/gists.rb', line 135 def gist_comments(gist_id, ={}) get "gists/#{gist_id}/comments", end |
#gist_starred?(gist, options = {}) ⇒ Boolean
Check if a gist is starred
106 107 108 |
# File 'lib/octokit/client/gists.rb', line 106 def gist_starred?(gist, ={}) boolean_from_response(:get, "gists/#{Gist.new gist}/star", ) 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', else get "users/#{username}/gists", 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', end |
#star_gist(gist, options = {}) ⇒ Boolean
Star a gist
88 89 90 |
# File 'lib/octokit/client/gists.rb', line 88 def star_gist(gist, ={}) boolean_from_response(:put, "gists/#{Gist.new gist}/star", ) 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', end |
#unstar_gist(gist, options = {}) ⇒ Boolean
Unstar a gist
97 98 99 |
# File 'lib/octokit/client/gists.rb', line 97 def unstar_gist(gist, ={}) boolean_from_response(:delete, "gists/#{Gist.new gist}/star", ) end |
#update_gist_comment(gist_id, gist_comment_id, comment, options = {}) ⇒ Hashie::Mash
Update gist comment
Requires authenticated client
179 180 181 182 |
# File 'lib/octokit/client/gists.rb', line 179 def update_gist_comment(gist_id, gist_comment_id, comment, ={}) .merge!({:body => comment}) patch "gists/#{gist_id}/comments/#{gist_comment_id}", end |