Sha256: 8b2cda36c6687c781456c88e33c4cf2df7c145c78088dda4491e9443b42e2ab0

Contents?: true

Size: 609 Bytes

Versions: 3

Compression:

Stored size: 609 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_id, device)
      })[:endpoint_arn]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
push_to_sns-0.2.0 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.1.1 lib/push_to_sns/setup_push_notification.rb
push_to_sns-0.1.0 lib/push_to_sns/setup_push_notification.rb