Class: DeviceCloud::PushNotification::BaseNotification
- Inherits:
-
Object
- Object
- DeviceCloud::PushNotification::BaseNotification
- Defined in:
- lib/device_cloud/push_notification/base_notification.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#device_id ⇒ Object
readonly
Returns the value of attribute device_id.
-
#full_path ⇒ Object
readonly
Returns the value of attribute full_path.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#queued_at ⇒ Object
readonly
Returns the value of attribute queued_at.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
- #file_name ⇒ Object
- #handle! ⇒ Object
-
#initialize(file_data) ⇒ BaseNotification
constructor
A new instance of BaseNotification.
- #mac_address ⇒ Object
Constructor Details
#initialize(file_data) ⇒ BaseNotification
Returns a new instance of BaseNotification.
10 11 12 13 14 15 16 17 18 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 10 def initialize(file_data) @file_data = file_data @id = data["id"] @full_path = file_data.full_path @device_id = data["device_id"] @type = data["type"] @queued_at = data["queued_dt"] @value = data["value"] end |
Instance Attribute Details
#device_id ⇒ Object (readonly)
Returns the value of attribute device_id.
3 4 5 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 3 def device_id @device_id end |
#full_path ⇒ Object (readonly)
Returns the value of attribute full_path.
3 4 5 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 3 def full_path @full_path end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 3 def id @id end |
#queued_at ⇒ Object (readonly)
Returns the value of attribute queued_at.
3 4 5 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 3 def queued_at @queued_at end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 3 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 3 def value @value end |
Class Method Details
.handle!(file_data) ⇒ Object
5 6 7 8 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 5 def self.handle!(file_data) event = new(file_data) event.handle! end |
Instance Method Details
#data ⇒ Object
34 35 36 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 34 def data @file_data.data end |
#file_name ⇒ Object
24 25 26 27 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 24 def file_name return '' unless id id['fdName'] end |
#handle! ⇒ Object
20 21 22 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 20 def handle! raise NotImplementedError end |
#mac_address ⇒ Object
29 30 31 32 |
# File 'lib/device_cloud/push_notification/base_notification.rb', line 29 def mac_address return '' unless device_id.size > 0 device_id.sub(/\Am:/, '').scan(/.{2}|.+/).join(':') end |