twitch-api 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13fa554e6376acacd400d0aad2e651d295c613297df4476ba7c1736b6e7640aa
4
- data.tar.gz: 6e180eab8e7061535821922cbc6ad4c4b35e867096314a7ddf564704ea32882c
3
+ metadata.gz: a0d26f1ad1f75eb33986d6ffeee5df987d9d1f9a5a6806bdca9a8b1adfd0e127
4
+ data.tar.gz: 453ec71c27d902598bdb86e4365b18eede4e4b817d51fd9ab9a1f6229eda0513
5
5
  SHA512:
6
- metadata.gz: 7b45c4f07f653c77e3058579dac055efbcb2b1664fe1c68f63caf3715bfd8471a318bacc2d6ec49f072d0fee7686b7d72313c939e26c0e8a8bbd888137611e1a
7
- data.tar.gz: c29bf47c2020a2b2617d1f6a54b7fda59b0544c165c5787fcbba92963dc11eeaeee2149640e8bbcaa86a4b1eca7551050d82d40ca1d6657543c8647f511f4a40
6
+ metadata.gz: 8f9077115a63b251d9d8762bcf1f036697417c93b0ecf2d2002aea9f41b6bb92daa6f1a692a14e938549b70c669cd84da2b2a39dcaa50002e812d6547bde4c4c
7
+ data.tar.gz: 814370a51c612759743b24b12e51de46a26e3b080bafb5ff00e2a50293e69e6a4a941d9e61ad648f8143cf0e7577fa8c3c1626ea56bedc66e6b21568caa177d8
@@ -1,9 +1,9 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.7
5
- - 2.4.4
6
- - 2.5.1
4
+ - 2.3.8
5
+ - 2.4.5
6
+ - 2.5.3
7
7
  env:
8
8
  - TWITCH_CLIENT_ID=test
9
9
  before_install: gem install bundler -v 1.16.0
@@ -3,6 +3,8 @@ module Twitch
3
3
  class BitsLeader
4
4
  # ID of the user giving bits.
5
5
  attr_reader :user_id
6
+ # Display name of the user giving bits.
7
+ attr_reader :user_name
6
8
  # Ranking of the user giving bits.
7
9
  # Reflects the parent object's date range.
8
10
  attr_reader :rank
@@ -11,6 +13,7 @@ module Twitch
11
13
 
12
14
  def initialize(attributes = {})
13
15
  @user_id = attributes['user_id']
16
+ @user_name = attributes['user_name']
14
17
  @rank = attributes['rank']
15
18
  @score = attributes['score']
16
19
  end
@@ -9,6 +9,7 @@ require "twitch/entitlement_grant_url"
9
9
  require "twitch/game"
10
10
  require "twitch/game_analytic"
11
11
  require "twitch/stream"
12
+ require "twitch/stream_marker"
12
13
  require "twitch/stream_metadata"
13
14
  require "twitch/user"
14
15
  require "twitch/user_follow"
@@ -65,6 +66,10 @@ Unpredictable behavior may follow.})
65
66
  Response.new(EntitlementGrantUrl, post('entitlements/upload', options))
66
67
  end
67
68
 
69
+ def create_stream_marker(options = {})
70
+ Response.new(StreamMarker, post('streams/markers', options))
71
+ end
72
+
68
73
  def get_clips(options = {})
69
74
  Response.new(Clip, get('clips', options))
70
75
  end
@@ -85,6 +90,10 @@ Unpredictable behavior may follow.})
85
90
  Response.new(GameAnalytic, get('analytics/games', options))
86
91
  end
87
92
 
93
+ def get_stream_markers(options = {})
94
+ Response.new(StreamMarkerResponse, get('streams/markers', options))
95
+ end
96
+
88
97
  def get_streams(options = {})
89
98
  Response.new(Stream, get('streams', options))
90
99
  end
@@ -20,10 +20,14 @@ module Twitch
20
20
  attr_reader :view_count
21
21
  # Language of the originating broadcast.
22
22
  attr_reader :language
23
- # (User) ID of the clip's source broadcast.
23
+ # (User) ID of the clip's source broadcaster.
24
24
  attr_reader :broadcaster_id
25
+ # (User) name of the clip's source broadcaster
26
+ attr_reader :broadcaster_name
25
27
  # (User) ID of the clip's creator.
26
28
  attr_reader :creator_id
29
+ # (User) name of the clip's creator.
30
+ attr_reader :creator_name
27
31
  # ID of the game being played.
28
32
  attr_reader :game_id
29
33
  # ID of the archived broadcast (may not be available).
@@ -5,11 +5,13 @@ module Twitch
5
5
  class Stream
6
6
  # Fields to be converted from ISO 8601 string to a typed date.
7
7
  DATE_ATTRIBUTES = [:started_at]
8
-
8
+
9
9
  # ID of the stream.
10
10
  attr_reader :id
11
11
  # ID of the user broadcasting.
12
12
  attr_reader :user_id
