Skip to content

Instantly share code, notes, and snippets.

@y-matsuwitter
Created September 10, 2013 07:14
Show Gist options
  • Save y-matsuwitter/6505979 to your computer and use it in GitHub Desktop.
Save y-matsuwitter/6505979 to your computer and use it in GitHub Desktop.
AWSのSNSからiOSにpush送った ref: http://qiita.com/y_matsuwitter/items/98c0094929e90d25377e
require 'aws-sdk'
device_token = 'your device token'
aws_access_key = 'your aws access key'
aws_secret_key = 'your aws secret key'
region = 'your aws region'
application_arn = 'your application arn'
AWS.config(
access_key_id: aws_access_key,
secret_access_key: aws_secret_key,
region: region
)
sns = AWS::SNS.new
client = sns.client
response = client.create_endpoint(
platform_application_arn: application_arn,
token: device_token
)
endpoint_arn = response[:endpoint_arn]
client.publish(target_arn: endpoint_arn, message: 'hogehoge')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment