github_api 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. metadata +4 -140
  2. data/LICENSE.txt +0 -20
  3. data/README.rdoc +0 -228
  4. data/Rakefile +0 -52
  5. data/features/github_api.feature +0 -50
  6. data/features/step_definitions/github_api_steps.rb +0 -11
  7. data/features/support/env.rb +0 -13
  8. data/lib/github_api.rb +0 -73
  9. data/lib/github_api/api.rb +0 -175
  10. data/lib/github_api/api/utils.rb +0 -9
  11. data/lib/github_api/authorization.rb +0 -73
  12. data/lib/github_api/authorizations.rb +0 -119
  13. data/lib/github_api/cache_control.rb +0 -19
  14. data/lib/github_api/client.rb +0 -55
  15. data/lib/github_api/compatibility.rb +0 -23
  16. data/lib/github_api/configuration.rb +0 -96
  17. data/lib/github_api/connection.rb +0 -81
  18. data/lib/github_api/core_ext/array.rb +0 -14
  19. data/lib/github_api/core_ext/hash.rb +0 -42
  20. data/lib/github_api/error.rb +0 -35
  21. data/lib/github_api/events.rb +0 -202
  22. data/lib/github_api/gists.rb +0 -200
  23. data/lib/github_api/gists/comments.rb +0 -86
  24. data/lib/github_api/git_data.rb +0 -26
  25. data/lib/github_api/git_data/blobs.rb +0 -51
  26. data/lib/github_api/git_data/commits.rb +0 -78
  27. data/lib/github_api/git_data/references.rb +0 -113
  28. data/lib/github_api/git_data/tags.rb +0 -78
  29. data/lib/github_api/git_data/trees.rb +0 -89
  30. data/lib/github_api/issues.rb +0 -215
  31. data/lib/github_api/issues/comments.rb +0 -110
  32. data/lib/github_api/issues/events.rb +0 -50
  33. data/lib/github_api/issues/labels.rb +0 -191
  34. data/lib/github_api/issues/milestones.rb +0 -119
  35. data/lib/github_api/mime_type.rb +0 -55
  36. data/lib/github_api/orgs.rb +0 -95
  37. data/lib/github_api/orgs/members.rb +0 -120
  38. data/lib/github_api/orgs/teams.rb +0 -245
  39. data/lib/github_api/pull_requests.rb +0 -224
  40. data/lib/github_api/pull_requests/comments.rb +0 -144
  41. data/lib/github_api/repos.rb +0 -286
  42. data/lib/github_api/repos/collaborators.rb +0 -81
  43. data/lib/github_api/repos/commits.rb +0 -180
  44. data/lib/github_api/repos/downloads.rb +0 -155
  45. data/lib/github_api/repos/forks.rb +0 -48
  46. data/lib/github_api/repos/hooks.rb +0 -173
  47. data/lib/github_api/repos/keys.rb +0 -104
  48. data/lib/github_api/repos/pub_sub_hubbub.rb +0 -102
  49. data/lib/github_api/repos/watching.rb +0 -94
  50. data/lib/github_api/request.rb +0 -84
  51. data/lib/github_api/request/basic_auth.rb +0 -31
  52. data/lib/github_api/request/caching.rb +0 -33
  53. data/lib/github_api/request/oauth2.rb +0 -33
  54. data/lib/github_api/response.rb +0 -28
  55. data/lib/github_api/response/helpers.rb +0 -14
  56. data/lib/github_api/response/jsonize.rb +0 -26
  57. data/lib/github_api/response/mashify.rb +0 -24
  58. data/lib/github_api/response/raise_error.rb +0 -33
  59. data/lib/github_api/result.rb +0 -42
  60. data/lib/github_api/users.rb +0 -84
  61. data/lib/github_api/users/emails.rb +0 -49
  62. data/lib/github_api/users/followers.rb +0 -98
  63. data/lib/github_api/users/keys.rb +0 -84
  64. data/lib/github_api/version.rb +0 -12
  65. data/spec/README.rdoc +0 -22
  66. data/spec/coverage_adapter.rb +0 -14
  67. data/spec/fixtures/auths/authorization.json +0 -14
  68. data/spec/fixtures/auths/authorizations.json +0 -16
  69. data/spec/fixtures/events/events.json +0 -29
  70. data/spec/fixtures/issues/issue.json +0 -56
  71. data/spec/fixtures/issues/issues.json +0 -58
  72. data/spec/fixtures/orgs/members.json +0 -9
  73. data/spec/fixtures/orgs/org.json +0 -18
  74. data/spec/fixtures/orgs/orgs.json +0 -8
  75. data/spec/fixtures/orgs/team.json +0 -8
  76. data/spec/fixtures/orgs/team_repos.json +0 -29
  77. data/spec/fixtures/orgs/teams.json +0 -7
  78. data/spec/fixtures/repos/branches.json +0 -9
  79. data/spec/fixtures/repos/collaborators.json +0 -8
  80. data/spec/fixtures/repos/commit.json +0 -53
  81. data/spec/fixtures/repos/commit_comment.json +0 -16
  82. data/spec/fixtures/repos/commit_comments.json +0 -18
  83. data/spec/fixtures/repos/commits.json +0 -27
  84. data/spec/fixtures/repos/contributors.json +0 -8
  85. data/spec/fixtures/repos/download.json +0 -10
  86. data/spec/fixtures/repos/download_s3.json +0 -21
  87. data/spec/fixtures/repos/downloads.json +0 -12
  88. data/spec/fixtures/repos/fork.json +0 -27
  89. data/spec/fixtures/repos/forks.json +0 -29
  90. data/spec/fixtures/repos/hook.json +0 -15
  91. data/spec/fixtures/repos/hooks.json +0 -10
  92. data/spec/fixtures/repos/key.json +0 -6
  93. data/spec/fixtures/repos/keys.json +0 -8
  94. data/spec/fixtures/repos/languages.json +0 -4
  95. data/spec/fixtures/repos/repo.json +0 -90
  96. data/spec/fixtures/repos/repo_comments.json +0 -18
  97. data/spec/fixtures/repos/repos.json +0 -29
  98. data/spec/fixtures/repos/tags.json +0 -11
  99. data/spec/fixtures/repos/teams.json +0 -7
  100. data/spec/fixtures/repos/watched.json +0 -29
  101. data/spec/fixtures/repos/watchers.json +0 -8
  102. data/spec/fixtures/users/user.json +0 -32
  103. data/spec/github/api_spec.rb +0 -25
  104. data/spec/github/authorization_spec.rb +0 -176
  105. data/spec/github/authorizations_spec.rb +0 -242
  106. data/spec/github/client_spec.rb +0 -50
  107. data/spec/github/core_ext/hash_spec.rb +0 -44
  108. data/spec/github/events_spec.rb +0 -491
  109. data/spec/github/gists/comments_spec.rb +0 -5
  110. data/spec/github/gists_spec.rb +0 -5
  111. data/spec/github/git_data/blobs_spec.rb +0 -5
  112. data/spec/github/git_data/commits_spec.rb +0 -5
  113. data/spec/github/git_data/references_spec.rb +0 -5
  114. data/spec/github/git_data/tags_spec.rb +0 -5
  115. data/spec/github/git_data/trees_spec.rb +0 -5
  116. data/spec/github/git_data_spec.rb +0 -5
  117. data/spec/github/issues/comments_spec.rb +0 -5
  118. data/spec/github/issues/events_spec.rb +0 -5
  119. data/spec/github/issues/labels_spec.rb +0 -5
  120. data/spec/github/issues/milestones_spec.rb +0 -5
  121. data/spec/github/issues_spec.rb +0 -287
  122. data/spec/github/mime_type_spec.rb +0 -70
  123. data/spec/github/orgs/members_spec.rb +0 -275
  124. data/spec/github/orgs/teams_spec.rb +0 -563
  125. data/spec/github/orgs_spec.rb +0 -160
  126. data/spec/github/repos/collaborators_spec.rb +0 -169
  127. data/spec/github/repos/commits_spec.rb +0 -424
  128. data/spec/github/repos/downloads_spec.rb +0 -236
  129. data/spec/github/repos/forks_spec.rb +0 -103
  130. data/spec/github/repos/hooks_spec.rb +0 -307
  131. data/spec/github/repos/keys_spec.rb +0 -216
  132. data/spec/github/repos/pub_sub_hubbub_spec.rb +0 -83
  133. data/spec/github/repos/watching_spec.rb +0 -222
  134. data/spec/github/repos_spec.rb +0 -571
  135. data/spec/github/result_spec.rb +0 -43
  136. data/spec/github/users_spec.rb +0 -140
  137. data/spec/github_spec.rb +0 -109
  138. data/spec/spec_helper.rb +0 -86
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: github_api
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.4
5
+ version: 0.3.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Piotr Murach
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-12-17 00:00:00 +00:00
13
+ date: 2011-12-18 00:00:00 +00:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -164,144 +164,8 @@ extensions: []
164
164
 
