Sha256: 1d0d2e12281d8f4a402c579deccf5c737de19ff0d63b4abf0658834f79a5c0b2

Contents?: true

Size: 1007 Bytes

Versions: 12

Compression:

Stored size: 1007 Bytes

Contents

require 'active_support/dependencies'
require 'agilib/push_notification/platforms/ios'
require 'agilib/push_notification/platforms/android'
require 'agilib/push_notification/model'

module Agilib
  module PushNotification
    extend ActiveSupport::Concern

    @@avaiable_platforms = {
      :ios      => Agilib::PushNotification::Platform::Ios, 
      :android  => Agilib::PushNotification::Platform::Android
    }

    def self.avaiable_platforms
      @@avaiable_platforms
    end

    mattr_accessor :device_route
    @@device_route = "/devices"

    mattr_accessor :use_platforms
    @@use_platforms = Hash.new

    def self.platform(name, options={}, &block)
      @@use_platforms[name] = true

      mod = @@avaiable_platforms[name]

      options.each_with_index do |value, index|
        mod.send("#{value[0]}=", [value[1]])
      end

      if block_given?
        yield(mod)
      end

    end


  end
end

if defined? ActiveRecord
  ActiveRecord::Base.send :include, Agilib::PushNotification
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
agilib-0.1.9 lib/agilib/push_notification/push_notification.rb
agilib-0.1.8 lib/agilib/push_notification/push_notification.rb
agilib-0.1.7 lib/agilib/push_notification/push_notification.rb
agilib-0.1.6 lib/agilib/push_notification/push_notification.rb
agilib-0.1.5 lib/agilib/push_notification/push_notification.rb
agilib-0.1.4 lib/agilib/push_notification/push_notification.rb
agilib-0.1.3 lib/agilib/push_notification/push_notification.rb
agilib-0.1.2.beta6 lib/agilib/push_notification/push_notification.rb
agilib-0.1.2.beta5 lib/agilib/push_notification/push_notification.rb
agilib-0.1.2.beta4 lib/agilib/push_notification/push_notification.rb
agilib-0.1.2.beta3 lib/agilib/push_notification/push_notification.rb
agilib-0.1.2.beta2 lib/agilib/push_notification/push_notification.rb