Sha256: 4ac31e326948e6a56d046f5cc1ef360db222c5a0bd6f0ee113119830a352a8e2

Contents?: true

Size: 612 Bytes

Versions: 8

Compression:

Stored size: 612 Bytes

Contents

module PushToSNS
  class SetupPushNotification
    def initialize(device, configuration = PushToSNS.configuration)
      self.device = device
      self.configuration = configuration
    end

    def perform
      configuration.apply(:save_endpoint_arn, device, create_endpoint_arn)
    end

    private

    attr_accessor :device, :configuration

    def create_endpoint_arn
      AWS.sns.client.create_platform_endpoint({
        platform_application_arn: configuration.apply(:read_platform_arn, device),
        token: configuration.apply(:read_device_token, device)
      })[:endpoint_arn]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
push_to_sns-0.6.0 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.5.0 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.4.1 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.4.0 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.3.3 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.3.2 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.3.1 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.3.0 lib/push_to_sns/setup_push_notification.rb