octodoggy 4.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/CONTRIBUTING.md +22 -0
  4. data/LICENSE.md +20 -0
  5. data/README.md +714 -0
  6. data/Rakefile +22 -0
  7. data/lib/ext/sawyer/relation.rb +10 -0
  8. data/lib/octokit.rb +59 -0
  9. data/lib/octokit/arguments.rb +14 -0
  10. data/lib/octokit/authentication.rb +82 -0
  11. data/lib/octokit/client.rb +238 -0
  12. data/lib/octokit/client/authorizations.rb +244 -0
  13. data/lib/octokit/client/commit_comments.rb +95 -0
  14. data/lib/octokit/client/commits.rb +239 -0
  15. data/lib/octokit/client/contents.rb +162 -0
  16. data/lib/octokit/client/deployments.rb +62 -0
  17. data/lib/octokit/client/downloads.rb +50 -0
  18. data/lib/octokit/client/emojis.rb +18 -0
  19. data/lib/octokit/client/events.rb +151 -0
  20. data/lib/octokit/client/feeds.rb +33 -0
  21. data/lib/octokit/client/gists.rb +233 -0
  22. data/lib/octokit/client/gitignore.rb +43 -0
  23. data/lib/octokit/client/hooks.rb +297 -0
  24. data/lib/octokit/client/integrations.rb +77 -0
  25. data/lib/octokit/client/issues.rb +321 -0
  26. data/lib/octokit/client/labels.rb +156 -0
  27. data/lib/octokit/client/legacy_search.rb +42 -0
  28. data/lib/octokit/client/licenses.rb +45 -0
  29. data/lib/octokit/client/markdown.rb +27 -0
  30. data/lib/octokit/client/meta.rb +21 -0
  31. data/lib/octokit/client/milestones.rb +87 -0
  32. data/lib/octokit/client/notifications.rb +171 -0
  33. data/lib/octokit/client/objects.rb +141 -0
  34. data/lib/octokit/client/organizations.rb +768 -0
  35. data/lib/octokit/client/pages.rb +63 -0
  36. data/lib/octokit/client/projects.rb +314 -0
  37. data/lib/octokit/client/pub_sub_hubbub.rb +111 -0
  38. data/lib/octokit/client/pull_requests.rb +301 -0
  39. data/lib/octokit/client/rate_limit.rb +54 -0
  40. data/lib/octokit/client/reactions.rb +158 -0
  41. data/lib/octokit/client/refs.rb +118 -0
  42. data/lib/octokit/client/releases.rb +163 -0
  43. data/lib/octokit/client/repositories.rb +654 -0
  44. data/lib/octokit/client/repository_invitations.rb +103 -0
  45. data/lib/octokit/client/reviews.rb +174 -0
  46. data/lib/octokit/client/say.rb +19 -0
  47. data/lib/octokit/client/search.rb +76 -0
  48. data/lib/octokit/client/service_status.rb +38 -0
  49. data/lib/octokit/client/source_import.rb +161 -0
  50. data/lib/octokit/client/stats.rb +105 -0
  51. data/lib/octokit/client/statuses.rb +47 -0
  52. data/lib/octokit/client/traffic.rb +69 -0
  53. data/lib/octokit/client/users.rb +354 -0
  54. data/lib/octokit/configurable.rb +147 -0
  55. data/lib/octokit/connection.rb +199 -0
  56. data/lib/octokit/default.rb +166 -0
  57. data/lib/octokit/enterprise_admin_client.rb +40 -0
  58. data/lib/octokit/enterprise_admin_client/admin_stats.rb +120 -0
  59. data/lib/octokit/enterprise_admin_client/license.rb +18 -0
  60. data/lib/octokit/enterprise_admin_client/orgs.rb +27 -0
  61. data/lib/octokit/enterprise_admin_client/search_indexing.rb +83 -0
  62. data/lib/octokit/enterprise_admin_client/users.rb +128 -0
  63. data/lib/octokit/enterprise_management_console_client.rb +50 -0
  64. data/lib/octokit/enterprise_management_console_client/management_console.rb +176 -0
  65. data/lib/octokit/error.rb +286 -0
  66. data/lib/octokit/gist.rb +36 -0
  67. data/lib/octokit/middleware/follow_redirects.rb +131 -0
  68. data/lib/octokit/organization.rb +17 -0
  69. data/lib/octokit/preview.rb +38 -0
  70. data/lib/octokit/rate_limit.rb +33 -0
  71. data/lib/octokit/repo_arguments.rb +19 -0
  72. data/lib/octokit/repository.rb +93 -0
  73. data/lib/octokit/response/feed_parser.rb +21 -0
  74. data/lib/octokit/response/raise_error.rb +21 -0
  75. data/lib/octokit/user.rb +19 -0
  76. data/lib/octokit/version.rb +17 -0
  77. data/lib/octokit/warnable.rb +17 -0
  78. data/octokit.gemspec +22 -0
  79. metadata +160 -0
