Class: Caliper::Sensor
- Inherits:
-
Object
- Object
- Caliper::Sensor
- Defined in:
- lib/caliper/sensor.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #describe(entity) ⇒ Object
-
#initialize(id, options) ⇒ Sensor
constructor
A new instance of Sensor.
- #send(event) ⇒ Object
Constructor Details
#initialize(id, options) ⇒ Sensor
Returns a new instance of Sensor.
30 31 32 33 |
# File 'lib/caliper/sensor.rb', line 30 def initialize(id, ) @id = id = end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
28 29 30 |
# File 'lib/caliper/sensor.rb', line 28 def id @id end |
Instance Method Details
#describe(entity) ⇒ Object
35 36 37 38 39 |
# File 'lib/caliper/sensor.rb', line 35 def describe(entity) raise ArgumentError, "Expecting Caliper::Entity but got #{entity.class.to_s}" unless entity.is_a?(Caliper::Entities::Entity) HttpRequestor.new().send(self, entity) end |
#send(event) ⇒ Object
41 42 43 44 45 |
# File 'lib/caliper/sensor.rb', line 41 def send(event) raise ArgumentError, "Expecting Caliper::Event but got #{event.class.to_s}" unless event.is_a?(Caliper::Events::Event) HttpRequestor.new().send(self, event) end |