Class: Twitch::CheermoteTier

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

Overview

Data class for Cheermote Tier. Each tier identifies the range of Bits that you can cheer at that tier level and an image that graphically identifies the tier level.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CheermoteTier

Returns a new instance of CheermoteTier.



47
48
49
50
51
52
53
# File 'lib/twitch/cheermote_tier.rb', line 47

def initialize(attributes = {})
  attributes.each do |key, value|
    value = CheermoteTierImages.new(value) if key == 'images'

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

Instance Attribute Details

#can_cheerObject (readonly)

A Boolean value that determines whether users can cheer at this tier level.



41
42
43
# File 'lib/twitch/cheermote_tier.rb', line 41

def can_cheer
  @can_cheer
end

#colorObject (readonly)

The hex code of the color associated with this tier level (for example, ‘#979797`).



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

def color
  @color
end

#idObject (readonly)

The tier level. Possible tiers are:

  • 1

  • 100

  • 500

  • 1000

  • 5000

  • 10000

  • 100000



27
28
29
# File 'lib/twitch/cheermote_tier.rb', line 27

def id
  @id
end

#imagesObject (readonly)

The animated and static image sets for the Cheermote. The dictionary of images is organized by theme, format, and size. The theme keys are ‘dark` and `light`. Each theme is a dictionary of formats: `animated` and `static`. Each format is a dictionary of sizes: `1`, `1.5`, `2`, `3`, and `4`. The value of each size contains the URL to the image.



38
39
40
# File 'lib/twitch/cheermote_tier.rb', line 38

def images
  @images
end

#min_bitsObject (readonly)

The minimum number of Bits that you must cheer at this tier level. The maximum number of Bits that you can cheer at this level is determined by the required minimum Bits of the next tier level minus 1. For example, if ‘min_bits` is 1 and `min_bits` for the next tier is 100, the Bits range for this tier level is 1 through 99. The minimum Bits value of the last tier is the maximum number of Bits you can cheer using this Cheermote. For example, 10000.



17
18
19
# File 'lib/twitch/cheermote_tier.rb', line 17

def min_bits
  @min_bits
end

#show_in_bits_cardObject (readonly)

A Boolean value that determines whether this tier level is shown in the Bits card. Is ‘true` if this tier level is shown in the Bits card.



45
46
47
# File 'lib/twitch/cheermote_tier.rb', line 45

def show_in_bits_card
  @show_in_bits_card
end