Class: Turntabler::Sticker

Inherits:
Resource show all
Defined in:
lib/turntabler/sticker.rb

Overview

Represents a virtual sticker that can be placed on a user

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#==, attribute, #attributes=, #hash, #initialize, #load, #loaded?, #pretty_print, #pretty_print_instance_variables

Methods included from Assertions

#assert_valid_keys, #assert_valid_values

Methods included from DigestHelpers

#digest

Constructor Details

This class inherits a constructor from Turntabler::Resource

Instance Attribute Details

#categoryString (readonly)

The type of sticker (such as “laptop_sticker”)

Returns:

  • (String)


20
# File 'lib/turntabler/sticker.rb', line 20

attribute :category

#descriptionString (readonly)

A longer explanation for the sticker

Returns:

  • (String)


16
# File 'lib/turntabler/sticker.rb', line 16

attribute :description

#idString (readonly)

Allow the id to be set via the “sticker_id” attribute

Returns:

  • (String)


8
# File 'lib/turntabler/sticker.rb', line 8

attribute :id, :sticker_id

#nameString (readonly)

The human-readable name for the sticker

Returns:

  • (String)


12
# File 'lib/turntabler/sticker.rb', line 12

attribute :name

#pathString (readonly)

The uri for the sticker

Returns:

  • (String)


32
# File 'lib/turntabler/sticker.rb', line 32

attribute :path

#priceFixnum (readonly)

The cost to purchase this sticker for use

Returns:

  • (Fixnum)


24
# File 'lib/turntabler/sticker.rb', line 24

attribute :price

#stateString (readonly)

Whether this sticker can be used (“active”)

Returns:

  • (String)


28
# File 'lib/turntabler/sticker.rb', line 28

attribute :state

Instance Method Details

#place(top, left, angle) ⇒ true

Sets the current user’s stickers.

Examples:

sticker.place(126, 78, -23)   # => true

Parameters:

  • top (Fixnum)

    The y-coordinate of the sticker

  • left (Fixnum)

    The x-coordinate of the sticker

  • angle (Float)

    The degree at which the sticker is angled

Returns:

  • (true)

Raises:



43
44
45
46
# File 'lib/turntabler/sticker.rb', line 43

def place(top, left, angle)
  api('sticker.place', :placement => [:sticker_id => id, :top => top, :left => left, :angle => angle], :is_dj => client.user.dj?, :roomid => room.id, :section => room.section)
  true
end