twitch 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e01cfa52014420d7bca4357d604ffeeea8fe3158
4
- data.tar.gz: dc7a066938e2164ab2208024b5c14b622f626fa0
3
+ metadata.gz: 42dcce08152daf5809e300e8dbce720105a563f8
4
+ data.tar.gz: 734d40778e5635ac89d288c63b93e85064133f39
5
5
  SHA512:
6
- metadata.gz: c875b08cd678e419352b89edf524c00f31f434ca503b19c1d39af63fcbf8bc2b29919024df3fd55e74a4ab909cb6fb3fe443f7015bc3ef0473de1a76b19cb63b
7
- data.tar.gz: 9231a9be8cc99411e0050e7e74c2795507b1f2b718d2ed39ffba27a00c2b38702382013067a608b89a9e0c8e2f0e87386308c6ed6e4feac2fa9942dd003e6055
6
+ metadata.gz: 49e0ae1757007e1a0cd6a682c2ddececc1421f46474e38120c772575e8624b09744d0f0c6d1ad6376b2fc62623942e414ad576fcf885436f141df8dda6ffbf99
7
+ data.tar.gz: 6d0b8b3caf0ad9b8d0c29d49329e036f123025104450b11a80dbc529090497dce60206a3d09c7d27c4db0f6bd8fd215afdf0aa4b27785d743b1554441eaffefa
@@ -30,7 +30,7 @@ module Twitch
30
30
  def link
31
31
  scope = ""
32
32
  @scope.each { |s| scope += s + '+' }
33
- link = "https://api.twitch.tv/kraken/oauth2/authorize?response_type=code&client_id=#{@client_id}&redirect_uri=#{@redirect_uri}&scope=#{scope}"
33
+ "#{@base_url}/oauth2/authorize?response_type=code&client_id=#{@client_id}&redirect_uri=#{@redirect_uri}&scope=#{scope}"
34
34
  end
35
35
 
36
36
  def auth(code)
@@ -52,7 +52,7 @@ module Twitch
52
52
 
53
53
  path = "/users/"
54
54
  url = @base_url + path + user;
55
-
55
+
56
56
  get(url)
57
57
  end
58
58
 
@@ -61,7 +61,7 @@ module Twitch
61
61
 
62
62
  path = "/user?oauth_token=#{@access_token}"
63
63
  url = @base_url + path
64
-
64
+
65
65
  get(url)
66
66
  end
67
67
 
@@ -70,7 +70,7 @@ module Twitch
70
70
  def teams
71
71
  path = "/teams/"
72
72
  url = @base_url + path;
73
-
73
+
74
74
  get(url)
75
75
  end
76
76
 
@@ -78,7 +78,7 @@ module Twitch
78
78
  def team(team_id)
79
79
  path = "/teams/"
80
80
  url = @base_url + path + team_id;
81
-
81
+
82
82
  get(url)
83
83
  end
84
84
 
@@ -89,7 +89,7 @@ module Twitch
89
89
 
90
90
  path = "/channels/"
91
91
  url = @base_url + path + channel;
92
-
92
+
93
93
  get(url)
94
94
  end
95
95
 
@@ -98,16 +98,16 @@ module Twitch
98
98
 
99
99
  path = "/channel?oauth_token=#{@access_token}"
100
100
  url = @base_url + path;
101
-
101
+
102
102
  get(url)
103
103
  end
104
-
104
+
105
105
  def editors(channel)
106
106
  return false unless @access_token
107
107
 
108
108
  path = "/channels/#{channel}/editors?oauth_token=#{@access_token}"
109
109
  url = @base_url + path;
110
-
110
+
111
111
  get(url)
112
112
  end
113
113
 
@@ -125,7 +125,7 @@ module Twitch
125
125
  }
126
126
  put(url, data)
127
127
  end
128
-
128
+
129
129
  def reset_key(channel)
130
130
  return false unless @access_token
131
131
 
@@ -141,8 +141,8 @@ module Twitch
141
141
  url = @base_url + path
142
142
  put(url)
143
143
  end
144
-
145
- def follow_channel(username, channel)
144
+
145
+ def unfollow_channel(username, channel)
146
146
  return false unless @access_token
147
147
 
