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.
166 167 168 169 |
# File 'lib/octokit/client/gists.rb', line 166 def create_gist_comment(gist_id, comment, ={}) .merge!({:body => comment}) post "gists/#{gist_id}/comments", end |
#delete_gist(gist, options = {}) ⇒ Boolean
Delete a gist
128 129 130 |
# File 'lib/octokit/client/gists.rb', line 128 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.
199 200 201 |
# File 'lib/octokit/client/gists.rb', line 199 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
82 83 84 |
# File 'lib/octokit/client/gists.rb', line 82 def edit_gist(gist, ={}) patch "gists/#{Gist.new gist}", end |
#fork_gist(gist, options = {}) ⇒ Hashie::Mash
Fork a gist
119 120 121 |
# File 'lib/octokit/client/gists.rb', line 119 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
151 152 153 |
# File 'lib/octokit/client/gists.rb', line 151 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
139 140 141 |
# File 'lib/octokit/client/gists.rb', line 139 def gist_comments(gist_id, ={}) get "gists/#{gist_id}/comments", end |
#gist_starred?(gist, options = {}) ⇒ Boolean
Check if a gist is starred
110 111 112 |
# File 'lib/octokit/client/gists.rb', line 110 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
92 93 94 |
# File 'lib/octokit/client/gists.rb', line 92 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
101 102 103 |
# File 'lib/octokit/client/gists.rb', line 101 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
183 184 185 186 |
# File 'lib/octokit/client/gists.rb', line 183 def update_gist_comment(gist_id, gist_comment_id, comment, ={}) .merge!({:body => comment}) patch "gists/#{gist_id}/comments/#{gist_comment_id}", end |