Class Libastag::Rabbit
In: lib/libastag.rb
Parent: Object
RabitEar RabitLed Rabbit Libastag dot/f_5.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 50
50:     def initialize serial, token
51:       raise ArgumentError.new("bad serial : #{serial}") unless serial =~ SERIAL_MATCHER
52:       raise ArgumentError.new("bad token  : #{token }") unless token  =~  TOKEN_MATCHER
53:       @serial = serial.upcase
54:       @token  = token.to_i
55: #     _________                     _________
56: #    /         \                   /               @right_ear,                    @left_ear          = RabbitEar.new(:right), RabbitEar.new(:left)
57: #   |           |                 |           |
58: #   |           |                 |           |
59: #   |           |                 |           |
60: #   |           |                 |           |
61: #   |           |                 |           |
62: #   |           |                 |           |
63: #   |           |                 |           |
64: #   |           |                 |           |
65: #   |           |_________________|           |
66: #   |           |                 |           |
67: #   |           |                 |           |
68: #   |                                         |
69: #   |                                         |
70: #   |         |                     |         |
71: #   |                                         |
72: #   |                  ___                    |
73:                      @top_led                           = RabbitLed.new(:top)
74: #   |                   |                     |
75: #   |                                         |
76: #   |                                         |
77: #   |                                         |
78:      @right_led,    @middle_led,     @left_led          = RabbitLed.new(:right), RabbitLed.new(:middle), RabbitLed.new(:left)
79: #   |                                         |
80: #   |                                         |
81: #   |                                         |
82: #   |                                         |
83: #   |                                         |
84: #   |                   |                     |
85: #  /                                                                @bottom_led                         = RabbitLed.new :bottom
86: # -----------------------------------------------
87:     end

Public Instance methods

[Source]

    # File lib/libastag.rb, line 95
95:     def asleep?
96:       # TODO
97:     end

[Source]

     # File lib/libastag.rb, line 101
101:     def awake?
102:       # TODO
103:     end

[Source]

    # File lib/libastag.rb, line 92
92:     def name
93:       # TODO
94:     end

[Source]

     # File lib/libastag.rb, line 98
 98:     def sleep!
 99:       # TODO
100:     end

[Source]

     # File lib/libastag.rb, line 107
107:     def version
108:       # TODO
109:     end

[Source]

     # File lib/libastag.rb, line 104
104:     def wakeup!
105:       # TODO
106:     end

[Validate]