13
+ # Username of the user broadcasting.
14
+ attr_reader :user_name
13
15
  # ID of the game being broadcast.
14
16
  attr_reader :game_id
15
17
  # Associated community IDs for the broadcaster.
@@ -39,4 +41,4 @@ module Twitch
39
41
  end
40
42
  end
41
43
  end
42
- end
44
+ end
@@ -0,0 +1,48 @@
1
+ module Twitch
2
+ # A point of time in a stream VOD that was marked while it is live.
3
+ class StreamMarker
4
+ # ID of the stream marker.
5
+ attr_reader :id
6
+ # Date at which the stream marker was created.
7
+ attr_reader :created_at
8
+ # Description of the stream marker.
9
+ attr_reader :description
10
+ # Elapsed time in the VOD in seconds at which the stream marker was created.
11
+ attr_reader :position_seconds
12
+ # URL pointing to the video and timestamp of the stream marker.
13
+ # Not returned upon creation.
14
+ attr_reader :url
15
+
16
+ def initialize(attributes = {})
17
+ @id = attributes['id']
18
+ @created_at = Time.parse(attributes['created_at'])
19
+ @description = attributes['description']
20
+ @position_seconds = attributes['position_seconds']
21
+ @url = attributes['URL']
22
+ end
23
+ end
24
+
25
+ # The response envelope for the "Get Stream Markers" endpoint.
26
+ class StreamMarkerResponse
27
+ attr_reader :user_id
28
+ attr_reader :user_name
29
+ attr_reader :videos
30
+
31
+ def initialize(attributes = {})
32
+ @user_id = attributes['user_id']
33
+ @user_name = attributes['user_name']
34
+ @videos = attributes['videos'].map { |v| VideoStreamMarkers.new(v) }
35
+ end
36
+ end
37
+
38
+ # A video with a list of markers.
39
+ class VideoStreamMarkers
40
+ attr_reader :video_id
41
+ attr_reader :markers
42
+
43
+ def initialize(attributes = {})
44
+ @video_id = attributes['video_id']
45
+ @markers = attributes['markers'].map{ |m| StreamMarker.new(m) }
46
+ end
47
+ end
48
+ end
@@ -9,11 +9,14 @@ module Twitch
9
9
  class StreamMetadata
10
10
  # ID of the streaming user.
11
11
  attr_reader :user_id
12
+ # Display name of the streaming user.
13
+ attr_reader :user_name
12
14
  # ID of the game being playead.
13
15
  attr_reader :game_id
14
16
 
15
17
  def initialize(attributes = {})
16
18
  @user_id = attributes['user_id']
19
+ @user_name = attributes['user_name']
17
20
  @game_id = attributes['game_id']
18
21
 
19
22
  # Since more games can be supported in the future,
@@ -3,14 +3,20 @@ module Twitch
3
3
  class UserFollow
4
4
  # User ID of the *following* user.
5
5
  attr_reader :from_id
6
+ # Display name of the *following* user.
7
+ attr_reader :from_name
6
8
  # User ID of the *followed* user.
7
9
  attr_reader :to_id
10
+ # User name of the *followed* user.
11
+ attr_reader :to_name
8
12
  # Date at which the follow action was performed.
9
13
  attr_reader :followed_at
10
14
 
11
15
  def initialize(attributes = {})
12
16
  @from_id = attributes['from_id']
17
+ @from_name = attributes['from_name']
13
18
  @to_id = attributes['to_id']
19
+ @to_name = attributes['to_name']
14
20
  @followed_at = Time.iso8601(attributes['followed_at'])
15
21
  end
16
22
  end
@@ -1,4 +1,4 @@
1
1
  module Twitch
2
2
  # Library version.
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
@@ -27,6 +27,8 @@ module Twitch
27
27
  attr_reader :url
28
28
  # ID of the user who uploaded/broadcasted the video.
29
29
  attr_reader :user_id
30
+ # Display name of the user who uploaded/broadcasted the video.
31
+ attr_reader :user_name
30
32
  # Viewability of the video (public or private)
31
33
  attr_reader :viewable
32
34
  # Duration of the video, in the format
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitch-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maurice Wahba
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-17 00:00:00.000000000 Z
11
+ date: 2019-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -134,6 +134,7 @@ files:
134
134
  - lib/twitch/game_analytic.rb
135
135
  - lib/twitch/response.rb
136
136
  - lib/twitch/stream.rb
137
+ - lib/twitch/stream_marker.rb
137
138
  - lib/twitch/stream_metadata.rb
138
139
  - lib/twitch/user.rb
139
140
  - lib/twitch/user_follow.rb
@@ -160,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
161
  version: '0'
161
162
  requirements: []
162
163
  rubyforge_project:
163
- rubygems_version: 2.7.1
164
+ rubygems_version: 2.7.7
164
165
  signing_key:
165
166
  specification_version: 4
166
167
  summary: Ruby client for the Twitch Helix API.