git_hub 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/README.rdoc +16 -2
  2. data/VERSION +1 -1
  3. data/bin/git_hub +1 -2
  4. data/git_hub.gemspec +30 -3
  5. data/lib/git_hub/api.rb +6 -0
  6. data/lib/git_hub/base.rb +52 -10
  7. data/lib/git_hub/commit.rb +45 -0
  8. data/lib/git_hub/repo.rb +47 -51
  9. data/rdoc/classes/GitHub/Api.html +300 -0
  10. data/rdoc/classes/GitHub/Base.html +423 -0
  11. data/rdoc/classes/GitHub/Repo.html +738 -0
  12. data/rdoc/classes/GitHub.html +310 -0
  13. data/rdoc/created.rid +1 -0
  14. data/rdoc/files/README_rdoc.html +171 -0
  15. data/rdoc/files/lib/git_hub/api_rb.html +103 -0
  16. data/rdoc/files/lib/git_hub/base_rb.html +101 -0
  17. data/rdoc/files/lib/git_hub/repo_rb.html +91 -0
  18. data/rdoc/files/lib/git_hub_rb.html +91 -0
  19. data/rdoc/fr_class_index.html +33 -0
  20. data/rdoc/fr_file_index.html +35 -0
  21. data/rdoc/fr_method_index.html +81 -0
  22. data/rdoc/index.html +23 -0
  23. data/rdoc/rdoc-style.css +299 -0
  24. data/spec/git_hub/base_spec.rb +2 -2
  25. data/spec/git_hub/commit_spec.rb +53 -0
  26. data/spec/git_hub/repo_spec.rb +123 -85
  27. data/spec/spec_helper.rb +35 -8
  28. data/spec/stubs/api_route_error.res +14 -0
  29. data/spec/stubs/commits/list/joe007/fine_repo/master/README.res +28 -0
  30. data/spec/stubs/commits/list/joe007/fine_repo/master.res +84 -0
  31. data/spec/stubs/commits/show/joe007/fine_repo/5e61f0687c40ca48214d09dc7ae2d0d0d8fbfeb8.res +38 -0
  32. data/spec/stubs/repos/create.1.res +22 -0
  33. data/spec/stubs/repos/{create.res → create.2.res} +0 -0
  34. data/spec/stubs/repos/create.3.res +100 -0
  35. data/spec/stubs/repos/create.4.res +14 -0
  36. data/spec/stubs/repos/show/joe007/fine_repo/branches.res +15 -0
  37. data/spec/stubs/repos/show/joe007/fine_repo/tags.res +17 -0
  38. metadata +30 -3