148
148
  path = "/users/#{username}/follows/channels/#{channel}?oauth_token=#{@access_token}"
@@ -159,13 +159,13 @@ module Twitch
159
159
  :length => length
160
160
  })
161
161
  end
162
-
162
+
163
163
  def channel_teams(channel)
164
164
  return false unless @access_token
165
165
 
166
166
  path = "/channels/#{channel}/teams?oauth_token=#{@access_token}"
167
167
  url = @base_url + path;
168
-
168
+
169
169
  get(url)
170
170
  end
171
171
 
@@ -174,14 +174,14 @@ module Twitch
174
174
  def stream(stream_name)
175
175
  path = "/stream/#{stream_name}"
176
176
  url = @base_url + path;
177
-
177
+
178
178
  get(url)
179
179
  end
180
180
 
181
181
  def stream(stream_name)
182
182
  path = "/streams/#{stream_name}"
183
183
  url = @base_url + path;
184
-
184
+
185
185
  get(url)
186
186
  end
187
187
 
@@ -189,7 +189,7 @@ module Twitch
189
189
  query = build_query_string(options)
190
190
  path = "/streams"
191
191
  url = @base_url + path + query
192
-
192
+
193
193
  get(url)
194
194
  end
195
195
 
@@ -197,7 +197,7 @@ module Twitch
197
197
  query = build_query_string(options)
198
198
  path = "/streams/featured"
199
199
  url = @base_url + path + query
200
-
200
+
201
201
  get(url)
202
202
  end
203
203
 
@@ -205,7 +205,7 @@ module Twitch
205
205
  query = build_query_string(options)
206
206
  path = "/streams/summary"
207
207
  url = @base_url + path + query
208
-
208
+
209
209
  get(url)
210
210
  end
211
211
 
@@ -216,7 +216,7 @@ module Twitch
216
216
  query = build_query_string(options)
217
217
  path = "/streams/followed"
218
218
  url = @base_url + path + query
219
-
219
+
220
220
  get(url)
221
221
  end
222
222
  alias :your_followed_streams :followed_streams
@@ -227,17 +227,17 @@ module Twitch
227
227
  query = build_query_string(options)
228
228
  path = "/games/top"
229
229
  url = @base_url + path + query
230
-
230
+
231
231
  get(url)
232
232
  end
233
233
 
234
234
  #Search
235
-
235
+
236
236
  def search_channels(options = {})
237
237
  query = build_query_string(options)
238
238
  path = "/search/channels"
239
239
  url = @base_url + path + query
240
-
240
+
241
241
  get(url)
242
242
  end
243
243
 
@@ -245,7 +245,7 @@ module Twitch
245
245
  query = build_query_string(options)
246
246
  path = "/search/streams"
247
247
  url = @base_url + path + query
248
-
248
+
249
249
  get(url)
250
250
  end
251
251
 
@@ -253,7 +253,7 @@ module Twitch
253
253
  query = build_query_string(options)
254
254
  path = "/search/games"
255
255
  url = @base_url + path + query
256
-
256
+
257
257
  get(url)
258
258
  end
259
259
 
@@ -263,14 +263,14 @@ module Twitch
263
263
  query = build_query_string(options)
264
264
  path = "/channels/#{channel}/videos"
265
265
  url = @base_url + path + query
266
-
266
+
267
267
  get(url)
268
268
  end
269
269
 
270
270
  def video(video_id)
271
271
  path = "/videos/#{video_id}/"
272
272
  url = @base_url + path
273
-
273
+
274
274
  get(url)
275
275
  end
276
276
 
@@ -279,10 +279,10 @@ module Twitch
279
279
  query = build_query_string(options)
280
280
  path = "/users/#{username}/subscriptions/#{channel}"
281
281
  url = @base_url + path + query
282
-
282
+
283
283
  get(url)
284
284
  end
285
-
285
+
286
286
  def followed_videos(options ={})
287
287
  return false unless @access_token
288
288
 
@@ -290,30 +290,30 @@ module Twitch
290
290
  query = build_query_string(options)
291
291
  path = "/videos/followed"
292
292
  url = @base_url + path + query
293
-
293
+
294
294
  get(url)
295
295
  end
