twitchrb 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.env.example +3 -0
  3. data/.github/FUNDING.yml +4 -0
  4. data/.gitignore +1 -0
  5. data/Gemfile +1 -0
  6. data/Gemfile.lock +28 -9
  7. data/README.md +46 -6
  8. data/bin/console +5 -0
  9. data/lib/twitch/client.rb +131 -75
  10. data/lib/twitch/collection.rb +21 -0
  11. data/lib/twitch/error.rb +4 -0
  12. data/lib/twitch/object.rb +19 -0
  13. data/lib/twitch/objects/badge.rb +4 -0
  14. data/lib/twitch/objects/banned_event.rb +4 -0
  15. data/lib/twitch/objects/banned_user.rb +4 -0
  16. data/lib/twitch/objects/blocked_user.rb +4 -0
  17. data/lib/twitch/objects/channel.rb +4 -0
  18. data/lib/twitch/objects/channel_editor.rb +4 -0
  19. data/lib/twitch/objects/clip.rb +4 -0
  20. data/lib/twitch/objects/custom_reward.rb +4 -0
  21. data/lib/twitch/objects/custom_reward_redemption.rb +4 -0
  22. data/lib/twitch/objects/emote.rb +4 -0
  23. data/lib/twitch/objects/event_sub_subscription.rb +4 -0
  24. data/lib/twitch/objects/followed_user.rb +4 -0
  25. data/lib/twitch/objects/game.rb +4 -0
  26. data/lib/twitch/objects/goal.rb +4 -0
  27. data/lib/twitch/objects/hype_train_event.rb +4 -0
  28. data/lib/twitch/objects/moderator.rb +4 -0
  29. data/lib/twitch/objects/moderator_event.rb +4 -0
  30. data/lib/twitch/objects/poll.rb +4 -0
  31. data/lib/twitch/objects/prediction.rb +4 -0
  32. data/lib/twitch/objects/search_result.rb +4 -0
  33. data/lib/twitch/objects/stream.rb +4 -0
  34. data/lib/twitch/objects/stream_marker.rb +4 -0
  35. data/lib/twitch/objects/stream_schedule.rb +4 -0
  36. data/lib/twitch/objects/subscription.rb +4 -0
  37. data/lib/twitch/objects/subscription_count.rb +4 -0
  38. data/lib/twitch/objects/tag.rb +4 -0
  39. data/lib/twitch/objects/user.rb +4 -0
  40. data/lib/twitch/objects/video.rb +4 -0
  41. data/lib/twitch/resource.rb +57 -0
  42. data/lib/twitch/resources/badges.rb +15 -0
  43. data/lib/twitch/resources/banned_events.rb +10 -0
  44. data/lib/twitch/resources/banned_users.rb +11 -0
  45. data/lib/twitch/resources/channels.rb +20 -0
  46. data/lib/twitch/resources/clips.rb +19 -0
  47. data/lib/twitch/resources/custom_reward_redemptions.rb +22 -0
  48. data/lib/twitch/resources/custom_rewards.rb +30 -0
  49. data/lib/twitch/resources/emotes.rb +20 -0
  50. data/lib/twitch/resources/event_sub_subscriptions.rb +21 -0
  51. data/lib/twitch/resources/games.rb +20 -0
  52. data/lib/twitch/resources/goals.rb +12 -0
  53. data/lib/twitch/resources/hype_train_events.rb +12 -0
  54. data/lib/twitch/resources/moderator_events.rb +11 -0
  55. data/lib/twitch/resources/moderators.rb +11 -0
  56. data/lib/twitch/resources/polls.rb +27 -0
  57. data/lib/twitch/resources/predictions.rb +32 -0
  58. data/lib/twitch/resources/search.rb +17 -0
  59. data/lib/twitch/resources/stream_markers.rb +19 -0
  60. data/lib/twitch/resources/stream_schedule.rb +47 -0
  61. data/lib/twitch/resources/streams.rb +19 -0
  62. data/lib/twitch/resources/subscriptions.rb +73 -0
  63. data/lib/twitch/resources/tags.rb +20 -0
  64. data/lib/twitch/resources/users.rb +54 -0
  65. data/lib/twitch/resources/videos.rb +17 -0
  66. data/lib/twitch/version.rb +1 -1
  67. data/lib/twitch.rb +80 -32
  68. data/twitchrb.gemspec +3 -2
  69. metadata +79 -16
  70. data/lib/twitch/badges.rb +0 -39
  71. data/lib/twitch/channels.rb +0 -25
  72. data/lib/twitch/emotes.rb +0 -58
  73. data/lib/twitch/games.rb +0 -49
  74. data/lib/twitch/initializable.rb +0 -16
  75. data/lib/twitch/kraken/channels.rb +0 -22
  76. data/lib/twitch/kraken/clips.rb +0 -22
  77. data/lib/twitch/kraken/user.rb +0 -23
  78. data/lib/twitch/kraken/users.rb +0 -33