165
165
  extra_rdoc_files: []
166
166
 
167
- files:
168
- - Rakefile
169
- - features/github_api.feature
170
- - features/step_definitions/github_api_steps.rb
171
- - features/support/env.rb
172
- - lib/github_api/api/utils.rb
173
- - lib/github_api/api.rb
174
- - lib/github_api/authorization.rb
175
- - lib/github_api/authorizations.rb
176
- - lib/github_api/cache_control.rb
177
- - lib/github_api/client.rb
178
- - lib/github_api/compatibility.rb
179
- - lib/github_api/configuration.rb
180
- - lib/github_api/connection.rb
181
- - lib/github_api/core_ext/array.rb
182
- - lib/github_api/core_ext/hash.rb
183
- - lib/github_api/error.rb
184
- - lib/github_api/events.rb
185
- - lib/github_api/gists/comments.rb
186
- - lib/github_api/gists.rb
187
- - lib/github_api/git_data/blobs.rb
188
- - lib/github_api/git_data/commits.rb
189
- - lib/github_api/git_data/references.rb
190
- - lib/github_api/git_data/tags.rb
191
- - lib/github_api/git_data/trees.rb
192
- - lib/github_api/git_data.rb
193
- - lib/github_api/issues/comments.rb
194
- - lib/github_api/issues/events.rb
195
- - lib/github_api/issues/labels.rb
196
- - lib/github_api/issues/milestones.rb
197
- - lib/github_api/issues.rb
198
- - lib/github_api/mime_type.rb
199
- - lib/github_api/orgs/members.rb
200
- - lib/github_api/orgs/teams.rb
201
- - lib/github_api/orgs.rb
202
- - lib/github_api/pull_requests/comments.rb
203
- - lib/github_api/pull_requests.rb
204
- - lib/github_api/repos/collaborators.rb
205
- - lib/github_api/repos/commits.rb
206
- - lib/github_api/repos/downloads.rb
207
- - lib/github_api/repos/forks.rb
208
- - lib/github_api/repos/hooks.rb
209
- - lib/github_api/repos/keys.rb
210
- - lib/github_api/repos/pub_sub_hubbub.rb
211
- - lib/github_api/repos/watching.rb
212
- - lib/github_api/repos.rb
213
- - lib/github_api/request/basic_auth.rb
214
- - lib/github_api/request/caching.rb
215
- - lib/github_api/request/oauth2.rb
216
- - lib/github_api/request.rb
217
- - lib/github_api/response/helpers.rb
218
- - lib/github_api/response/jsonize.rb
219
- - lib/github_api/response/mashify.rb
220
- - lib/github_api/response/raise_error.rb
221
- - lib/github_api/response.rb
222
- - lib/github_api/result.rb
223
- - lib/github_api/users/emails.rb
224
- - lib/github_api/users/followers.rb
225
- - lib/github_api/users/keys.rb
226
- - lib/github_api/users.rb
227
- - lib/github_api/version.rb
228
- - lib/github_api.rb
229
- - spec/coverage_adapter.rb
230
- - spec/fixtures/auths/authorization.json
231
- - spec/fixtures/auths/authorizations.json
232
- - spec/fixtures/events/events.json
233
- - spec/fixtures/issues/issue.json
234
- - spec/fixtures/issues/issues.json
235
- - spec/fixtures/orgs/members.json
236
- - spec/fixtures/orgs/org.json
237
- - spec/fixtures/orgs/orgs.json
238
- - spec/fixtures/orgs/team.json
239
- - spec/fixtures/orgs/team_repos.json
240
- - spec/fixtures/orgs/teams.json
241
- - spec/fixtures/repos/branches.json
242
- - spec/fixtures/repos/collaborators.json
243
- - spec/fixtures/repos/commit.json
244
- - spec/fixtures/repos/commit_comment.json
245
- - spec/fixtures/repos/commit_comments.json
246
- - spec/fixtures/repos/commits.json
247
- - spec/fixtures/repos/contributors.json
248
- - spec/fixtures/repos/download.json
249
- - spec/fixtures/repos/download_s3.json
250
- - spec/fixtures/repos/downloads.json
251
- - spec/fixtures/repos/fork.json
252
- - spec/fixtures/repos/forks.json
253
- - spec/fixtures/repos/hook.json
254
- - spec/fixtures/repos/hooks.json
255
- - spec/fixtures/repos/key.json
256
- - spec/fixtures/repos/keys.json
257
- - spec/fixtures/repos/languages.json
258
- - spec/fixtures/repos/repo.json
259
- - spec/fixtures/repos/repo_comments.json
260
- - spec/fixtures/repos/repos.json
261
- - spec/fixtures/repos/tags.json
262
- - spec/fixtures/repos/teams.json
263
- - spec/fixtures/repos/watched.json
264
- - spec/fixtures/repos/watchers.json
265
- - spec/fixtures/users/user.json
266
- - spec/github/api_spec.rb
267
- - spec/github/authorization_spec.rb
268
- - spec/github/authorizations_spec.rb
269
- - spec/github/client_spec.rb
270
- - spec/github/core_ext/hash_spec.rb
271
- - spec/github/events_spec.rb
272
- - spec/github/gists/comments_spec.rb
273
- - spec/github/gists_spec.rb
274
- - spec/github/git_data/blobs_spec.rb
275
- - spec/github/git_data/commits_spec.rb
276
- - spec/github/git_data/references_spec.rb
277
- - spec/github/git_data/tags_spec.rb
278
- - spec/github/git_data/trees_spec.rb
279
- - spec/github/git_data_spec.rb
280
- - spec/github/issues/comments_spec.rb
281
- - spec/github/issues/events_spec.rb
282
- - spec/github/issues/labels_spec.rb
283
- - spec/github/issues/milestones_spec.rb
284
- - spec/github/issues_spec.rb
285
- - spec/github/mime_type_spec.rb
286
- - spec/github/orgs/members_spec.rb
287
- - spec/github/orgs/teams_spec.rb
288
- - spec/github/orgs_spec.rb
289
- - spec/github/repos/collaborators_spec.rb
290
- - spec/github/repos/commits_spec.rb
291
- - spec/github/repos/downloads_spec.rb
292
- - spec/github/repos/forks_spec.rb
293
- - spec/github/repos/hooks_spec.rb
294
- - spec/github/repos/keys_spec.rb
295
- - spec/github/repos/pub_sub_hubbub_spec.rb
296
- - spec/github/repos/watching_spec.rb
297
- - spec/github/repos_spec.rb
298
- - spec/github/result_spec.rb
299
- - spec/github/users_spec.rb
300
- - spec/github_spec.rb
301
- - spec/README.rdoc
302
- - spec/spec_helper.rb
303
- - README.rdoc
304
- - LICENSE.txt
167
+ files: []
168
+
305
169
  has_rdoc: true
