octokit 4.4.1 → 4.6.0
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.
- checksums.yaml +4 -4
- data/lib/octokit/client.rb +4 -0
- data/lib/octokit/client/projects.rb +314 -0
- data/lib/octokit/client/repositories.rb +17 -9
- data/lib/octokit/client/traffic.rb +69 -0
- data/lib/octokit/preview.rb +3 -1
- data/lib/octokit/version.rb +2 -2
- data/octokit.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e102d4ef66b25de05af28e8b5567425ae621968
|
4
|
+
data.tar.gz: 4d2c7a2aebf56bca3e81d51ffcbc8f0ee4b23790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd6383e5f75b45f5f8d216a0e95cc19569306b10962016d186a4638509e3d3eea31dfff33e2b380c8fe88f683bfe67f21ea60d6f68481cc1933567de508cf0a3
|
7
|
+
data.tar.gz: ed9dae41551580e6f60ee0fc0c03da83d5e85b8d3e81282c1155a859b2c2be19d8a14c33004a431f123a4a2c17a0992106b9a1052867b80a4dbda4485f375a00
|
data/lib/octokit/client.rb
CHANGED
@@ -33,6 +33,7 @@ require 'octokit/client/notifications'
|
|
33
33
|
require 'octokit/client/objects'
|
34
34
|
require 'octokit/client/organizations'
|
35
35
|
require 'octokit/client/pages'
|
36
|
+
require 'octokit/client/projects'
|
36
37
|
require 'octokit/client/pub_sub_hubbub'
|
37
38
|
require 'octokit/client/pull_requests'
|
38
39
|
require 'octokit/client/rate_limit'
|
@@ -47,6 +48,7 @@ require 'octokit/client/service_status'
|
|
47
48
|
require 'octokit/client/source_import'
|
48
49
|
require 'octokit/client/stats'
|
49
50
|
require 'octokit/client/statuses'
|
51
|
+
require 'octokit/client/traffic'
|
50
52
|
require 'octokit/client/users'
|
51
53
|
|
52
54
|
module Octokit
|
@@ -84,6 +86,7 @@ module Octokit
|
|
84
86
|
include Octokit::Client::Objects
|
85
87
|
include Octokit::Client::Organizations
|
86
88
|
include Octokit::Client::Pages
|
89
|
+
include Octokit::Client::Projects
|
87
90
|
include Octokit::Client::PubSubHubbub
|
88
91
|
include Octokit::Client::PullRequests
|
89
92
|
include Octokit::Client::RateLimit
|
@@ -98,6 +101,7 @@ module Octokit
|
|
98
101
|
include Octokit::Client::SourceImport
|
99
102
|
include Octokit::Client::Stats
|
100
103
|
include Octokit::Client::Statuses
|
104
|
+
include Octokit::Client::Traffic
|
101
105
|
include Octokit::Client::Users
|
102
106
|
|
103
107
|
# Header keys that can be passed in options hash to {#get},{#head}
|
@@ -0,0 +1,314 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for Projects API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/repos/projects
|
7
|
+
module Projects
|
8
|
+
|
9
|
+
# List projects for a repository
|
10
|
+
#
|
11
|
+
# Requires authenticated client
|
12
|
+
#
|
13
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
14
|
+
# @return [Array<Sawyer::Resource>] Repository projects
|
15
|
+
# @see https://developer.github.com/v3/projects/#list-repository-projects
|
16
|
+
# @example
|
17
|
+
# @client.projects('octokit/octokit.rb')
|
18
|
+
def projects(repo, options = {})
|
19
|
+
opts = ensure_api_media_type(:projects, options)
|
20
|
+
paginate "#{Repository.path repo}/projects", opts
|
21
|
+
end
|
22
|
+
|
23
|
+
# Create a project
|
24
|
+
#
|
25
|
+
# Requires authenticated client
|
26
|
+
#
|
27
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
28
|
+
# @param name [String] Project name
|
29
|
+
# @option options [String] :body Body of the project
|
30
|
+
# @return [Sawyer::Resource] Fresh new project
|
31
|
+
# @see https://developer.github.com/v3/projects/#create-a-repository-project
|
32
|
+
# @example Create project with only a name
|
33
|
+
# @client.create_project('octokit/octokit.rb', 'implement new APIs')
|
34
|
+
#
|
35
|
+
# @example Create project with name and body
|
36
|
+
# @client.create_project('octokit/octokit.rb', 'bugs be gone', body: 'Fix all the bugs @joeyw creates')
|
37
|
+
def create_project(repo, name, options = {})
|
38
|
+
opts = ensure_api_media_type(:projects, options)
|
39
|
+
opts[:name] = name
|
40
|
+
post "#{Repository.path repo}/projects", opts
|
41
|
+
end
|
42
|
+
|
43
|
+
# List organization projects
|
44
|
+
#
|
45
|
+
# Requires authenticated client
|
46
|
+
#
|
47
|
+
# @param org [String] A GitHub organization
|
48
|
+
# @return [Array<Sawyer::Resource>] Organization projects
|
49
|
+
# @see https://developer.github.com/v3/projects/#list-organization-projects
|
50
|
+
# @example
|
51
|
+
# @client.org_projects("octokit")
|
52
|
+
def org_projects(org, options = {})
|
53
|
+
opts = ensure_api_media_type(:projects, options)
|
54
|
+
get "orgs/#{org}/projects", opts
|
55
|
+
end
|
56
|
+
alias :organization_projects :org_projects
|
57
|
+
|
58
|
+
# Create organization project
|
59
|
+
#
|
60
|
+
# Requires authenticated client
|
61
|
+
#
|
62
|
+
# @param org [String] A GitHub organization
|
63
|
+
# @param name [String] Project name
|
64
|
+
# @option options [String] :body Project body
|
65
|
+
# @return [Sawyer::Resource] Organization project
|
66
|
+
# @see https://developer.github.com/v3/projects/#create-an-organization-project
|
67
|
+
# @example Create with only a name
|
68
|
+
# @client.create_org_project("octocat", "make more octocats")
|
69
|
+
# @example Create a project with name and body
|
70
|
+
# @client.create_org_project("octokit", "octocan", body: 'Improve clients')
|
71
|
+
def create_org_project(org, name, options = {})
|
72
|
+
opts = ensure_api_media_type(:projects, options)
|
73
|
+
opts[:name] = name
|
74
|
+
post "orgs/#{org}/projects", opts
|
75
|
+
end
|
76
|
+
alias :create_organization_project :create_org_project
|
77
|
+
|
78
|
+
# Get a project by id
|
79
|
+
#
|
80
|
+
# @param id [Integer] Project id
|
81
|
+
# @return [Sawyer::Resource] Project
|
82
|
+
# @see https://developer.github.com/v3/projects/#get-a-project
|
83
|
+
# @example
|
84
|
+
# Octokit.project("octokit/octokit.rb", 1)
|
85
|
+
def project(id, options = {})
|
86
|
+
opts = ensure_api_media_type(:projects, options)
|
87
|
+
get "projects/#{id}", opts
|
88
|
+
end
|
89
|
+
|
90
|
+
# Update a project
|
91
|
+
#
|
92
|
+
# Requires authenticated client
|
93
|
+
#
|
94
|
+
# @param id [Integer] Project id
|
95
|
+
# @option options [String] :name Project name
|
96
|
+
# @option options [String] :body Project body
|
97
|
+
# @return [Sawyer::Resource] Project
|
98
|
+
# @see https://developer.github.com/v3/projects/#update-a-project
|
99
|
+
# @example Update project name
|
100
|
+
# @client.update_project(123942, name: 'New name')
|
101
|
+
def update_project(id, options = {})
|
102
|
+
opts = ensure_api_media_type(:projects, options)
|
103
|
+
patch "projects/#{id}", opts
|
104
|
+
end
|
105
|
+
|
106
|
+
# Delete a project
|
107
|
+
#
|
108
|
+
# Requires authenticated client
|
109
|
+
#
|
110
|
+
# @param id [Integer] Project id
|
111
|
+
# @return [Boolean] Result of deletion
|
112
|
+
# @see https://developer.github.com/v3/projects/#delete-a-project
|
113
|
+
# @example
|
114
|
+
# @client.delete_project(123942)
|
115
|
+
def delete_project(id, options = {})
|
116
|
+
opts = ensure_api_media_type(:projects, options)
|
117
|
+
boolean_from_response :delete, "projects/#{id}", opts
|
118
|
+
end
|
119
|
+
|
120
|
+
# List project columns
|
121
|
+
#
|
122
|
+
# @param id [Integer] Project id
|
123
|
+
# @return [Array<Sawyer::Resource>] List of project columns
|
124
|
+
# @see https://developer.github.com/v3/projects/columns/#list-project-columns
|
125
|
+
# @example
|
126
|
+
# @client.project_columns("octokit/octokit.rb", 1)
|
127
|
+
def project_columns(id, options = {})
|
128
|
+
opts = ensure_api_media_type(:projects, options)
|
129
|
+
paginate "projects/#{id}/columns", opts
|
130
|
+
end
|
131
|
+
|
132
|
+
# Create a project column
|
133
|
+
#
|
134
|
+
# Requires authenticated client
|
135
|
+
#
|
136
|
+
# @param id [Integer] Project column id
|
137
|
+
# @param name [String] New column name
|
138
|
+
# @return [Sawyer::Resource] Newly created column
|
139
|
+
# @see https://developer.github.com/v3/projects/columns/#create-a-project-column
|
140
|
+
# @example
|
141
|
+
# @client.create_project_column("octokit/octokit.rb", 1, "To Dones")
|
142
|
+
def create_project_column(id, name, options = {})
|
143
|
+
opts = ensure_api_media_type(:projects, options)
|
144
|
+
opts[:name] = name
|
145
|
+
post "projects/#{id}/columns", opts
|
146
|
+
end
|
147
|
+
|
148
|
+
# Get a project column by ID
|
149
|
+
#
|
150
|
+
# @param id [Integer] Project column id
|
151
|
+
# @return [Sawyer::Resource] Project column
|
152
|
+
# @see https://developer.github.com/v3/projects/columns/#get-a-project-column
|
153
|
+
# @example
|
154
|
+
# Octokit.project_column(123940, 30)
|
155
|
+
def project_column(id, options = {})
|
156
|
+
opts = ensure_api_media_type(:projects, options)
|
157
|
+
get "projects/columns/#{id}", opts
|
158
|
+
end
|
159
|
+
|
160
|
+
# Update a project column
|
161
|
+
#
|
162
|
+
# Requires authenticated client
|
163
|
+
#
|
164
|
+
# @param id [Integer] Project column id
|
165
|
+
# @param name [String] New column name
|
166
|
+
# @return [Sawyer::Resource] Updated column
|
167
|
+
# @see https://developer.github.com/v3/projects/columns/#update-a-project-column
|
168
|
+
# @example
|
169
|
+
# @client.update_project_column(30294, "new column name")
|
170
|
+
def update_project_column(id, name, options = {})
|
171
|
+
opts = ensure_api_media_type(:projects, options)
|
172
|
+
opts[:name] = name
|
173
|
+
patch "projects/columns/#{id}", opts
|
174
|
+
end
|
175
|
+
|
176
|
+
# Delete a project column
|
177
|
+
#
|
178
|
+
# Requires authenticated client
|
179
|
+
#
|
180
|
+
# @param id [Integer] Project column id
|
181
|
+
# @return [Boolean] Result of deletion request, true when deleted
|
182
|
+
# @see https://developer.github.com/v3/projects/columns/#delete-a-project-column
|
183
|
+
# @example
|
184
|
+
# @client.delete_project_column(30294)
|
185
|
+
def delete_project_column(id, options = {})
|
186
|
+
opts = ensure_api_media_type(:projects, options)
|
187
|
+
boolean_from_response :delete, "projects/columns/#{id}", opts
|
188
|
+
end
|
189
|
+
|
190
|
+
# Move a project column
|
191
|
+
#
|
192
|
+
# Requires authenticated client
|
193
|
+
#
|
194
|
+
# @param id [Integer] Project column id
|
195
|
+
# @param position [String] New position for the column. Can be one of
|
196
|
+
# <tt>first</tt>, <tt>last</tt>, or <tt>after:<column-id></tt>, where
|
197
|
+
# <tt><column-id></tt> is the id value of a column in the same project.
|
198
|
+
# @return [Sawyer::Resource] Result
|
199
|
+
# @see https://developer.github.com/v3/projects/columns/#move-a-project-column
|
200
|
+
# @example
|
201
|
+
# @client.move_project_column(3049, "last")
|
202
|
+
def move_project_column(id, position, options = {})
|
203
|
+
opts = ensure_api_media_type(:projects, options)
|
204
|
+
opts[:position] = position
|
205
|
+
post "projects/columns/#{id}/moves", opts
|
206
|
+
end
|
207
|
+
|
208
|
+
# List columns cards
|
209
|
+
#
|
210
|
+
# Requires authenticated client
|
211
|
+
#
|
212
|
+
# @param id [Integer] Project column id
|
213
|
+
# @return [Array<Sawyer::Resource>] Cards in the column
|
214
|
+
# @see https://developer.github.com/v3/projects/cards/#list-project-cards
|
215
|
+
# @example
|
216
|
+
# @client.column_cards(123847)
|
217
|
+
def column_cards(id, options = {})
|
218
|
+
opts = ensure_api_media_type(:projects, options)
|
219
|
+
paginate "projects/columns/#{id}/cards", opts
|
220
|
+
end
|
221
|
+
|
222
|
+
# Create project card
|
223
|
+
#
|
224
|
+
# Requires authenticated client
|
225
|
+
#
|
226
|
+
# @param id [Integer] Project column id
|
227
|
+
# @option options [String] :note Card contents for a note type
|
228
|
+
# @option options [Integer] :content_id Issue ID for the card contents
|
229
|
+
# @option options [String] :content_type Type of content to associate
|
230
|
+
# with the card. <tt>Issue</tt> is presently the only avaiable value
|
231
|
+
# @note If :note is supplied, :content_id and :content_type must be
|
232
|
+
# excluded. Similarly, if :content_id is supplied, :content_type must
|
233
|
+
# be set and :note must not be included.
|
234
|
+
# @return [Sawyer::Resource] Newly created card
|
235
|
+
# @see https://developer.github.com/v3/projects/cards/#create-a-project-card
|
236
|
+
# @example Create a project card with a note
|
237
|
+
# @client.create_project_card(123495, note: 'New note card')
|
238
|
+
# @example Create a project card for an repository issue
|
239
|
+
# @client.create_project_card(123495, content_id: 1, content_type: 'Issue')
|
240
|
+
def create_project_card(id, options = {})
|
241
|
+
opts = ensure_api_media_type(:projects, options)
|
242
|
+
post "projects/columns/#{id}/cards", opts
|
243
|
+
end
|
244
|
+
|
245
|
+
# Get a project card
|
246
|
+
#
|
247
|
+
# Requires authenticated client
|
248
|
+
#
|
249
|
+
# @param id [Integer] Project card id
|
250
|
+
# @return [Sawyer::Resource] Project card
|
251
|
+
# @see https://developer.github.com/v3/projects/cards/#get-a-project-card
|
252
|
+
# @example
|
253
|
+
# @client.project_card(123495)
|
254
|
+
def project_card(id, options = {})
|
255
|
+
opts = ensure_api_media_type(:projects, options)
|
256
|
+
get "projects/columns/cards/#{id}", opts
|
257
|
+
end
|
258
|
+
|
259
|
+
# Update a project card
|
260
|
+
#
|
261
|
+
# Requires authenticated client
|
262
|
+
#
|
263
|
+
# @param id [Integer] Project card id
|
264
|
+
# @option options [String] :note The card's note content. Only valid for
|
265
|
+
# cards without another type of content, so this cannot be specified if
|
266
|
+
# the card already has a content_id and content_type.
|
267
|
+
# @return [Sawyer::Resource] Updated project card
|
268
|
+
# @see https://developer.github.com/v3/projects/cards/#update-a-project-card
|
269
|
+
# @example
|
270
|
+
# @client.update_project_card(12345, note: 'new note')
|
271
|
+
def update_project_card(id, options = {})
|
272
|
+
opts = ensure_api_media_type(:projects, options)
|
273
|
+
patch "projects/columns/cards/#{id}", opts
|
274
|
+
end
|
275
|
+
|
276
|
+
# Move a project card
|
277
|
+
#
|
278
|
+
# Requires authenticated client
|
279
|
+
#
|
280
|
+
# @param id [Integer] Project card id
|
281
|
+
# @param position [String] Can be one of <tt>top</tt>, <tt>bottom</tt>,
|
282
|
+
# or <tt>after:<card-id></tt>, where <card-id> is the id value of a
|
283
|
+
# card in the same column, or in the new column specified by column_id.
|
284
|
+
# @option options [Integer] :column_id The column id to move the card to,
|
285
|
+
# must be column in same project
|
286
|
+
# @return [Sawyer::Resource] Empty sawyer resource
|
287
|
+
# @see https://developer.github.com/v3/projects/cards/#move-a-project-card
|
288
|
+
# @example Move a card to the bottom of the same column
|
289
|
+
# @client.move_project_card(123495, 'bottom')
|
290
|
+
# @example Move a card to the top of another column
|
291
|
+
# @client.move_project_card(123495, 'top', column_id: 59402)
|
292
|
+
def move_project_card(id, position, options = {})
|
293
|
+
opts = ensure_api_media_type(:projects, options)
|
294
|
+
opts[:position] = position
|
295
|
+
post "projects/columns/cards/#{id}/moves", opts
|
296
|
+
end
|
297
|
+
|
298
|
+
# Delete a project card
|
299
|
+
#
|
300
|
+
# Requires authenticated client
|
301
|
+
#
|
302
|
+
# @param id [Integer] Project card id
|
303
|
+
# @return [Boolean] True of deleted, false otherwise
|
304
|
+
# @see https://developer.github.com/v3/projects/cards/#delete-a-project-card
|
305
|
+
# @example
|
306
|
+
# @client.delete_project_card(123495)
|
307
|
+
def delete_project_card(id, options = {})
|
308
|
+
opts = ensure_api_media_type(:projects, options)
|
309
|
+
boolean_from_response :delete, "projects/columns/cards/#{id}", opts
|
310
|
+
end
|
311
|
+
|
312
|
+
end # Projects
|
313
|
+
end
|
314
|
+
end
|
@@ -499,17 +499,25 @@ module Octokit
|
|
499
499
|
#
|
500
500
|
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
501
501
|
# @param branch [String] Branch name
|
502
|
-
# @
|
502
|
+
# @option options [Hash] :required_status_checks If not null, the following keys are required:
|
503
|
+
# <tt>:include_admins [boolean] Enforce required status checks for repository administrators.</tt>
|
504
|
+
# <tt>:strict [boolean] Require branches to be up to date before merging.</tt>
|
505
|
+
# <tt>:contexts [Array] The list of status checks to require in order to merge into this branch</tt>
|
506
|
+
#
|
507
|
+
# @option options [Hash] :restrictions If not null, the following keys are required:
|
508
|
+
# <tt>:users [Array] The list of user logins with push access</tt>
|
509
|
+
# <tt>:teams [Array] The list of team slugs with push access</tt>.
|
510
|
+
#
|
511
|
+
# Teams and users restrictions are only available for organization-owned repositories.
|
503
512
|
# @return [Sawyer::Resource] The protected branch
|
504
513
|
# @see https://developer.github.com/v3/repos/#enabling-and-disabling-branch-protection
|
505
514
|
# @example
|
506
515
|
# @client.protect_branch('octokit/octokit.rb', 'master', foo)
|
507
|
-
def protect_branch(repo, branch,
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
put "#{Repository.path repo}/branches/#{branch}/protection", options
|
516
|
+
def protect_branch(repo, branch, options = {})
|
517
|
+
opts = ensure_api_media_type(:branch_protection, options)
|
518
|
+
opts[:restrictions] ||= nil
|
519
|
+
opts[:required_status_checks] ||= nil
|
520
|
+
put "#{Repository.path repo}/branches/#{branch}/protection", opts
|
513
521
|
end
|
514
522
|
|
515
523
|
# Get branch protection summary
|
@@ -541,8 +549,8 @@ module Octokit
|
|
541
549
|
# @example
|
542
550
|
# @client.unprotect_branch('octokit/octokit.rb', 'master')
|
543
551
|
def unprotect_branch(repo, branch, options = {})
|
544
|
-
|
545
|
-
delete "#{Repository.path repo}/branches/#{branch}/protection",
|
552
|
+
opts = ensure_api_media_type(:branch_protection, options)
|
553
|
+
boolean_from_response :delete, "#{Repository.path repo}/branches/#{branch}/protection", opts
|
546
554
|
end
|
547
555
|
|
548
556
|
# List users available for assigning to issues.
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Traffic API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/repos/traffic/
|
7
|
+
module Traffic
|
8
|
+
|
9
|
+
# Get the top 10 referrers over the last 14 days
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
12
|
+
# @return [Array<Sawyer::Resource>] List of referrers and stats
|
13
|
+
# @see https://developer.github.com/v3/repos/traffic/#list-referrers
|
14
|
+
# @example
|
15
|
+
# @client.top_referrers('octokit/octokit.rb')
|
16
|
+
def top_referrers(repo, options = {})
|
17
|
+
opts = ensure_api_media_type(:traffic, options)
|
18
|
+
get "#{Repository.path repo}/traffic/popular/referrers", opts
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get the top 10 popular contents over the last 14 days
|
22
|
+
#
|
23
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
24
|
+
# @return [Array<Sawyer::Resource>] List of popular contents
|
25
|
+
# @see https://developer.github.com/v3/repos/traffic/#list-paths
|
26
|
+
# @example
|
27
|
+
# @client.top_paths('octokit/octokit.rb')
|
28
|
+
def top_paths(repo, options = {})
|
29
|
+
opts = ensure_api_media_type(:traffic, options)
|
30
|
+
get "#{Repository.path repo}/traffic/popular/paths", opts
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get the total number of views and breakdown per day or week for the
|
34
|
+
# last 14 days
|
35
|
+
#
|
36
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub Repository
|
37
|
+
# @option options [String] :per ('day') Views per. <tt>day</tt> or
|
38
|
+
# <tt>week</tt>
|
39
|
+
# @return [Sawyer::Resource] Breakdown of view stats
|
40
|
+
# @see https://developer.github.com/v3/repos/traffic/#views
|
41
|
+
# @example Views per day
|
42
|
+
# @client.views('octokit/octokit.rb')
|
43
|
+
# @example Views per week
|
44
|
+
# @client.views('octokit/octokit.rb', per: 'week')
|
45
|
+
def views(repo, options = {})
|
46
|
+
opts = ensure_api_media_type(:traffic, options)
|
47
|
+
get "#{Repository.path repo}/traffic/views", opts
|
48
|
+
end
|
49
|
+
|
50
|
+
# Get the total number of clones and breakdown per day or week for the
|
51
|
+
# last 14 days
|
52
|
+
#
|
53
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub Repository
|
54
|
+
# @option options [String] :per ('day') Views per. <tt>day</tt> or
|
55
|
+
# <tt>week</tt>
|
56
|
+
# @return [Sawyer::Resource] Breakdown of clone stats
|
57
|
+
# @see https://developer.github.com/v3/repos/traffic/#clones
|
58
|
+
# @example Clones per day
|
59
|
+
# @client.clones('octokit/octokit.rb')
|
60
|
+
# @example Clones per week
|
61
|
+
# @client.clones('octokit/octokit.rb', per: 'week')
|
62
|
+
def clones(repo, options = {})
|
63
|
+
opts = ensure_api_media_type(:traffic, options)
|
64
|
+
get "#{Repository.path repo}/traffic/clones", opts
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/octokit/preview.rb
CHANGED
@@ -11,7 +11,9 @@ module Octokit
|
|
11
11
|
:reactions => 'application/vnd.github.squirrel-girl-preview'.freeze,
|
12
12
|
:repository_invitations => 'application/vnd.github.swamp-thing-preview+json'.freeze,
|
13
13
|
:issue_timelines => 'application/vnd.github.mockingbird-preview+json'.freeze,
|
14
|
-
:pages => 'application/vnd.github.mister-fantastic-preview+json'.freeze
|
14
|
+
:pages => 'application/vnd.github.mister-fantastic-preview+json'.freeze,
|
15
|
+
:projects => 'application/vnd.github.inertia-preview+json'.freeze,
|
16
|
+
:traffic => 'application/vnd.github.spiderman-preview'.freeze
|
15
17
|
}
|
16
18
|
|
17
19
|
def ensure_api_media_type(type, options)
|
data/lib/octokit/version.rb
CHANGED
data/octokit.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'octokit/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
8
|
-
spec.add_dependency 'sawyer', '>= 0.5.3', '~> 0.
|
8
|
+
spec.add_dependency 'sawyer', '>= 0.5.3', '~> 0.8.0'
|
9
9
|
spec.authors = ["Wynn Netherland", "Erik Michaels-Ober", "Clint Shryock"]
|
10
10
|
spec.description = %q{Simple wrapper for the GitHub API}
|
11
11
|
spec.email = ['wynn.netherland@gmail.com', 'sferik@gmail.com', 'clint@ctshryock.com']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wynn Netherland
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
version: 0.5.3
|
36
36
|
- - "~>"
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version: 0.
|
38
|
+
version: 0.8.0
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
version: 0.5.3
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.
|
48
|
+
version: 0.8.0
|
49
49
|
description: Simple wrapper for the GitHub API
|
50
50
|
email:
|
51
51
|
- wynn.netherland@gmail.com
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/octokit/client/objects.rb
|
88
88
|
- lib/octokit/client/organizations.rb
|
89
89
|
- lib/octokit/client/pages.rb
|
90
|
+
- lib/octokit/client/projects.rb
|
90
91
|
- lib/octokit/client/pub_sub_hubbub.rb
|
91
92
|
- lib/octokit/client/pull_requests.rb
|
92
93
|
- lib/octokit/client/rate_limit.rb
|
@@ -101,6 +102,7 @@ files:
|
|
101
102
|
- lib/octokit/client/source_import.rb
|
102
103
|
- lib/octokit/client/stats.rb
|
103
104
|
- lib/octokit/client/statuses.rb
|
105
|
+
- lib/octokit/client/traffic.rb
|
104
106
|
- lib/octokit/client/users.rb
|
105
107
|
- lib/octokit/configurable.rb
|
106
108
|
- lib/octokit/connection.rb
|