Class: Cathodic::Chat
- Inherits:
-
Object
- Object
- Cathodic::Chat
- Defined in:
- lib/cathodic/chat.rb
Overview
The chat class represents the twitch.tv chat, you can fetch the embed code or the pop out chat code and links Author::Paul Forti License::MIT -embed : the url to the embed version of the chat -popout : the url used to pop out the chat -emoticons : the hash containing all the serialized emoticons (image url, regexp, etc) -popout_link : the html link used to pop out the chat
Instance Attribute Summary collapse
-
#embed ⇒ Object
Returns the value of attribute embed.
-
#emoticons ⇒ Object
Returns the value of attribute emoticons.
-
#popout ⇒ Object
Returns the value of attribute popout.
-
#popout_link ⇒ Object
Returns the value of attribute popout_link.
Instance Method Summary collapse
-
#fetch_emoticons ⇒ Object
This method fetchs the emoticons info about a stream’s chat.
-
#initialize(account_name) ⇒ Chat
constructor
The constructor needs to be given an account name, most likely the one retrieved from the stream’s url -account_name : the account name of the stream’s chat you want to get.
Constructor Details
#initialize(account_name) ⇒ Chat
The constructor needs to be given an account name, most likely the one retrieved from the stream’s url -account_name : the account name of the stream’s chat you want to get
14 15 16 17 |
# File 'lib/cathodic/chat.rb', line 14 def initialize(account_name) @account_name = account_name generate_links end |
Instance Attribute Details
#embed ⇒ Object
Returns the value of attribute embed.
10 11 12 |
# File 'lib/cathodic/chat.rb', line 10 def @embed end |
#emoticons ⇒ Object
Returns the value of attribute emoticons.
10 11 12 |
# File 'lib/cathodic/chat.rb', line 10 def emoticons @emoticons end |
#popout ⇒ Object
Returns the value of attribute popout.
10 11 12 |
# File 'lib/cathodic/chat.rb', line 10 def popout @popout end |
#popout_link ⇒ Object
Returns the value of attribute popout_link.
10 11 12 |
# File 'lib/cathodic/chat.rb', line 10 def popout_link @popout_link end |
Instance Method Details
#fetch_emoticons ⇒ Object
This method fetchs the emoticons info about a stream’s chat. It takes a lot of CPU, memory and the query is pretty big Don’t use it unless you REALLY need the emoticons
21 22 23 24 |
# File 'lib/cathodic/chat.rb', line 21 def fetch_emoticons query_point = "https://api.twitch.tv/kraken/chat/"+@account_name+"emoticons" @emoticons = open(query_point).read end |