@@ -0,0 +1,300 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <title>Class: GitHub::Api [zemax 0.1.0
6
+ ]</title>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
9
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
10
+ <script type="text/javascript">
11
+ // <![CDATA[
12
+
13
+ function popupCode( url ) {
14
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
15
+ }
16
+
17
+ function toggleCode( id ) {
18
+ if ( document.getElementById )
19
+ elem = document.getElementById( id );
20
+ else if ( document.all )
21
+ elem = eval( "document.all." + id );
22
+ else
23
+ return false;
24
+
25
+ elemStyle = elem.style;
26
+
27
+ if ( elemStyle.display != "block" ) {
28
+ elemStyle.display = "block"
29
+ } else {
30
+ elemStyle.display = "none"
31
+ }
32
+
33
+ return true;
34
+ }
35
+
36
+ // Make codeblocks hidden by default
37
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
38
+
39
+ // ]]>
40
+ </script>
41
+
42
+ </head>
43
+ <body>
44
+
45
+
46
+ <div id="classHeader">
47
+ <table class="header-table">
48
+ <tr class="top-aligned-row">
49
+ <td><strong>Class</strong></td>
50
+ <td class="class-name-in-header">GitHub::Api</td>
51
+ </tr>
52
+ <tr class="top-aligned-row">
53
+ <td><strong>In:</strong></td>
54
+ <td>
55
+
56
+
57
+ <a href="../../files/lib/git_hub/api_rb.html">
58
+
59
+ lib/git_hub/api.rb
60
+
61
+ </a>
62
+
63
+
64
+ <br />
65
+
66
+ </td>
67
+ </tr>
68
+
69
+
70
+ <tr class="top-aligned-row">
71
+ <td><strong>Parent:</strong></td>
72
+ <td>
73
+
74
+ Object
75
+
76
+ </td>
77
+ </tr>
78
+
79
+ </table>
80
+ </div>
81
+ <!-- banner header -->
82
+
83
+ <div id="bodyContent">
84
+
85
+ <div id="contextContent">
86
+
87
+ </div>
88
+
89
+
90
+ <div id="method-list">
91
+ <h3 class="section-bar">Methods</h3>
92
+
93
+ <div class="name-list">
94
+
95
+ <a href="#M000005">auth</a>&nbsp;&nbsp;
96
+
97
+ <a href="#M000006">authenticated?</a>&nbsp;&nbsp;
98
+
99
+ <a href="#M000007">classify</a>&nbsp;&nbsp;
100
+
101
+ <a href="#M000008">request</a>&nbsp;&nbsp;
102
+
103
+ </div>
104
+ </div>
105
+
106
+ </div>
107
+
108
+ <!-- if includes -->
109
+
110
+ <div id="includes">
111
+ <h3 class="section-bar">Included Modules</h3>
112
+
113
+ <div id="includes-list">
114
+
115
+ <span class="include-name">Singleton</span>
116
+
117
+ </div>
118
+ </div>
119
+
120
+ <div id="section">
121
+
122
+
123
+
124
+ <div id="attribute-list">
125
+ <h3 class="section-bar">Attributes</h3>
126
+
127
+ <div class="name-list">
128
+ <table>
129
+
130
+ <tr class="top-aligned-row context-row">
131
+ <td class="context-item-name">auth</td>
132
+
133
+ <td class="context-item-value">&nbsp;[W]&nbsp;</td>
134
+
135
+ <td class="context-item-desc"></td>
136
+ </tr>
137
+
138
+ </table>
139
+ </div>
140
+ </div>
141
+
142
+
143
+ <!-- if method_list -->
144
+
145
+ <div id="methods">
146
+
147
+ <h3 class="section-bar">Public Instance methods</h3>
148
+
149
+
150
+ <div id="method-M000005" class="method-detail">
151
+ <a name="M000005"></a>
152
+
153
+ <div class="method-heading">
154
+
155
+ <a href="#M000005" class="method-signature">
156
+
157
+ <span class="method-name">auth</span><span class="method-args">()</span>
158
+
159
+ </a>
160
+
161
+ </div>
162
+
163
+ <div class="method-description">
164
+
165
+ <p><a class="source-toggle" href="#"
166
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
167
+ <div class="method-source-code" id="M000005-source">
168
+ <pre>
169
+ <span class="ruby-comment cmt"># File lib/git_hub/api.rb, line 10</span>
170
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">auth</span>
171
+ <span class="ruby-ivar">@auth</span> <span class="ruby-operator">||</span> {}
172
+ <span class="ruby-keyword kw">end</span>
173
+ </pre>
174
+ </div>
175
+
176
+ </div>
177
+ </div>
178
+
179
+
180
+ <div id="method-M000006" class="method-detail">
181
+ <a name="M000006"></a>
182
+
183
+ <div class="method-heading">
184
+
185
+ <a href="#M000006" class="method-signature">
186
+
187
+ <span class="method-name">authenticated?</span><span class="method-args">()</span>
188
+
189
+ </a>
190
+
191
+ </div>
192
+
193
+ <div class="method-description">
194
+
195
+ <p><a class="source-toggle" href="#"
196
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
197
+ <div class="method-source-code" id="M000006-source">
198
+ <pre>
199
+ <span class="ruby-comment cmt"># File lib/git_hub/api.rb, line 14</span>
200
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">authenticated?</span>
201
+ <span class="ruby-identifier">auth</span> <span class="ruby-operator">!=</span> {}
202
+ <span class="ruby-keyword kw">end</span>
203
+ </pre>
204
+ </div>
205
+
206
+ </div>
207
+ </div>
208
+
209
+
210
+ <div id="method-M000007" class="method-detail">
211
+ <a name="M000007"></a>
212
+
213
+ <div class="method-heading">
214
+
215
+ <a href="#M000007" class="method-signature">
216
+
217
+ <span class="method-name">classify</span><span class="method-args">(name)</span>
218
+
219
+ </a>
220
+
221
+ </div>
222
+
223
+ <div class="method-description">
224
+
225
+ <p>
226
+ Turns string into appropriate class constant, returns nil if class not
227
+ found
228
+ </p>
229
+
230
+ <p><a class="source-toggle" href="#"
231
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
232
+ <div class="method-source-code" id="M000007-source">
233
+ <pre>
234
+ <span class="ruby-comment cmt"># File lib/git_hub/api.rb, line 19</span>
235
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">classify</span> <span class="ruby-identifier">name</span>
236
+ <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;::&quot;</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Kernel</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">klass</span>, <span class="ruby-identifier">const_name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">const_get</span> <span class="ruby-identifier">const_name</span> }
237
+ <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Class</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">klass</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
238
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span>
239
+ <span class="ruby-keyword kw">nil</span>
240
+ <span class="ruby-keyword kw">end</span>
241
+ </pre>
242
+ </div>
243
+
244
+ </div>
245
+ </div>
246
+
247
+
248
+ <div id="method-M000008" class="method-detail">
249
+ <a name="M000008"></a>
250
+
251
+ <div class="method-heading">
252
+
253
+ <a href="#M000008" class="method-signature">
254
+
255
+ <span class="method-name">request</span><span class="method-args">(verb, url, params = {})</span>
256
+
257
+ </a>
258
+
259
+ </div>
260
+
261
+ <div class="method-description">
262
+
263
+ <p><a class="source-toggle" href="#"
264
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
265
+ <div class="method-source-code" id="M000008-source">
266
+ <pre>
267
+ <span class="ruby-comment cmt"># File lib/git_hub/api.rb, line 26</span>
268
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request</span> <span class="ruby-identifier">verb</span>, <span class="ruby-identifier">url</span>, <span class="ruby-identifier">params</span> = {}
269
+ <span class="ruby-identifier">method</span> = <span class="ruby-identifier">classify</span>(<span class="ruby-value str">'Net::HTTP::'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">verb</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">capitalize</span>)
270
+ <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span> <span class="ruby-identifier">url</span>
271
+ <span class="ruby-identifier">server</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>)
272
+ <span class="ruby-identifier">server</span>.<span class="ruby-identifier">use_ssl</span> = (<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">scheme</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'https'</span>)
273
+ <span class="ruby-identifier">server</span>.<span class="ruby-identifier">verify_mode</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_NONE</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">server</span>.<span class="ruby-identifier">use_ssl?</span>
274
+ <span class="ruby-identifier">server</span>.<span class="ruby-identifier">start</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
275
+ <span class="ruby-identifier">req</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>)
276
+ <span class="ruby-identifier">req</span>.<span class="ruby-identifier">form_data</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">auth</span>)
277
+ <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">req</span>)
278
+ <span class="ruby-keyword kw">end</span>
279
+ <span class="ruby-keyword kw">end</span>
280
+ </pre>
281
+ </div>
282
+
283
+ </div>
284
+ </div>
285
+
286
+
287
+
288
+ </div>
289
+
290
+
291
+
292
+
293
+ </div>
294
+
295
+ <div id="validator-badges">
296
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
297
+ </div>
298
+
299
+ </body>
300
+ </html>