data/lib/twitch.rb CHANGED
@@ -1,43 +1,91 @@
1
- require "time"
2
- require "httparty"
1
+ require "faraday"
2
+ require "faraday_middleware"
3
3
  require "json"
4
+ require "twitch/version"
4
5
 
5
6
  require "twitch/version"
6
7
 
7
- require "twitch/client"
8
- require "twitch/initializable"
8
+ # require "twitch/client"
9
+ # require "twitch/initializable"
9
10
 
10
- # Helix API
11
- require "twitch/channels"
12
- require "twitch/emotes"
13
- require "twitch/badges"
14
- require "twitch/games"
11
+ # # Models
12
+ # require "twitch/models/channel"
13
+ # require "twitch/models/badge"
14
+ # require "twitch/models/game"
15
+ # require "twitch/models/emote"
16
+ # require "twitch/models/poll"
17
+ # require "twitch/models/poll_choice"
15
18
 
16
- # Kraken (v5) API
17
- require "twitch/kraken/user"
18
- require "twitch/kraken/users"
19
- require "twitch/kraken/channels"
20
- require "twitch/kraken/clips"
19
+ # # Helix API
20
+ # require "twitch/channels"
21
+ # require "twitch/emotes"
22
+ # require "twitch/badges"
23
+ # require "twitch/games"
24
+ # require "twitch/polls"
21
25
 
22
26
  module Twitch
23
27
 