306
170
  homepage: https://github.com/peter-murach/github
307
171
  licenses: []
data/LICENSE.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011 Piotr Murach
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc DELETED
@@ -1,228 +0,0 @@
1
- = GithubAPI {<img src="http://travis-ci.org/peter-murach/github.png?branch=master" />}[http://travis-ci.org/peter-murach/github] {<img src="https://gemnasium.com/peter-murach/github.png?travis" />}[https://gemnasium.com/peter-murach/github]
2
-
3
- Wiki[https://github.com/peter-murach/github/wiki] | RDocs[http://rubydoc.info/github/peter-murach/github/master/frames]
4
-
5
- A Ruby wrapper for the GitHub REST API v3.
6
-
7
- Supports all the API methods(nearly 200). It's build in a modular way, that is, you can either instantiate the whole api wrapper Github.new or use parts of it e.i. Github::Repos.new if working solely with repositories is your main concern.
8
-
9
- == Installation
10
-
11
- Grab the gem by issuing
12
-
13
- gem install github_api
14
-
15
- or in your Gemfile
16
-
17
- gem "github_api"
18
-
19
- == Usage
20
-
21
- Create a new client instance
22
-
23
- @github = Github.new
24
-
25
- At this stage you can also supply various configuration parameters, such as :user, :repo, :org, :oauth_token, :login, :password or :basic_auth which are used throughout the API
26
-
27
- @github = Github.new :user => 'peter-murach', :repo => 'github-api'
28
-
29
- You can authenticate either using OAuth authentication convenience methods(see section OAuth) or through basic authentication by passing your login and password credentials
30
-
31
- @github = Github.new :login => 'peter-murach', :password => '...'
32
-
33
- or use convenience method:
34
-
35
- @github = Github.new :basic_auth => 'login:password'
36
-
37
- You can interact with GitHub interface, for example repositories, by issueing following calls
38
-
39
- @github.repos.commits
40
- @github.repos.branches
41
- @github.repos.contributors
42
-
43
- The code base is modular and allows for you to work specifically with a given part of GitHub API e.g. repositories
44
-
45
- @repos = Github::Repos.new
46
- @repos.branches 'peter-murach', 'github'
47
-
48
- or
49
-
50
- @repos = Github::Repos.new :user => 'peter-murach', :repo => 'github'
51
- @repos.branches
52
-
53
- The response is of type [Hashie::Mash] and allows to traverse all the json response attributes like method calls e.i.
54
-
55
- @repos = Github::Repos.new :user => 'peter-murach', :repo => 'github'
56
- @repos.branches do |branch|
57
- puts branch.name
58
- end
59
-
60
- == API
61
-
62
- Main API methods are grouped into the following classes that can be instantiated on their own
63
-
64
- Github - full API access
65
- Github::Gists
66
- Github::GitData
67
- Github::Issues
68
- Github::Orgs
69
- Github::PullRequests
70
- Github::Repos
71
- Github::Users
72
- Github::Events
73
- Github::Authorizations
74
-
75
- Some parts of GitHub API v3 require you to be autheticated, for instance the following are examples of APIs only for the authenticated user
76
-
77
- Github::Users::Emails
78
- Github::Users::Keys
79
-
80
- All method calls form ruby like sentences and allow for intuitive api navigation, for instance
81
-
82
- @github = Github.new :oauth_token => '...'
83
- @github.users.following 'wycats' # => returns users that 'wycats' is following
84
- @github.users.following 'wycats' # => returns true if following, otherwise false
85
-
86
- For specification on all available methods go to http://developer.github.com/v3/ or
87
- read the rdoc, all methods are documented there with examples of usage.
88
-
89
- == Inputs
90
-
91
- Some API methods apart from required parameters such as username, repository name
92
- or organisation name, allow you to switch the way the data is returned to you, for instance
93
-
94
- @github = Github.new
95
- @github.git_data.tree 'peter-murach', 'github', 'c18647b75d72f19c1e0cc8af031e5d833b7f12ea' # => gets a tree
96
-
97
- @github.git_data.tree 'peter-murach', 'github', 'c18647b75d72f19c1e0cc8af031e5d833b7f12ea', :recursive => true # => gets a whole tree recursively
98
-
99
- by passing a block you can iterate over the file tree
100
-
101
- @github.git_data.tree 'peter-murach', 'github', 'c18647b75d72f19c1e0cc8af031e5d833b7f12ea', :recursive => true do |file|
102
- puts file.path
103
- end
104
-
105
- == OAuth
106
-
107
- In order to authenticate the user through OAuth2 on GitHub you need to
108
-
109
- * visit https://github.com/account/applications/ and register your app
110
-
111
- * authorize your credentials https://github.com/login/oauth/authorize
112
- You can use convenience methods to help you achieve this that come with this gem:
113
-
114
- @github = Github.new :client_id => '...', :client_secret => '...'
115
- @github.authorize_url :redirect_uri => 'http://localhost', :scope => 'repo'
116
- # => "https://github.com/login/oauth/authorize?scope=repo&response_type=code&client_id='...'&redirect_uri=http%3A%2F%2Flocalhost"
117
-
118
- After you get your authorization code, call to receive your access_token
119
-
120
- token = github.get_token( authorization_code )
121
-
122
- Once you have your access token, configure your github instance following instructions under Configuration.
123
-
124
- Alternatively you can use OAuth Authorizations API. For instance, to create access token through GitHub API do following
125
-
126
- @github = Github.new :basic_auth => 'login:password'
127
- @github.oauth.create_authorization 'scopes' => ['repo']
128
-
129
- You can add more than one scope from the <tt>user</tt>, <tt>public_repo</tt>, <tt>repo</tt>, <tt>gist</tt> or leave the scopes parameter out, in which case, the default read-only access will be assumed(includes public user profile info, public repo info, and gists).
130
-
131
- == MIME Types
132
-
133
- Issues, PullRequests and few other API leverage custom mime types which are <tt>:json</tt>, <tt>:blob</tt>, <tt>:raw</tt>, <tt>:text</tt>, <tt>:html</tt>, <tt>:full</tt>. By default <tt>:raw</tt> is used.
134
-
135
- In order to pass a mime type with your request do
136
-
137
- @github = Github.new
138
- @github.pull_requests.pull_requests 'peter-murach', 'github', :mime_type => :full
139
-
140
- Your header will contain 'Accept: "application/vnd.github-pull.full+json"' which in turn returns raw, text and html representations in response body.
141
-
142
- == Configuration
143
-
144
- Certain methods require authentication. To get your GitHub OAuth v2 credentials,
145
- register an app at https://github.com/account/applications/
146
-
147
- Github.configure do |config|
148
- config.oauth_token = YOUR_OAUTH_ACCESS_TOKEN
149
- config.basic_auth = 'login:password'
150
- end
151
-
152
- or
153
-
154
- Github.new(:oauth_token => YOUR_OAUTH_TOKEN)
155
- Github.new(:basic_auth => 'login:password)
156
-
157
- All parameters can be overwirtten as per method call. By passing parameters hash...
158
-
159
- == Caching
160
-
161
- Each <tt>get</tt> request by default is not going to be cached. In order to set the cache do... If no cache type is provided a default memoization is done.
162
-
163
- Github.cache do...
164
-
165
- == Examples
166
-
167
- Some api methods require input parameters, these are added simply as a hash properties, for instance
168
-
169
- @issues = Github::Issues.new :user => 'peter-murach', :repo => 'github-api'
170
- @issues.milestones :state => 'open', :sort => 'due_date', :direction => 'asc'
171
-
172
- Other methods may require inputs as an array of strings
173
-
174
- @users = Github::Users.new :oauth_token => '...'
175
- @users.add_email 'email1', 'email2', ..., 'emailn' # => Adds emails to the authenticated user
176
-
177
- If a method returns a collection, you can iterator over it by supplying a block parameter,
178
-
179
- @issues = Github::Issues.new :user => 'peter-murach', :repo => 'github-api'
180
- @issues.events do |event|
181
- puts event.actor.login
182
- end
183
-
184
- Query requests instead of http responses return boolean values
185
-
186
- @github = Github.new
187
- @github.orgs.public_member? 'github', 'technoweenie' # => true
188
-
189
- == Rails Example
190
-
191
- A Rails controller that allows a user to authorize their GitHub account and then perform request.
192
-
193
- class GithubController < ApplicationController
194
-
195
- def authorize
196
- github = Github.new :client_id => '...', :client_secret => '...'
197
- address = github.authorize_url :redirect_uri => 'http://...', :scope => 'repo'
198
- redirect_to address
199
- end
200
-
201
- def callback
202
- authorization_code = params[:code]
203
- token = github.get_token authorization_code
204
- access_token = token.token
205
- end
206
- end
207
-
208
- == TODO
209
-
210
- * Add request caching - local filestore?, http caching?.
211
- * Add response processing methods
212
- * Add response set helper methods e.i. pagination.
213
- * Add DSL falvoured api access
214
-
215
- == Contributing to github
216
-
217
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
218
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
219
- * Fork the project
220
- * Start a feature/bugfix branch
221
- * Commit and push until you are happy with your contribution
222
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
223
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
224
-
225
- == Copyright
226
-
227
- Copyright (c) 2011 Piotr Murach. See LICENSE.txt for
228
- further details.
data/Rakefile DELETED
@@ -1,52 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "github"
18
- gem.homepage = "http://github.com/peter-murach/github"
19
- gem.license = "MIT"
20
- gem.summary = %Q{TODO: one-line summary of your gem}
21
- gem.description = %Q{TODO: longer description of your gem}
22
- gem.email = ""
23
- gem.authors = ["Piotr Murach"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
- require 'rspec/core'
29
- require 'rspec/core/rake_task'
30
- RSpec::Core::RakeTask.new(:spec) do |spec|
31
- spec.pattern = FileList['spec/**/*_spec.rb']
32
- end
33
-
34
- RSpec::Core::RakeTask.new(:rcov) do |spec|
35
- spec.pattern = 'spec/**/*_spec.rb'
36
- spec.rcov = true
37
- end
38
-
39
- require 'cucumber/rake/task'
40
- Cucumber::Rake::Task.new(:features)
41
-
42
- task :default => :spec
43
-
44
- require 'rake/rdoctask'
45
- Rake::RDocTask.new do |rdoc|
46
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
47
-
48
- rdoc.rdoc_dir = 'rdoc'
49
- rdoc.title = "github #{version}"
50
- rdoc.rdoc_files.include('README*')
51
- rdoc.rdoc_files.include('lib/**/*.rb')
52
- end