@@ -0,0 +1,62 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Deployments API
5
+ #
6
+ # @see https://developer.github.com/v3/repos/commits/deployments/
7
+ module Deployments
8
+
9
+ # List all deployments for a repository
10
+ #
11
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
12
+ # @return [Array<Sawyer::Resource>] A list of deployments
13
+ # @see https://developer.github.com/v3/repos/deployments/#list-deployments
14
+ def deployments(repo, options = {})
15
+ get("#{Repository.path repo}/deployments", options)
16
+ end
17
+ alias :list_deployments :deployments
18
+
19
+ # Create a deployment for a ref
20
+ #
21
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
22
+ # @param ref [String] The ref to deploy
23
+ # @option options [String] :task Used by the deployment system to allow different execution paths. Defaults to "deploy".
24
+ # @option options [String] :payload Meta info about the deployment
25
+ # @option options [Boolean] :auto_merge Optional parameter to merge the default branch into the requested deployment branch if necessary. Default: true
26
+ # @option options [Array<String>] :required_contexts Optional array of status contexts verified against commit status checks.
27
+ # @option options [String] :environment Optional name for the target deployment environment (e.g., production, staging, qa). Default: "production"
28
+ # @option options [String] :description Optional short description.
29
+ # @return [Sawyer::Resource] A deployment
30
+ # @see https://developer.github.com/v3/repos/deployments/#create-a-deployment
31
+ def create_deployment(repo, ref, options = {})
32
+ options[:ref] = ref
33
+ post("#{Repository.path repo}/deployments", options)
34
+ end
35
+
36
+ # List all statuses for a Deployment
37
+ #
38
+ # @param deployment_url [String] A URL for a deployment resource
39
+ # @return [Array<Sawyer::Resource>] A list of deployment statuses
40
+ # @see https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
41
+ def deployment_statuses(deployment_url, options = {})
42
+ deployment = get(deployment_url, :accept => options[:accept])
43
+ get(deployment.rels[:statuses].href, options)
44
+ end
45
+ alias :list_deployment_statuses :deployment_statuses
46
+
47
+ # Create a deployment status for a Deployment
48
+ #
49
+ # @param deployment_url [String] A URL for a deployment resource
50
+ # @param state [String] The state: pending, success, failure, error
51
+ # @option options [String] :target_url The target URL to associate with this status. Default: ""
52
+ # @option options [String] :description A short description of the status. Maximum length of 140 characters. Default: ""
53
+ # @return [Sawyer::Resource] A deployment status
54
+ # @see https://developer.github.com/v3/repos/deployments/#create-a-deployment-status
55
+ def create_deployment_status(deployment_url, state, options = {})
56
+ deployment = get(deployment_url, :accept => options[:accept])
57
+ options[:state] = state.to_s.downcase
58
+ post(deployment.rels[:statuses].href, options)
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,50 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Repo Downloads API
5
+ #
6
+ # @see https://developer.github.com/v3/repos/downloads/
7
+ module Downloads
8
+
9
+ # List available downloads for a repository
10
+ #
11
+ # @param repo [Integer, String, Repository, Hash] A Github Repository
12
+ # @return [Array] A list of available downloads
13
+ # @deprecated As of December 11th, 2012: https://github.com/blog/1302-goodbye-uploads
14
+ # @see https://developer.github.com/v3/repos/downloads/#list-downloads-for-a-repository
15
+ # @example List all downloads for Github/Hubot
16
+ # Octokit.downloads("github/hubot")
17
+ def downloads(repo, options={})
18
+ paginate "#{Repository.path repo}/downloads", options
19
+ end
20
+ alias :list_downloads :downloads
21
+
22
+ # Get single download for a repository
23
+ #
24
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
25
+ # @param id [Integer] ID of the download
26
+ # @return [Sawyer::Resource] A single download from the repository
27
+ # @deprecated As of December 11th, 2012: https://github.com/blog/1302-goodbye-uploads
28
+ # @see https://developer.github.com/v3/repos/downloads/#get-a-single-download
29
+ # @example Get the "Robawt" download from Github/Hubot
30
+ # Octokit.download("github/hubot")
31
+ def download(repo, id, options={})
32
+ get "#{Repository.path repo}/downloads/#{id}", options
33
+ end
34
+
35
+ # Delete a single download for a repository
36
+ #
37
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
38
+ # @param id [Integer] ID of the download
39
+ # @deprecated As of December 11th, 2012: https://github.com/blog/1302-goodbye-uploads
40
+ # @see https://developer.github.com/v3/repos/downloads/#delete-a-download
41
+ # @return [Boolean] Status
42
+ # @example Get the "Robawt" download from Github/Hubot
43
+ # Octokit.delete_download("github/hubot", 1234)
44
+ def delete_download(repo, id, options = {})
45
+ boolean_from_response :delete, "#{Repository.path repo}/downloads/#{id}", options
46
+ end
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,18 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Emojis API
5
+ module Emojis
6
+
7
+ # List all emojis used on GitHub
8
+ #
9
+ # @return [Sawyer::Resource] A list of all emojis on GitHub
10
+ # @see https://developer.github.com/v3/emojis/#emojis
11
+ # @example List all emojis
12
+ # Octokit.emojis
13
+ def emojis(options = {})
14
+ get "emojis", options
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,151 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Method for the Events API
5
+ #
6
+ # @see https://developer.github.com/v3/activity/events/
7
+ # @see https://developer.github.com/v3/issues/events/
8
+ module Events
9
+
10
+ # List all public events for GitHub
11
+ #
12
+ # @return [Array<Sawyer::Resource>] A list of all public events from GitHub
13
+ # @see https://developer.github.com/v3/activity/events/#list-public-events
14
+ # @example List all pubilc events
15
+ # Octokit.public_events
16
+ def public_events(options = {})
17
+ paginate "events", options
18
+ end
19
+
20
+ # List all user events
21
+ #
22
+ # @param user [Integer, String] GitHub user login or id.
23
+ # @return [Array<Sawyer::Resource>] A list of all user events
24
+ # @see https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
25
+ # @example List all user events
26
+ # Octokit.user_events("sferik")
27
+ def user_events(user, options = {})
28
+ paginate "#{User.path user}/events", options
29
+ end
30
+
31
+ # List public user events
32
+ #
33
+ # @param user [Integer, String] GitHub user login or id
34
+ # @return [Array<Sawyer::Resource>] A list of public user events
35
+ # @see https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
36
+ # @example List public user events
37
+ # Octokit.user_events("sferik")
38
+ def user_public_events(user, options = {})
39
+ paginate "#{User.path user}/events/public", options
40
+ end
41
+
42
+ # List events that a user has received
43
+ #
44
+ # @param user [Integer, String] GitHub user login or id
45
+ # @return [Array<Sawyer::Resource>] A list of all user received events
46
+ # @see https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
47
+ # @example List all user received events
48
+ # Octokit.received_events("sferik")
49
+ def received_events(user, options = {})
50
+ paginate "#{User.path user}/received_events", options
51
+ end
52
+
53
+ # List public events a user has received
54
+ #
55
+ # @param user [Integer, String] GitHub user login or id
56
+ # @return [Array<Sawyer::Resource>] A list of public user received events
57
+ # @see https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
58
+ # @example List public user received events
59
+ # Octokit.received_public_events("sferik")
60
+ def received_public_events(user, options = {})
61
+ paginate "#{User.path user}/received_events/public", options
62
+ end
63
+
64
+ # List events for a repository
65
+ #
66
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
67
+ # @return [Array<Sawyer::Resource>] A list of events for a repository
68
+ # @see https://developer.github.com/v3/activity/events/#list-repository-events
69
+ # @example List events for a repository
70
+ # Octokit.repository_events("sferik/rails_admin")
71
+ def repository_events(repo, options = {})
72
+ paginate "#{Repository.path repo}/events", options
73
+ end
74
+
75
+ # List public events for a repository's network
76
+ #
77
+ # @param repo [String, Repository, Hash] A GitHub repository
78
+ # @return [Array<Sawyer::Resource>] A list of events for a repository's network
79
+ # @see https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
80
+ # @example List events for a repository's network
81
+ # Octokit.repository_network_events("sferik/rails_admin")
82
+ def repository_network_events(repo, options = {})
83
+ paginate "networks/#{Repository.new(repo)}/events", options
84
+ end
85
+
86
+ # List all events for an organization
87
+ #
88
+ # Requires authenticated client.
89
+ #
90
+ # @param org [String] Organization GitHub handle
91
+ # @return [Array<Sawyer::Resource>] List of all events from a GitHub organization
92
+ # @see https://developer.github.com/v3/activity/events/#list-events-for-an-organization
93
+ # @example List events for the lostisland organization
94
+ # @client.organization_events("lostisland")
95
+ def organization_events(org, options = {})
96
+ paginate "users/#{login}/events/orgs/#{org}", options
97
+ end
98
+
99
+ # List an organization's public events
100
+ #
101
+ # @param org [String, Integer] Organization GitHub login or id.
102
+ # @return [Array<Sawyer::Resource>] List of public events from a GitHub organization
103
+ # @see https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
104
+ # @example List public events for GitHub
105
+ # Octokit.organization_public_events("GitHub")
106
+ def organization_public_events(org, options = {})
107
+ paginate "#{Organization.path org}/events", options
108
+ end
109
+
110
+ # Get all Issue Events for a given Repository
111
+ #
112
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
113
+ #
114
+ # @return [Array<Sawyer::Resource>] Array of all Issue Events for this Repository
115
+ # @see https://developer.github.com/v3/issues/events/#list-events-for-a-repository
116
+ # @see https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
117
+ # @example Get all Issue Events for Octokit
118
+ # Octokit.repository_issue_events("octokit/octokit.rb")
119
+ def repository_issue_events(repo, options = {})
120
+ paginate "#{Repository.path repo}/issues/events", options
121
+ end
122
+ alias :repo_issue_events :repository_issue_events
123
+
124
+ # List events for an Issue
125
+ #
126
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
127
+ # @param number [Integer] Issue number
128
+ #
129
+ # @return [Array<Sawyer::Resource>] Array of events for that issue
130
+ # @see https://developer.github.com/v3/issues/events/#list-events-for-an-issue
131
+ # @example List all issues events for issue #38 on octokit/octokit.rb
132
+ # Octokit.issue_events("octokit/octokit.rb", 38)
133
+ def issue_events(repo, number, options = {})
134
+ paginate "#{Repository.path repo}/issues/#{number}/events", options
135
+ end
136
+
137
+ # Get information on a single Issue Event
138
+ #
139
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
140
+ # @param number [Integer] Event number
141
+ #
142
+ # @return [Sawyer::Resource] A single Event for an Issue
143
+ # @see https://developer.github.com/v3/issues/events/#get-a-single-event
144
+ # @example Get Event information for ID 3094334 (a pull request was closed)
145
+ # Octokit.issue_event("octokit/octokit.rb", 3094334)
146
+ def issue_event(repo, number, options = {})
147
+ paginate "#{Repository.path repo}/issues/events/#{number}", options
148
+ end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,33 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Feeds API
5
+ #
6
+ # @see https://developer.github.com/v3/activity/feeds/
7
+ module Feeds
8
+
9
+ # List Feeds
10
+ #
11
+ # The feeds returned depend on authentication, see the GitHub API docs
12
+ # for more information.
13
+ #
14
+ # @return [Array<Sawyer::Resource>] list of feeds
15
+ # @see https://developer.github.com/v3/activity/feeds/#list-feeds
16
+ def feeds
17
+ get "feeds"
18
+ end
19
+
20
+ # Get a Feed by name
21
+ #
22
+ # @param name [Symbol, String] Name of feed to retrieve.
23
+ # @return [Feed] Parsed feed in the format returned by the configured
24
+ # parser.
25
+ def feed(name, options = {})
26
+ if rel = feeds._links[name]
27
+ get rel.href, :accept => rel.type, :options => options
28
+ end
29
+ end
30
+
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,233 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Gists API
5
+ #
6
+ # @see https://developer.github.com/v3/gists/
7
+ module Gists
8
+
9
+ # List gists for a user or all public gists
10
+ #
11
+ # @param user [String] An optional user to filter listing
12
+ # @return [Array<Sawyer::Resource>] A list of gists
13
+ # @example Fetch all gists for defunkt
14
+ # Octokit.gists('defunkt')
15
+ # @example Fetch all public gists
16
+ # Octokit.gists
17
+ # @see https://developer.github.com/v3/gists/#list-gists
18
+ def gists(user=nil, options = {})
19
+ if user.nil?
20
+ paginate 'gists', options
21
+ else
22
+ paginate "#{User.path user}/gists", options
23
+ end
24
+ end
25
+ alias :list_gists :gists
26
+
27
+ # List public gists
28
+ #
29
+ # @return [Array<Sawyer::Resource>] A list of gists
30
+ # @example Fetch all public gists
31
+ # Octokit.public_gists
32
+ # @see https://developer.github.com/v3/gists/#list-gists
33
+ def public_gists(options = {})
34
+ paginate 'gists/public', options
35
+ end
36
+
37
+ # List the authenticated user’s starred gists
38
+ #
39
+ # @return [Array<Sawyer::Resource>] A list of gists
40
+ # @see https://developer.github.com/v3/gists/#list-gists
41
+ def starred_gists(options = {})
42
+ paginate 'gists/starred', options
43
+ end
44
+
45
+ # Get a single gist
46
+ #
47
+ # @param gist [String] ID of gist to fetch
48
+ # @option options [String] :sha Specific gist revision SHA
49
+ # @return [Sawyer::Resource] Gist information
50
+ # @see https://developer.github.com/v3/gists/#get-a-single-gist
51
+ # @see https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
52
+ def gist(gist, options = {})
53
+ if sha = options.delete(:sha)
54
+ get "gists/#{Gist.new(gist)}/#{sha}", options
55
+ else
56
+ get "gists/#{Gist.new(gist)}", options
57
+ end
58
+ end
59
+
60
+ # Create a gist
61
+ #
62
+ # @param options [Hash] Gist information.
63
+ # @option options [String] :description
64
+ # @option options [Boolean] :public Sets gist visibility
65
+ # @option options [Array<Hash>] :files Files that make up this gist. Keys
66
+ # should be the filename, the value a Hash with a :content key with text
67
+ # content of the Gist.
68
+ # @return [Sawyer::Resource] Newly created gist info
69
+ # @see https://developer.github.com/v3/gists/#create-a-gist
70
+ def create_gist(options = {})
71
+ post 'gists', options
72
+ end
73
+
74
+ # Edit a gist
75
+ #
76
+ # @param options [Hash] Gist information.
77
+ # @option options [String] :description
78
+ # @option options [Hash] :files Files that make up this gist. Keys
79
+ # should be the filename, the value a Hash with a :content key with text
80
+ # content of the Gist.
81
+ #
82
+ # NOTE: All files from the previous version of the
83
+ # gist are carried over by default if not included in the hash. Deletes
84
+ # can be performed by including the filename with a null hash.
85
+ # @return
86
+ # [Sawyer::Resource] Newly created gist info
87
+ # @see https://developer.github.com/v3/gists/#edit-a-gist
88
+ # @example Update a gist
89
+ # @client.edit_gist('some_id', {
90
+ # :files => {"boo.md" => {"content" => "updated stuff"}}
91
+ # })
92
+ def edit_gist(gist, options = {})
93
+ patch "gists/#{Gist.new(gist)}", options
94
+ end
95
+
96
+ # List gist commits
97
+ #
98
+ # @param gist [String] Gist ID
99
+ # @return [Array] List of commits to the gist
100
+ # @see https://developer.github.com/v3/gists/#list-gist-commits
101
+ # @example List commits for a gist
102
+ # @client.gist_commits('some_id')
103
+ def gist_commits(gist, options = {})
104
+ paginate "gists/#{Gist.new(gist)}/commits", options
105
+ end
106
+
107
+ #
108
+ # Star a gist
109
+ #
110
+ # @param gist [String] Gist ID
111
+ # @return [Boolean] Indicates if gist is starred successfully
112
+ # @see https://developer.github.com/v3/gists/#star-a-gist
113
+ def star_gist(gist, options = {})
114
+ boolean_from_response :put, "gists/#{Gist.new(gist)}/star", options
115
+ end
116
+
117
+ # Unstar a gist
118
+ #
119
+ # @param gist [String] Gist ID
120
+ # @return [Boolean] Indicates if gist is unstarred successfully
121
+ # @see https://developer.github.com/v3/gists/#unstar-a-gist
122
+ def unstar_gist(gist, options = {})
123
+ boolean_from_response :delete, "gists/#{Gist.new(gist)}/star", options
124
+ end
125
+
126
+ # Check if a gist is starred
127
+ #
128
+ # @param gist [String] Gist ID
129
+ # @return [Boolean] Indicates if gist is starred
130
+ # @see https://developer.github.com/v3/gists/#check-if-a-gist-is-starred
131
+ def gist_starred?(gist, options = {})
132
+ boolean_from_response :get, "gists/#{Gist.new(gist)}/star", options
133
+ end
134
+
135
+ # Fork a gist
136
+ #
137
+ # @param gist [String] Gist ID
138
+ # @return [Sawyer::Resource] Data for the new gist
139
+ # @see https://developer.github.com/v3/gists/#fork-a-gist
140
+ def fork_gist(gist, options = {})
141
+ post "gists/#{Gist.new(gist)}/forks", options
142
+ end
143
+
144
+ # List gist forks
145
+ #
146
+ # @param gist [String] Gist ID
147
+ # @return [Array] List of gist forks
148
+ # @see https://developer.github.com/v3/gists/#list-gist-forks
149
+ # @example List gist forks
150
+ # @client.gist_forks('some-id')
151
+ def gist_forks(gist, options = {})
152
+ paginate "gists/#{Gist.new(gist)}/forks", options
153
+ end
154
+
155
+ # Delete a gist
156
+ #
157
+ # @param gist [String] Gist ID
158
+ # @return [Boolean] Indicating success of deletion
159
+ # @see https://developer.github.com/v3/gists/#delete-a-gist
160
+ def delete_gist(gist, options = {})
161
+ boolean_from_response :delete, "gists/#{Gist.new(gist)}", options
162
+ end
163
+
164
+ # List gist comments
165
+ #
166
+ # @param gist_id [String] Gist Id.
167
+ # @return [Array<Sawyer::Resource>] Array of hashes representing comments.
168
+ # @see https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
169
+ # @example
170
+ # Octokit.gist_comments('3528ae645')
171
+ def gist_comments(gist_id, options = {})
172
+ paginate "gists/#{gist_id}/comments", options
173
+ end
174
+
175
+ # Get gist comment
176
+ #
177
+ # @param gist_id [String] Id of the gist.
178
+ # @param gist_comment_id [Integer] Id of the gist comment.
179
+ # @return [Sawyer::Resource] Hash representing gist comment.
180
+ # @see https://developer.github.com/v3/gists/comments/#get-a-single-comment
181
+ # @example
182
+ # Octokit.gist_comment('208sdaz3', 1451398)
183
+ def gist_comment(gist_id, gist_comment_id, options = {})
184
+ get "gists/#{gist_id}/comments/#{gist_comment_id}", options
185
+ end
186
+
187
+ # Create gist comment
188
+ #
189
+ # Requires authenticated client.
190
+ #
191
+ # @param gist_id [String] Id of the gist.
192
+ # @param comment [String] Comment contents.
193
+ # @return [Sawyer::Resource] Hash representing the new comment.
194
+ # @see https://developer.github.com/v3/gists/comments/#create-a-comment
195
+ # @example
196
+ # @client.create_gist_comment('3528645', 'This is very helpful.')
197
+ def create_gist_comment(gist_id, comment, options = {})
198
+ options.merge!({:body => comment})
199
+ post "gists/#{gist_id}/comments", options
200
+ end
201
+
202
+ # Update gist comment
203
+ #
204
+ # Requires authenticated client
205
+ #
206
+ # @param gist_id [String] Id of the gist.
207
+ # @param gist_comment_id [Integer] Id of the gist comment to update.
208
+ # @param comment [String] Updated comment contents.
209
+ # @return [Sawyer::Resource] Hash representing the updated comment.
210
+ # @see https://developer.github.com/v3/gists/comments/#edit-a-comment
211
+ # @example
212
+ # @client.update_gist_comment('208sdaz3', '3528645', ':heart:')
213
+ def update_gist_comment(gist_id, gist_comment_id, comment, options = {})
214
+ options.merge!({:body => comment})
215
+ patch "gists/#{gist_id}/comments/#{gist_comment_id}", options
216
+ end
217
+
218
+ # Delete gist comment
219
+ #
220
+ # Requires authenticated client.
221
+ #
222
+ # @param gist_id [String] Id of the gist.
223
+ # @param gist_comment_id [Integer] Id of the gist comment to delete.
224
+ # @return [Boolean] True if comment deleted, false otherwise.
225
+ # @see https://developer.github.com/v3/gists/comments/#delete-a-comment
226
+ # @example
227
+ # @client.delete_gist_comment('208sdaz3', '586399')
228
+ def delete_gist_comment(gist_id, gist_comment_id, options = {})
229
+ boolean_from_response(:delete, "gists/#{gist_id}/comments/#{gist_comment_id}", options)
230
+ end
231
+ end
232
+ end
233
+ end