296
296
  alias :your_followed_videos :followed_videos
297
-
297
+
298
298
  def top_videos(options = {})
299
299
  query = build_query_string(options)
300
300
  path = "/videos/top"
301
301
  url = @base_url + path + query
302
-
302
+
303
303
  get(url)
304
304
  end
305
-
305
+
306
306
  # Blocks
307
-
307
+
308
308
  def blocks(username, options = {})
309
309
  options[:oauth_token] = @access_token
310
310
  query = build_query_string(options)
311
311
  path = "/users/#{username}/blocks"
312
312
  url = @base_url + path + query
313
-
313
+
314
314
  get(url)
315
315
  end
316
-
316
+
317
317
  def block_user(username, target)
318
318
  return false unless @access_token
319
319
 
@@ -321,7 +321,7 @@ module Twitch
321
321
  url = @base_url + path
322
322
  put(url)
323
323
  end
324
-
324
+
325
325
  def unblock_user(username, target)
326
326
  return false unless @access_token
327
327
 
@@ -329,88 +329,90 @@ module Twitch
329
329
  url = @base_url + path
330
330
  delete(url)
331
331
  end
332
-
332
+
333
333
  # Chat
334
-
334
+
335
335
  def chat_links(channel)
336
336
  path = "/chat/"
337
337
  url = @base_url + path + channel;
338
-
338
+
339
339
  get(url)
340
340
  end
341
-
341
+
342
342
  def badges(channel)
343
343
  path = "/chat/#{channel}/badges"
344
344
  url = @base_url + path;
345
-
345
+
346
346
  get(url)
347
347
  end
348
-
348
+
349
349
  def emoticons()
350
350
  path = "/chat/emoticons"
351
351
  url = @base_url + path;
352
-
352
+
353
353
  get(url)
354
354
  end
355
-
355
+
356
356
  # Follows
357
-
357
+
358
358
  def following(channel)
359
359
  path = "/channels/#{channel}/follows"
360
360
  url = @base_url + path;
361
-
361
+
362
362
  get(url)
363
363
  end
364
-
364
+
365
365
  def followed(username)
366
366
  path = "/users/#{username}/follows/channels"
367
367
  url = @base_url + path;
368
-
368
+
369
369
  get(url)
370
370
  end
371
-
371
+
372
372
  def follow_status(username, channel)
373
373
  path = "/users/#{username}/follows/channels/#{channel}/?oauth_token=#{@access_token}"
374
374
  url = @base_url + path;
375
-
375
+
376
376
  get(url)
377
377
  end
378
-
378
+
379
379
  # Ingests
380
-
380
+
381
381
  def ingests()
382
382
  path = "/ingests"
383
383
  url = @base_url + path
384
-
384
+
385
385
  get(url)
386
386
  end
387
-
387
+
388
388
  # Root
389
-
389
+
390
390
  def root()
391
391
  path = "/?oauth_token=#{@access_token}"
392
392
  url = @base_url + path
393
-
393
+
394
394
  get(url)
395
395
  end
396
-
396
+
397
397
  # Subscriptions
398
-
399
- def subscribed(channel)
398
+
399
+ def subscribed(channel, options = {})
400
400
  return false unless @access_token
401
+ options[:oauth_token] = @access_token
402
+
403
+ query = build_query_string(options)
404
+ path = "/channels/#{channel}/subscriptions"
405
+ url = @base_url + path + query
401
406
 
402
- path = "/channels/#{channel}/subscriptions?oauth_token=#{@access_token}"
403
- url = @base_url + path
404
-
405
407
  get(url)
406
408
  end
407
-
409
+
408
410
  def subscribed_to_channel(username, channel)
409
411
  return false unless @access_token
410
412
 
411
413
  path = "/channels/#{channel}/subscriptions/#{username}?oauth_token=#{@access_token}"
412
414
  url = @base_url + path
413
-
415
+
414
416
  get(url)
415
417
  end
416
418
  end
@@ -3,7 +3,7 @@ module Twitch
3
3
  module VERSION
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].compact.join(".")
9
9
  end
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.1.1
4
+ version: 0.1.2
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-09-08 00:00:00.000000000 Z
11
+ date: 2015-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty