Class Libastag::Rabbit
In: lib/libastag.rb
Parent: Object
RabitEar RabitLed Rabbit Libastag dot/f_4.png

this class store all attribute of a Nabaztag. it receive events and retrieve information from your user account or your Rabbit (see public methods).

Methods

asleep?   awake?   name   new   sleep!   version   wakeup!  

Constants

SERIAL_MATCHER = /^[0-9A-F]+$/i   used to check serial
TOKEN_MATCHER = /^[0-9]+$/   used to check token

Attributes

bottom_led  [R]  object that handle bottom led, see RabbitLed.
left_ear  [R]  object that handle left ear, see RabbitEar.
left_led  [R]  object that handle left led, see RabbitLed.
middle_led  [R]  object that handle middle led, see RabbitLed.
right_ear  [R]  object that handle right ear, see RabbitEar.
right_led  [R]  object that handle right led, see RabbitLed.
serial  [R]  Serial number of the Nabaztag that will receive events
token  [R]  The token is a series of digits given when you activate the Nabaztag receiver. This extra identification limits the risks of spam, since, in order to send a message, you need to know both the serial number and the toke
top_led  [R]  object that handle top led, see RabbitLed.

Public Class methods

create a new Rabbit with given serial and token. make a basic syntax check of serial and token (see SERIAL_MATCHER and TOKEN_MATCHER), but it doesn‘t mean that they are valid.

[Source]

    # File lib/libastag.rb, line 46
46:     def initialize serial, token
47:       raise ArgumentError.new("bad serial : #{serial}") unless serial =~ SERIAL_MATCHER
48:       raise ArgumentError.new("bad token  : #{token }") unless token  =~  TOKEN_MATCHER
49:       @serial = serial.upcase
50:       @token  = token.to_i
51: #     _________                     _________
52: #    /         \                   /               @right_ear,                    @left_ear          = RabbitEar.new(:right), RabbitEar.new(:left)
53: #   |           |                 |           |
54: #   |           |                 |           |
55: #   |           |                 |           |
56: #   |           |                 |           |
57: #   |           |                 |           |
58: #   |           |                 |           |
59: #   |           |                 |           |
60: #   |           |                 |           |
61: #   |           |_________________|           |
62: #   |           |                 |           |
63: #   |           |                 |           |
64: #   |                                         |
65: #   |                                         |
66: #   |         |                     |         |
67: #   |                                         |
68: #   |                  ___                    |
69:                      @top_led                           = RabbitLed.new(:top)
70: #   |                   |                     |
71: #   |                                         |
72: #   |                                         |
73: #   |                                         |
74:      @right_led,    @middle_led,     @left_led          = RabbitLed.new(:right), RabbitLed.new(:middle), RabbitLed.new(:left)
75: #   |                                         |
76: #   |                                         |
77: #   |                                         |
78: #   |                                         |
79: #   |                                         |
80: #   |                   |                     |
81: #  /                                                                @bottom_led                         = RabbitLed.new :bottom
82: # -----------------------------------------------
83:     end

Public Instance methods

[Source]

    # File lib/libastag.rb, line 91
91:     def asleep?
92:       # TODO
93:     end

[Source]

    # File lib/libastag.rb, line 97
97:     def awake?
98:       # TODO
99:     end

[Source]

    # File lib/libastag.rb, line 88
88:     def name
89:       # TODO
90:     end

[Source]

    # File lib/libastag.rb, line 94
94:     def sleep!
95:       # TODO
96:     end

[Source]

     # File lib/libastag.rb, line 103
103:     def version
104:       # TODO
105:     end

[Source]

     # File lib/libastag.rb, line 100
100:     def wakeup!
101:       # TODO
102:     end

[Validate]