twitch 0.0.5 → 0.1.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/twitch/client.rb +125 -70
- data/lib/twitch/request.rb +1 -1
- data/lib/twitch/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23781ae0fb82fe7205a8b07bd14a47f5bbdcf6bd
|
4
|
+
data.tar.gz: fafa98561b1df4230c13ebe7ff385291f0d71764
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36478d840ee2ead80c59612f88ab5392e418e273ccbaa014e2c2895629fbeb379fcc9068adff451c7f829e83e1a9b82e5f70fdae7d599ac7678bbfed69bace46
|
7
|
+
data.tar.gz: c57d5129e3163d0c78522fc3d08eb2e735558663d94c063f588a4fc413530ba3c102591aa32f7e2d73efd54b066e17a67cea2f6d0a7b3bcd0a0677691a8a4645
|
data/lib/twitch/client.rb
CHANGED
@@ -27,7 +27,7 @@ module Twitch
|
|
27
27
|
get_adapter(adapter)
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def link
|
31
31
|
scope = ""
|
32
32
|
@scope.each { |s| scope += s + '+' }
|
33
33
|
link = "https://api.twitch.tv/kraken/oauth2/authorize?response_type=code&client_id=#{@client_id}&redirect_uri=#{@redirect_uri}&scope=#{scope}"
|
@@ -47,59 +47,74 @@ module Twitch
|
|
47
47
|
|
48
48
|
# User
|
49
49
|
|
50
|
-
def
|
50
|
+
def user(user = nil)
|
51
|
+
return your_user unless user
|
52
|
+
|
51
53
|
path = "/users/"
|
52
54
|
url = @base_url + path + user;
|
55
|
+
|
53
56
|
get(url)
|
54
57
|
end
|
55
58
|
|
56
|
-
def
|
57
|
-
return false
|
59
|
+
def your_user
|
60
|
+
return false unless @access_token
|
61
|
+
|
58
62
|
path = "/user?oauth_token=#{@access_token}"
|
59
63
|
url = @base_url + path
|
64
|
+
|
60
65
|
get(url)
|
61
66
|
end
|
62
67
|
|
63
68
|
# Teams
|
64
69
|
|
65
|
-
def
|
70
|
+
def teams
|
66
71
|
path = "/teams/"
|
67
72
|
url = @base_url + path;
|
73
|
+
|
68
74
|
get(url)
|
69
75
|
end
|
70
76
|
|
71
77
|
|
72
|
-
def
|
78
|
+
def team(team_id)
|
73
79
|
path = "/teams/"
|
74
80
|
url = @base_url + path + team_id;
|
81
|
+
|
75
82
|
get(url)
|
76
83
|
end
|
77
84
|
|
78
85
|
# Channel
|
79
86
|
|
80
|
-
def
|
87
|
+
def channel(channel = nil)
|
88
|
+
return your_channel unless channel
|
89
|
+
|
81
90
|
path = "/channels/"
|
82
91
|
url = @base_url + path + channel;
|
92
|
+
|
83
93
|
get(url)
|
84
94
|
end
|
85
95
|
|
86
|
-
def
|
87
|
-
return false
|
96
|
+
def your_channel
|
97
|
+
return false unless @access_token
|
98
|
+
|
88
99
|
path = "/channel?oauth_token=#{@access_token}"
|
89
100
|
url = @base_url + path;
|
101
|
+
|
90
102
|
get(url)
|
91
103
|
end
|
92
104
|
|
93
|
-
def
|
94
|
-
return false
|
105
|
+
def editors(channel)
|
106
|
+
return false unless @access_token
|
107
|
+
|
95
108
|
path = "/channels/#{channel}/editors?oauth_token=#{@access_token}"
|
96
109
|
url = @base_url + path;
|
110
|
+
|
97
111
|
get(url)
|
98
112
|
end
|
99
113
|
|
100
114
|
# TODO: Add ability to set delay, which is only available for partered channels
|
101
|
-
def
|
102
|
-
return false
|
115
|
+
def edit_channel(channel, status, game)
|
116
|
+
return false unless @access_token
|
117
|
+
|
103
118
|
path = "/channels/#{channel}/?oauth_token=#{@access_token}"
|
104
119
|
url = @base_url + path
|
105
120
|
data = {
|
@@ -111,29 +126,33 @@ module Twitch
|
|
111
126
|
put(url, data)
|
112
127
|
end
|
113
128
|
|
114
|
-
def
|
115
|
-
return false
|
129
|
+
def reset_key(channel)
|
130
|
+
return false unless @access_token
|
131
|
+
|
116
132
|
path = "/channels/#{channel}/stream_key?oauth_token=#{@access_token}"
|
117
133
|
url = @base_url + path
|
118
134
|
delete(url)
|
119
135
|
end
|
120
136
|
|
121
|
-
def
|
122
|
-
return false
|
137
|
+
def follow_channel(username, channel)
|
138
|
+
return false unless @access_token
|
139
|
+
|
123
140
|
path = "/users/#{username}/follows/channels/#{channel}?oauth_token=#{@access_token}"
|
124
141
|
url = @base_url + path
|
125
142
|
put(url)
|
126
143
|
end
|
127
144
|
|
128
|
-
def
|
129
|
-
return false
|
145
|
+
def follow_channel(username, channel)
|
146
|
+
return false unless @access_token
|
147
|
+
|
130
148
|
path = "/users/#{username}/follows/channels/#{channel}?oauth_token=#{@access_token}"
|
131
149
|
url = @base_url + path
|
132
150
|
delete(url)
|
133
151
|
end
|
134
152
|
|
135
|
-
def
|
136
|
-
return false
|
153
|
+
def run_commercial(channel, length = 30)
|
154
|
+
return false unless @access_token
|
155
|
+
|
137
156
|
path = "/channels/#{channel}/commercial?oauth_token=#{@access_token}"
|
138
157
|
url = @base_url + path
|
139
158
|
post(url, {
|
@@ -141,143 +160,167 @@ module Twitch
|
|
141
160
|
})
|
142
161
|
end
|
143
162
|
|
144
|
-
def
|
145
|
-
return false
|
163
|
+
def channel_teams(channel)
|
164
|
+
return false unless @access_token
|
165
|
+
|
146
166
|
path = "/channels/#{channel}/teams?oauth_token=#{@access_token}"
|
147
167
|
url = @base_url + path;
|
168
|
+
|
148
169
|
get(url)
|
149
170
|
end
|
150
171
|
|
151
172
|
# Streams
|
152
173
|
|
153
|
-
def
|
174
|
+
def stream(stream_name)
|
154
175
|
path = "/stream/#{stream_name}"
|
155
176
|
url = @base_url + path;
|
177
|
+
|
156
178
|
get(url)
|
157
179
|
end
|
158
180
|
|
159
|
-
def
|
181
|
+
def stream(stream_name)
|
160
182
|
path = "/streams/#{stream_name}"
|
161
183
|
url = @base_url + path;
|
184
|
+
|
162
185
|
get(url)
|
163
186
|
end
|
164
187
|
|
165
|
-
def
|
166
|
-
query =
|
188
|
+
def streams(options = {})
|
189
|
+
query = build_query_string(options)
|
167
190
|
path = "/streams"
|
168
191
|
url = @base_url + path + query
|
192
|
+
|
169
193
|
get(url)
|
170
194
|
end
|
171
195
|
|
172
|
-
def
|
173
|
-
query =
|
196
|
+
def featured_streams(options = {})
|
197
|
+
query = build_query_string(options)
|
174
198
|
path = "/streams/featured"
|
175
199
|
url = @base_url + path + query
|
200
|
+
|
176
201
|
get(url)
|
177
202
|
end
|
178
203
|
|
179
|
-
def
|
180
|
-
query =
|
204
|
+
def summarized_streams(options = {})
|
205
|
+
query = build_query_string(options)
|
181
206
|
path = "/streams/summary"
|
182
207
|
url = @base_url + path + query
|
208
|
+
|
183
209
|
get(url)
|
184
210
|
end
|
185
211
|
|
186
|
-
def
|
187
|
-
return false
|
188
|
-
|
212
|
+
def followed_streams(options = {})
|
213
|
+
return false unless @access_token
|
214
|
+
|
215
|
+
query = build_query_string(options)
|
189
216
|
path = "/streams/followed?oauth_token=#{@access_token}"
|
190
217
|
url = @base_url + path + query
|
218
|
+
|
191
219
|
get(url)
|
192
220
|
end
|
221
|
+
alias :your_followed_streams :followed_streams
|
193
222
|
|
194
223
|
#Games
|
195
224
|
|
196
|
-
def
|
197
|
-
query =
|
225
|
+
def top_games(options = {})
|
226
|
+
query = build_query_string(options)
|
198
227
|
path = "/games/top"
|
199
228
|
url = @base_url + path + query
|
229
|
+
|
200
230
|
get(url)
|
201
231
|
end
|
202
232
|
|
203
233
|
#Search
|
204
234
|
|
205
|
-
def
|
206
|
-
query =
|
235
|
+
def search_channels(options = {})
|
236
|
+
query = build_query_string(options)
|
207
237
|
path = "/search/channels"
|
208
238
|
url = @base_url + path + query
|
239
|
+
|
209
240
|
get(url)
|
210
241
|
end
|
211
242
|
|
212
|
-
def
|
213
|
-
query =
|
243
|
+
def search_streams(options = {})
|
244
|
+
query = build_query_string(options)
|
214
245
|
path = "/search/streams"
|
215
246
|
url = @base_url + path + query
|
247
|
+
|
216
248
|
get(url)
|
217
249
|
end
|
218
250
|
|
219
|
-
def
|
220
|
-
query =
|
251
|
+
def search_games(options = {})
|
252
|
+
query = build_query_string(options)
|
221
253
|
path = "/search/games"
|
222
254
|
url = @base_url + path + query
|
255
|
+
|
223
256
|
get(url)
|
224
257
|
end
|
225
258
|
|
226
259
|
# Videos
|
227
260
|
|
228
|
-
def
|
229
|
-
query =
|
261
|
+
def channel_videos(channel, options = {})
|
262
|
+
query = build_query_string(options)
|
230
263
|
path = "/channels/#{channel}/videos"
|
231
264
|
url = @base_url + path + query
|
265
|
+
|
232
266
|
get(url)
|
233
267
|
end
|
234
268
|
|
235
|
-
def
|
269
|
+
def video(video_id)
|
236
270
|
path = "/videos/#{video_id}/"
|
237
271
|
url = @base_url + path
|
272
|
+
|
238
273
|
get(url)
|
239
274
|
end
|
240
275
|
|
241
|
-
def
|
242
|
-
query =
|
276
|
+
def subscribed?(username, channel, options = {})
|
277
|
+
query = build_query_string(options)
|
243
278
|
path = "/users/#{username}/subscriptions/#{channel}?oauth_token=#{@access_token}"
|
244
279
|
url = @base_url + path + query
|
280
|
+
|
245
281
|
get(url)
|
246
282
|
end
|
247
283
|
|
248
|
-
def
|
249
|
-
return false
|
250
|
-
|
284
|
+
def followed_videos(options ={})
|
285
|
+
return false unless @access_token
|
286
|
+
|
287
|
+
query = build_query_string(options)
|
251
288
|
path = "/videos/followed?oauth_token=#{@access_token}"
|
252
289
|
url = @base_url + path + query
|
290
|
+
|
253
291
|
get(url)
|
254
292
|
end
|
293
|
+
alias :your_followed_videos :followed_videos
|
255
294
|
|
256
|
-
def
|
257
|
-
query =
|
295
|
+
def top_videos(options = {})
|
296
|
+
query = build_query_string(options)
|
258
297
|
path = "/videos/top"
|
259
298
|
url = @base_url + path + query
|
299
|
+
|
260
300
|
get(url)
|
261
301
|
end
|
262
302
|
|
263
303
|
# Blocks
|
264
304
|
|
265
|
-
def
|
266
|
-
query =
|
305
|
+
def blocks(username, options = {})
|
306
|
+
query = build_query_string(options)
|
267
307
|
path = "/users/#{username}/blocks?oauth_token=#{@access_token}"
|
268
308
|
url = @base_url + path + query
|
309
|
+
|
269
310
|
get(url)
|
270
311
|
end
|
271
312
|
|
272
|
-
def
|
273
|
-
return false
|
313
|
+
def block_user(username, target)
|
314
|
+
return false unless @access_token
|
315
|
+
|
274
316
|
path = "/users/#{username}/blocks/#{target}?oauth_token=#{@access_token}"
|
275
317
|
url = @base_url + path
|
276
318
|
put(url)
|
277
319
|
end
|
278
320
|
|
279
|
-
def
|
280
|
-
return false
|
321
|
+
def unblock_user(username, target)
|
322
|
+
return false unless @access_token
|
323
|
+
|
281
324
|
path = "/users/#{username}/blocks/#{target}?oauth_token=#{@access_token}"
|
282
325
|
url = @base_url + path
|
283
326
|
delete(url)
|
@@ -285,73 +328,85 @@ module Twitch
|
|
285
328
|
|
286
329
|
# Chat
|
287
330
|
|
288
|
-
def
|
331
|
+
def chat_links(channel)
|
289
332
|
path = "/chat/"
|
290
333
|
url = @base_url + path + channel;
|
334
|
+
|
291
335
|
get(url)
|
292
336
|
end
|
293
337
|
|
294
|
-
def
|
338
|
+
def badges(channel)
|
295
339
|
path = "/chat/#{channel}/badges"
|
296
340
|
url = @base_url + path;
|
341
|
+
|
297
342
|
get(url)
|
298
343
|
end
|
299
344
|
|
300
|
-
def
|
345
|
+
def emoticons()
|
301
346
|
path = "/chat/emoticons"
|
302
347
|
url = @base_url + path;
|
348
|
+
|
303
349
|
get(url)
|
304
350
|
end
|
305
351
|
|
306
352
|
# Follows
|
307
353
|
|
308
|
-
def
|
354
|
+
def following(channel)
|
309
355
|
path = "/channels/#{channel}/follows"
|
310
356
|
url = @base_url + path;
|
357
|
+
|
311
358
|
get(url)
|
312
359
|
end
|
313
360
|
|
314
|
-
def
|
361
|
+
def followed(username)
|
315
362
|
path = "/users/#{username}/follows/channels"
|
316
363
|
url = @base_url + path;
|
364
|
+
|
317
365
|
get(url)
|
318
366
|
end
|
319
367
|
|
320
|
-
def
|
368
|
+
def follow_status(username, channel)
|
321
369
|
path = "/users/#{username}/follows/channels/#{channel}/?oauth_token=#{@access_token}"
|
322
370
|
url = @base_url + path;
|
371
|
+
|
323
372
|
get(url)
|
324
373
|
end
|
325
374
|
|
326
375
|
# Ingests
|
327
376
|
|
328
|
-
def
|
377
|
+
def ingests()
|
329
378
|
path = "/ingests"
|
330
379
|
url = @base_url + path
|
380
|
+
|
331
381
|
get(url)
|
332
382
|
end
|
333
383
|
|
334
384
|
# Root
|
335
385
|
|
336
|
-
def
|
386
|
+
def root()
|
337
387
|
path = "/?oauth_token=#{@access_token}"
|
338
388
|
url = @base_url + path
|
389
|
+
|
339
390
|
get(url)
|
340
391
|
end
|
341
392
|
|
342
393
|
# Subscriptions
|
343
394
|
|
344
|
-
def
|
345
|
-
return false
|
395
|
+
def subscribed(channel)
|
396
|
+
return false unless @access_token
|
397
|
+
|
346
398
|
path = "/channels/#{channel}/subscriptions?oauth_token=#{@access_token}"
|
347
399
|
url = @base_url + path
|
400
|
+
|
348
401
|
get(url)
|
349
402
|
end
|
350
403
|
|
351
|
-
def
|
352
|
-
return false
|
404
|
+
def subscribed_to_channel(username, channel)
|
405
|
+
return false unless @access_token
|
406
|
+
|
353
407
|
path = "/channels/#{channel}/subscriptions/#{username}?oauth_token=#{@access_token}"
|
354
408
|
url = @base_url + path
|
409
|
+
|
355
410
|
get(url)
|
356
411
|
end
|
357
412
|
end
|
data/lib/twitch/request.rb
CHANGED
data/lib/twitch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Lakin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|