Created
September 10, 2013 07:14
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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