Sha256: e7b1b154ffbfa451d158b27e9b3b152ecc77cae7c76a9e48179886cf5e0be6fc

Contents?: true

Size: 780 Bytes

Versions: 2

Compression:

Stored size: 780 Bytes

Contents

module DeviceCloud
  class PushNotification::BaseNotification
    attr_reader :id, :full_path, :device_id, :value, :queued_at, :type
    
    def self.handle!(file_data)
      event = new(file_data)
      event.handle!
    end

    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

    def handle!
      raise NotImplementedError
    end

    def file_name
      @file_data.file_name
    end

    def mac_address
      return '' unless device_id.size > 0
      device_id.sub(/\Am:/, '').scan(/.{2}|.+/).join(':')
    end

    def data
      @file_data.data
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
device_cloud-0.0.11 lib/device_cloud/push_notification/base_notification.rb
device_cloud-0.0.10 lib/device_cloud/push_notification/base_notification.rb