24
- class << self
25
- attr_reader :client
26
-
27
- def access_details(client_id, access_token=nil)
28
- @client = Client.new(client_id, access_token)
29
- # @client.access_token = access_token if access_token
30
- end
31
- end
32
-
33
- # Error classes to raise
34
- class Error < StandardError; end
35
- module Errors
36
- class ServiceUnavailable < Error; end
37
- class AccessDenied < Error; end
38
- class NotFound < Error; end
39
- class CommunicationError < Error; end
40
- class ValidationError < Error; end
41
- end
28
+ autoload :Client, "twitch/client"
29
+ autoload :Collection, "twitch/collection"
30
+ autoload :Error, "twitch/error"
31
+ autoload :Resource, "twitch/resource"
32
+ autoload :Object, "twitch/object"
33
+
34
+
35
+ autoload :UsersResource, "twitch/resources/users"
36
+ autoload :ChannelsResource, "twitch/resources/channels"
37
+ autoload :EmotesResource, "twitch/resources/emotes"
38
+ autoload :BadgesResource, "twitch/resources/badges"
39
+ autoload :GamesResource, "twitch/resources/games"
40
+ autoload :VideosResource, "twitch/resources/videos"
41
+ autoload :ClipsResource, "twitch/resources/clips"
42
+ autoload :EventSubSubscriptionsResource, "twitch/resources/event_sub_subscriptions"
43
+ autoload :BannedEventsResource, "twitch/resources/banned_events"
44
+ autoload :BannedUsersResource, "twitch/resources/banned_users"
45
+ autoload :ModeratorsResource, "twitch/resources/moderators"
46
+ autoload :ModeratorEventsResource, "twitch/resources/moderator_events"
47
+ autoload :PollsResource, "twitch/resources/polls"
48
+ autoload :PredictionsResource, "twitch/resources/predictions"
49
+ autoload :StreamScheduleResource, "twitch/resources/stream_schedule"
50
+ autoload :SearchResource, "twitch/resources/search"
51
+ autoload :StreamsResource, "twitch/resources/streams"
52
+ autoload :StreamMarkersResource, "twitch/resources/stream_markers"
53
+ autoload :SubscriptionsResource, "twitch/resources/subscriptions"
54
+ autoload :TagsResource, "twitch/resources/tags"
55
+ autoload :CustomRewardsResource, "twitch/resources/custom_rewards"
56
+ autoload :CustomRewardRedemptionsResource, "twitch/resources/custom_reward_redemptions"
57
+ autoload :GoalsResource, "twitch/resources/goals"
58
+ autoload :HypeTrainEventsResource, "twitch/resources/hype_train_events"
59
+
60
+
61
+ autoload :User, "twitch/objects/user"
62
+ autoload :FollowedUser, "twitch/objects/followed_user"
63
+ autoload :BlockedUser, "twitch/objects/blocked_user"
64
+
65
+ autoload :Channel, "twitch/objects/channel"
66
+ autoload :ChannelEditor, "twitch/objects/channel_editor"
67
+ autoload :Emote, "twitch/objects/emote"
68
+ autoload :Badge, "twitch/objects/badge"
69
+ autoload :Game, "twitch/objects/game"
70
+ autoload :Video, "twitch/objects/video"
71
+ autoload :Clip, "twitch/objects/clip"
72
+ autoload :EventSubSubscription, "twitch/objects/event_sub_subscription"
73
+ autoload :BannedEvent, "twitch/objects/banned_event"
74
+ autoload :BannedUser, "twitch/objects/banned_user"
75
+ autoload :Moderator, "twitch/objects/moderator"
76
+ autoload :ModeratorEvent, "twitch/objects/moderator_event"
77
+ autoload :Poll, "twitch/objects/poll"
78
+ autoload :Prediction, "twitch/objects/prediction"
79
+ autoload :StreamSchedule, "twitch/objects/stream_schedule"
80
+ autoload :SearchResult, "twitch/objects/search_result"
81
+ autoload :Stream, "twitch/objects/stream"
82
+ autoload :StreamMarker, "twitch/objects/stream_marker"
83
+ autoload :Subscription, "twitch/objects/subscription"
84
+ autoload :SubscriptionCount, "twitch/objects/subscription_count"
85
+ autoload :Tag, "twitch/objects/tag"
86
+ autoload :CustomReward, "twitch/objects/custom_reward"
87
+ autoload :CustomRewardRedemption, "twitch/objects/custom_reward_redemption"
88
+ autoload :Goal, "twitch/objects/goal"
89
+ autoload :HypeTrainEvent, "twitch/objects/hype_train_event"
42
90
 
43
91
  end
data/twitchrb.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Dean Perry"]
7
7
  spec.email = ["dean@deanpcmad.com"]
8
8
 
9
- spec.summary = "A Ruby library for interacting with the Twitch API"
9
+ spec.summary = "A Ruby library for interacting with the Twitch Helix API"
10
10
  spec.homepage = "https://twitchrb.com"
11
11
  spec.license = "MIT"
12
12
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_runtime_dependency "httparty", "~> 0.18.1"
27
+ spec.add_dependency "faraday", "~> 1.7"
28
+ spec.add_dependency "faraday_middleware", "~> 1.1"
28
29
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitchrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-20 00:00:00.000000000 Z
11
+ date: 2021-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: httparty
14
+ name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.18.1
19
+ version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.18.1
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
27
41
  description:
28
42
  email:
29
43
  - dean@deanpcmad.com
@@ -31,6 +45,8 @@ executables: []
31
45
  extensions: []
32
46
  extra_rdoc_files: []
33
47
  files:
48
+ - ".env.example"
49
+ - ".github/FUNDING.yml"
34
50
  - ".gitignore"
35
51
  - ".travis.yml"
36
52
  - Gemfile
@@ -41,16 +57,63 @@ files:
41
57
  - bin/console
42
58
  - bin/setup
43
59
  - lib/twitch.rb
44
- - lib/twitch/badges.rb
45
- - lib/twitch/channels.rb
46
60
  - lib/twitch/client.rb
47
- - lib/twitch/emotes.rb
48
- - lib/twitch/games.rb
49
- - lib/twitch/initializable.rb
50
- - lib/twitch/kraken/channels.rb
51
- - lib/twitch/kraken/clips.rb
52
- - lib/twitch/kraken/user.rb
53
- - lib/twitch/kraken/users.rb
61
+ - lib/twitch/collection.rb
62
+ - lib/twitch/error.rb
63
+ - lib/twitch/object.rb
64
+ - lib/twitch/objects/badge.rb
65
+ - lib/twitch/objects/banned_event.rb
66
+ - lib/twitch/objects/banned_user.rb
67
+ - lib/twitch/objects/blocked_user.rb
68
+ - lib/twitch/objects/channel.rb
69
+ - lib/twitch/objects/channel_editor.rb
70
+ - lib/twitch/objects/clip.rb
71
+ - lib/twitch/objects/custom_reward.rb
72
+ - lib/twitch/objects/custom_reward_redemption.rb
73
+ - lib/twitch/objects/emote.rb
74
+ - lib/twitch/objects/event_sub_subscription.rb
75
+ - lib/twitch/objects/followed_user.rb
76
+ - lib/twitch/objects/game.rb
77
+ - lib/twitch/objects/goal.rb
78
+ - lib/twitch/objects/hype_train_event.rb
79
+ - lib/twitch/objects/moderator.rb
80
+ - lib/twitch/objects/moderator_event.rb
81
+ - lib/twitch/objects/poll.rb
82
+ - lib/twitch/objects/prediction.rb
83
+ - lib/twitch/objects/search_result.rb
84
+ - lib/twitch/objects/stream.rb
85
+ - lib/twitch/objects/stream_marker.rb
86
+ - lib/twitch/objects/stream_schedule.rb
87
+ - lib/twitch/objects/subscription.rb
88
+ - lib/twitch/objects/subscription_count.rb
89
+ - lib/twitch/objects/tag.rb
90
+ - lib/twitch/objects/user.rb
91
+ - lib/twitch/objects/video.rb
92
+ - lib/twitch/resource.rb
93
+ - lib/twitch/resources/badges.rb
94
+ - lib/twitch/resources/banned_events.rb
95
+ - lib/twitch/resources/banned_users.rb
96
+ - lib/twitch/resources/channels.rb
97
+ - lib/twitch/resources/clips.rb
98
+ - lib/twitch/resources/custom_reward_redemptions.rb
99
+ - lib/twitch/resources/custom_rewards.rb
100
+ - lib/twitch/resources/emotes.rb
101
+ - lib/twitch/resources/event_sub_subscriptions.rb
102
+ - lib/twitch/resources/games.rb
103
+ - lib/twitch/resources/goals.rb
104
+ - lib/twitch/resources/hype_train_events.rb
105
+ - lib/twitch/resources/moderator_events.rb
106
+ - lib/twitch/resources/moderators.rb
107
+ - lib/twitch/resources/polls.rb
108
+ - lib/twitch/resources/predictions.rb
109
+ - lib/twitch/resources/search.rb
110
+ - lib/twitch/resources/stream_markers.rb
111
+ - lib/twitch/resources/stream_schedule.rb
112
+ - lib/twitch/resources/streams.rb
113
+ - lib/twitch/resources/subscriptions.rb
114
+ - lib/twitch/resources/tags.rb
115
+ - lib/twitch/resources/users.rb
116
+ - lib/twitch/resources/videos.rb
54
117
  - lib/twitch/version.rb
55
118
  - twitchrb.gemspec
