Class: Twitch::Cheermote

Inherits:
Object
  • Object
show all
Defined in:
lib/twitch/cheermote.rb

Overview

Data class for Cheermotes, animated emotes that viewers can assign Bits to.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Cheermote

Returns a new instance of Cheermote.



45
46
47
48
49
50
51
# File 'lib/twitch/cheermote.rb', line 45

def initialize(attributes = {})
  attributes.each do |key, value|
    value = value.map { |tier| CheermoteTier.new(tier) } if key == 'tiers'

    instance_variable_set "@#{key}", value
  end
end

Instance Attribute Details

#is_charitableObject (readonly)

A Boolean value that indicates whether this Cheermote provides a charitable contribution match during charity campaigns.



43
44
45
# File 'lib/twitch/cheermote.rb', line 43

def is_charitable
  @is_charitable
end

#last_updatedObject (readonly)

The date and time when this Cheermote was last updated.



39
40
41
# File 'lib/twitch/cheermote.rb', line 39

def last_updated
  @last_updated
end

#orderObject (readonly)

The order that the Cheermotes are shown in the Bits card. The numbers may not be consecutive. For example, the numbers may jump from 1 to 7 to 13. The order numbers are unique within a Cheermote type (for example, global_first_party) but may not be unique amongst all Cheermotes in the response.



36
37
38
# File 'lib/twitch/cheermote.rb', line 36

def order
  @order
end

#prefixObject (readonly)

The name portion of the Cheermote string that you use in chat to cheer Bits. The full Cheermote string is the concatenation of #prefix + of Bits. For example, if the prefix is “Cheer” and you want to cheer 100 Bits, the full Cheermote string is Cheer100. When the Cheermote string is entered in chat, Twitch converts it to the image associated with the Bits tier that was cheered.



14
15
16
# File 'lib/twitch/cheermote.rb', line 14

def prefix
  @prefix
end

#tiersObject (readonly)

A list of tier levels that the Cheermote supports. Each tier identifies the range of Bits that you can cheer at that tier level and an image that graphically identifies the tier level.



19
20
21
# File 'lib/twitch/cheermote.rb', line 19

def tiers
  @tiers
end

#typeObject (readonly)

The type of Cheermote. Possible values are:

  • global_first_party — A Twitch-defined Cheermote that is shown in the Bits card.

  • global_third_party — A Twitch-defined Cheermote that is not shown in the Bits card.

  • channel_custom — A broadcaster-defined Cheermote.

  • display_only — Do not use; for internal use only.

  • sponsored — A sponsor-defined Cheermote. When used, the sponsor adds additional Bits to the amount that the user cheered. For example, if the user cheered Terminator100, the broadcaster might receive 110 Bits, which includes the sponsor’s 10 Bits contribution.



30
31
32
# File 'lib/twitch/cheermote.rb', line 30

def type
  @type
end