Module: GitHub::Client::Gists
- Included in:
- GitHub::Client
- Defined in:
- lib/github_api_v3/client/gists.rb
Overview
Contains methods for the Gists API.
Instance Method Summary collapse
-
#create_gist(files = {}, options = {:public => true}) ⇒ Hash
Create a gist.
-
#create_gist_comment(id, comment) ⇒ Hash
Create a gist comment.
-
#delete_gist(id) ⇒ Boolean
Delete a gist.
-
#delete_gist_comment(id, comment_id) ⇒ Boolean
Delete a gist comment.
-
#edit_gist(id, files = {}, options = {:public => true}) ⇒ Hash
Edit a gist.
-
#edit_gist_comment(id, comment_id, comment) ⇒ Hash
Edit an existing gist comment.
-
#fork_gist(id) ⇒ Boolean
Fork a gist.
-
#gist(id) ⇒ Hash
Get a single gist.
-
#gist_comment(id, comment_id) ⇒ Hash
Get a single comment on a gist.
-
#gist_comments(id) ⇒ Array
List comments on a gist.
-
#gist_starred?(id) ⇒ Boolean
Check if a gist is starred.
-
#gists(username = nil) ⇒ Array
List gists.
-
#star_gist(id) ⇒ Boolean
Star a gist.
-
#unstar_gist(id) ⇒ Boolean
Unstar a gist.
Instance Method Details
#create_gist(files = {}, options = {:public => true}) ⇒ Hash
Create a gist.
Requires authentication
53 54 55 56 |
# File 'lib/github_api_v3/client/gists.rb', line 53 def create_gist(files={}, ={:public => true}) .merge!(files) post "/gists", body: end |
#create_gist_comment(id, comment) ⇒ Hash
Create a gist comment.
Requires authentication.
168 169 170 |
# File 'lib/github_api_v3/client/gists.rb', line 168 def create_gist_comment(id, comment) post "/gists/#{id}/comments", body: { body: comment } end |
#delete_gist(id) ⇒ Boolean
Delete a gist.
Requires authentication.
131 132 133 |
# File 'lib/github_api_v3/client/gists.rb', line 131 def delete_gist(id) boolean_request :delete, "/gists/#{id}" end |
#delete_gist_comment(id, comment_id) ⇒ Boolean
Delete a gist comment.
Requires authentication.
197 198 199 |
# File 'lib/github_api_v3/client/gists.rb', line 197 def delete_gist_comment(id, comment_id) boolean_request :delete, "/gists/#{id}/comments/#{comment_id}" end |
#edit_gist(id, files = {}, options = {:public => true}) ⇒ Hash
Edit a gist
Requires authentication.
68 69 70 71 |
# File 'lib/github_api_v3/client/gists.rb', line 68 def edit_gist(id, files={}, ={:public => true}) .merge!(files) patch "/gists/#{id}", body: end |
#edit_gist_comment(id, comment_id, comment) ⇒ Hash
Edit an existing gist comment.
Requires authentication.
183 184 185 |
# File 'lib/github_api_v3/client/gists.rb', line 183 def edit_gist_comment(id, comment_id, comment) patch "/gists/#{id}/comments/#{comment_id}", body: { body: comment } end |
#fork_gist(id) ⇒ Boolean
Fork a gist.
Requires authentication.
119 120 121 |
# File 'lib/github_api_v3/client/gists.rb', line 119 def fork_gist(id) boolean_request :post, "/gists/#{id}/fork" end |
#gist(id) ⇒ Hash
Get a single gist.
37 38 39 |
# File 'lib/github_api_v3/client/gists.rb', line 37 def gist(id) get "/gists/#{id}" end |
#gist_comment(id, comment_id) ⇒ Hash
Get a single comment on a gist.
154 155 156 |
# File 'lib/github_api_v3/client/gists.rb', line 154 def gist_comment(id, comment_id) get "/gists/#{id}/comments/#{comment_id}" end |
#gist_comments(id) ⇒ Array
List comments on a gist.
142 143 144 |
# File 'lib/github_api_v3/client/gists.rb', line 142 def gist_comments(id) get "/gists/#{id}/comments" end |
#gist_starred?(id) ⇒ Boolean
Check if a gist is starred.
Requires authentication.
80 81 82 |
# File 'lib/github_api_v3/client/gists.rb', line 80 def gist_starred?(id) boolean_request :get, "/gists/#{id}/star" end |
#gists(username = nil) ⇒ Array
List gists.
Gets a list of all gists for a specified user. If called without username, returns gists for the authenticated user. If unauthenticated, returns all public gists.
22 23 24 25 26 27 28 |
# File 'lib/github_api_v3/client/gists.rb', line 22 def gists(username=nil) if username get "/users/#{username}/gists" else get "/gists" end end |
#star_gist(id) ⇒ Boolean
Star a gist.
Requires authentication.
93 94 95 |
# File 'lib/github_api_v3/client/gists.rb', line 93 def star_gist(id) boolean_request :put, "/gists/#{id}/star" end |
#unstar_gist(id) ⇒ Boolean
Unstar a gist.
Requires authentication.
106 107 108 |
# File 'lib/github_api_v3/client/gists.rb', line 106 def unstar_gist(id) boolean_request :delete, "/gists/#{id}/star" end |