56
119
  homepage: https://twitchrb.com
@@ -74,8 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
137
  - !ruby/object:Gem::Version
75
138
  version: '0'
76
139
  requirements: []
77
- rubygems_version: 3.1.4
140
+ rubygems_version: 3.1.6
78
141
  signing_key:
79
142
  specification_version: 4
80
- summary: A Ruby library for interacting with the Twitch API
143
+ summary: A Ruby library for interacting with the Twitch Helix API
81
144
  test_files: []
data/lib/twitch/badges.rb DELETED
@@ -1,39 +0,0 @@
1
- module Twitch
2
- class Badges
3
-
4
- include Initializable
5
-
6
- attr_accessor :id, :image_url_1x, :image_url_2x, :image_url_4x
7
-
8
- class << self
9
-
10
- # Gets Badges for a channel ID
11
- def get_channel(id)
12
- response = Twitch.client.get(:helix, "chat/badges?broadcaster_id=#{id}")
13
-
14
- badge_array(response["data"])
15
- end
16
-
17
- # Gets Global Badges
18
- def get_global
19
- response = Twitch.client.get(:helix, "chat/badges/global")
20
-
21
- badge_array(response["data"])
22
- end
23
-
24
- private
25
-
26
- def badge_array(data)
27
- badges = []
28
-
29
- data.each do |e|
30
- badges << {set_id: e["set_id"], versions: e["versions"].map {|v| new(v)} }
31
- end
32
-
33
- badges
34
- end
35
-
36
- end
37
-
38
- end
39
- end
@@ -1,25 +0,0 @@
1
- module Twitch
2
- class Channels
3
-
4
- include Initializable
5
-
6
- attr_accessor :broadcaster_id, :broadcaster_name, :game_name, :game_id, :broadcaster_language, :title, :delay
7
-
8
- class << self
9
-
10
- # Gets a specified channel object
11
- def get(id)
12
- response = Twitch.client.get(:helix, "channels?broadcaster_id=#{id}")
13
-
14
- new(response["data"][0])
15
- end
16
-
17
- # Update a channel
18
- def update(id, params={})
19
- Twitch.client.patch(:helix, "channels?broadcaster_id=#{id}", params)
20
- end
21
-
22
- end
23
-
24
- end
25
- end
data/lib/twitch/emotes.rb DELETED
@@ -1,58 +0,0 @@
1
- module Twitch
2
- class Emotes
3
-
4
- include Initializable
5
-
6
- attr_accessor :id, :name, :images, :tier, :emote_type, :emote_set_id, :owner_id
7
-
8
- def url_1x
9
- images["url_1x"]
10
- end
11
-
12
- def url_2x
13
- images["url_2x"]
14
- end
15
-
16
- def url_4x
17
- images["url_4x"]
18
- end
19
-
20
- class << self
21
-
22
- # Gets Emotes for a channel ID
23
- def get_channel(id)
24
- response = Twitch.client.get(:helix, "chat/emotes?broadcaster_id=#{id}")
25
-
26
- emote_array(response["data"])
27
- end
28
-
29
- # Gets Global Emotes
30
- def get_global
31
- response = Twitch.client.get(:helix, "chat/emotes/global")
32
-
33
- emote_array(response["data"])
34
- end
35
-
36
- # Gets Emotes for an Emote Set ID
37
- def get_emote_set(id)
38
- response = Twitch.client.get(:helix, "chat/emotes/set?emote_set_id=#{id}")
39
-
40
- emote_array(response["data"])
41
- end
42
-
43
- private
44
-
45
- def emote_array(data)
46
- emotes = []
47
-
48
- data.each do |e|
49
- emotes << new(e)
50
- end
51
-
52
- emotes
53
- end
54
-
55
- end
56
-
57
- end
58
- end
data/lib/twitch/games.rb DELETED
@@ -1,49 +0,0 @@
1
- module Twitch
2
- class Games
3
-
4
- include Initializable
5
-
6
- attr_accessor :id, :name, :box_art_url
7
-
8
- def box_art_380
9
- box_art_url.gsub("{width}", "285").gsub("{height}", "380")
10
- end
11
-
12
- class << self
13
-
14
- # Gets Badges for a channel ID
15
- def get_by_name(name)
16
- response = Twitch.client.get(:helix, "games?name=#{name}")
17
-
18
- new(response["data"][0])
19
- end
20
-
21
- def get_by_id(id)
22
- response = Twitch.client.get(:helix, "games?id=#{id}")
23
-
24
- new(response["data"][0])
25
- end
26
-
27
- # Gets Top Games
28
- def get_top
29
- response = Twitch.client.get(:helix, "games/top")
30
-
31
- game_array(response["data"])
32
- end
33
-
34
- private
35
-
36
- def game_array(data)
37
- games = []
38
-
39
- data.each do |g|
40
- games << new(g)
41
- end
42
-
43
- games
44
- end
45
-
46
- end
47
-
48
- end
49
- end
@@ -1,16 +0,0 @@
1
- module Twitch
2
- module Initializable
3
-
4
- def initialize(params = {})
5
- params.each do |key, value|
6
- if key == "_id"
7
- key = "id"
8
- end
9
-
10
- setter = "#{key}="
11
- send(setter, value) if respond_to?(setter.to_sym, false)
12
- end
13
-
14
- end
15
- end
16
- end
@@ -1,22 +0,0 @@
1
- module Twitch
2
- module Kraken
3
- class Channels
4
-
5
- include Initializable
6
-
7
- attr_accessor :id, :name, :display_name, :broadcaster_language, :followers, :game, :language, :logo, :mature, :partner, :profile_banner, :profile_banner_background_colour, :status, :url, :video_banner, :views, :created_at, :updated_at
8
-
9
- class << self
10
-
11
- # Gets a specified channel object
12
- def get_channel_by_id(id)
13
- response = Twitch.client.get(:kraken, "channels/#{id}")
14
-
15
- new(response)
16
- end
17
-
18
- end
19
-
20
- end
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- module Twitch
2
- module Kraken
3
- class Clips
4
-
5
- include Initializable
6
-
7
- attr_accessor :id, :title, :slug, :url, :embed_url, :game, :views, :duration, :language, :broadcaster, :curator, :vod, :created_at, :updated_at
8
-
9
- class << self
10
-
11
- # Gets details about a specified clip
12
- def get(slug)
13
- response = Twitch.client.get(:kraken, "clips/#{slug}")
14
-
15
- new(response)
16
- end
17
-
18
- end
19
-
20
- end
21
- end
22
- end
@@ -1,23 +0,0 @@
1
- module Twitch
2
- module Kraken
3
- class User
4
-
5
- include Initializable
6
-
7
- attr_accessor :id, :name, :display_name, :email, :email_verified, :partnered, :type, :bio, :logo, :created_at, :updated_at
8
-
9
- class << self
10
-
11
- # Gets a user object based on the OAuth token provided
12
- # Scopes required: user_read
13
- def get
14
- response = Twitch.client.get("user")
15
-
16
- new(response)
17
- end
18
-
19
- end
20
-
21
- end
22
- end
23
- end
@@ -1,33 +0,0 @@
1
- module Twitch
2
- module Kraken
3
- class Users
4
-
5
- include Initializable
6
-
7
- attr_accessor :id, :name, :display_name, :type, :bio, :logo, :created_at, :updated_at
8
-
9
- class << self
10
-
11
- # Gets a specified user object
12
- def get_user_by_id(id)
13
- response = Twitch.client.get(:kraken, "users/#{id}")
14
-
15
- new(response)
16
- end
17
-
18
- # Gets the user objects for the specified Twitch login names
19
- def get_users(username)
20
- response = Twitch.client.get(:kraken, "users?login=#{username}")
21
-
22
- if response["users"].count >= 1
23
- new(response["users"].first)
24
- else
25
- raise Twitch::Errors::NotFound
26
- end
27
- end
28
-
29
- end
30
-
31
- end
32
- end
33
- end