module Wor::Push::Notifications::Aws

Constants

DEVICE_TYPES
VERSION

Public Class Methods

add_token(user, device_token, device_type) click to toggle source
# File lib/wor/push/notifications/aws.rb, line 88
def self.add_token(user, device_token, device_type)
  PushNotifications.add_token(user, device_token, device_type.to_sym)
end
aws_android_arn() click to toggle source
# File lib/wor/push/notifications/aws.rb, line 76
def self.aws_android_arn
  @config[:aws_android_arn]
end
aws_android_arn=(aws_android_arn) click to toggle source
# File lib/wor/push/notifications/aws.rb, line 50
def self.aws_android_arn=(aws_android_arn)
  raise ArgumentError, 'Argument must be a string' unless aws_android_arn.is_a?(String)
  @config[:aws_android_arn] = aws_android_arn
end
aws_ios_arn() click to toggle source
# File lib/wor/push/notifications/aws.rb, line 68
def self.aws_ios_arn
  @config[:aws_ios_arn]
end
aws_ios_arn=(aws_ios_arn) click to toggle source
# File lib/wor/push/notifications/aws.rb, line 40
def self.aws_ios_arn=(aws_ios_arn)
  raise ArgumentError, 'Argument must be a string' unless aws_ios_arn.is_a?(String)
  @config[:aws_ios_arn] = aws_ios_arn
end
aws_ios_sandbox() click to toggle source
# File lib/wor/push/notifications/aws.rb, line 72
def self.aws_ios_sandbox
  @config[:aws_ios_sandbox]
end
aws_ios_sandbox=(aws_ios_sandbox) click to toggle source
# File lib/wor/push/notifications/aws.rb, line 45
def self.aws_ios_sandbox=(aws_ios_sandbox)
  raise ArgumentError, 'Argument must be a boolean' unless boolean?(aws_ios_sandbox)
  @config[:aws_ios_sandbox] = aws_ios_sandbox
end
aws_region() click to toggle source
# File lib/wor/push/notifications/aws.rb, line 80
def self.aws_region
  @config[:aws_region]
end
aws_region=(aws_region) click to toggle source
# File lib/wor/push/notifications/aws.rb, line 55
def self.aws_region=(aws_region)
  raise ArgumentError, 'Argument must be a string' unless aws_region.is_a?(String)
  @config[:aws_region] = aws_region
end
boolean?(value) click to toggle source
# File lib/wor/push/notifications/aws.rb, line 104
def self.boolean?(value)
  value.is_a?(TrueClass) || value.is_a?(FalseClass)
end
config() click to toggle source
# File lib/wor/push/notifications/aws.rb, line 84
def self.config
  @config
end
configure() { |self| ... } click to toggle source
# File lib/wor/push/notifications/aws.rb, line 15
def self.configure
  yield self
end
delete_token(user, device_token) click to toggle source
# File lib/wor/push/notifications/aws.rb, line 92
def self.delete_token(user, device_token)
  PushNotifications.delete_token(user, device_token)
end
device_types() click to toggle source
# File lib/wor/push/notifications/aws.rb, line 60
def self.device_types
  @config[:device_types]
end
device_types=(types) click to toggle source

Precondition: types must be an array of symbols containing valid device types.

Every type included in this array must be a valid device type
(you can ask for valid device types with the method valid_device_types).
Default is ['ios' 'android'].
# File lib/wor/push/notifications/aws.rb, line 23
def self.device_types=(types)
  raise ArgumentError, 'Argument must be an array of symbols' unless types.is_a?(Array)
  types.each do |type|
    raise ArgumentError, "Invalid type #{type}" unless DEVICE_TYPES.include?(type)
  end
  @config[:device_types] = types
end
send_message(user, message_content) click to toggle source
# File lib/wor/push/notifications/aws.rb, line 96
def self.send_message(user, message_content)
  PushNotifications.send_message(user, message_content)
end
table_name() click to toggle source
# File lib/wor/push/notifications/aws.rb, line 64
def self.table_name
  @config[:table_name]
end
table_name=(table_name) click to toggle source

Precondition: table_name must be a string which points out the name of the table that

will store the device_tokens.
Default is 'users'.
# File lib/wor/push/notifications/aws.rb, line 34
def self.table_name=(table_name)
  raise ArgumentError, 'Argument must be a string' unless table_name.is_a?(String)
  raise ArgumentError, 'Argument must not be an empty string' if table_name.empty?
  @config[:table_name] = table_name.pluralize.to_sym
end
valid_device_types() click to toggle source
# File lib/wor/push/notifications/aws.rb, line 100
def self.valid_device_types
  DEVICE_TYPES
end