jpoz / APNS

An Apple Push Notification Service gem
MIT License
543 stars 195 forks source link

APNS class file #42

Open Sharespot opened 8 years ago

Sharespot commented 8 years ago

Hello,

I've it all installed but I haven't seem any APNS class file to setup host, pem and port. No configurations file at all were created when I installed the gem.

What am I missing?

Thanks!

jlstr commented 8 years ago

right, I'm facing the same issue. found the answer yet @Sharespot?

alpriest commented 8 years ago

The file is a gem so you don't use the 'file' directly inside your project, you just require it. See below how to send a message using it from the command line.

$ irb
> require 'APNS'
=> true
> APNS.pem = '/path/to/file'
=> '/path/to/file'
> APNS.send_notification(token, 'hello world')
=> nil
Sharespot commented 8 years ago

@jlstr sorry, the notification went to the company's mail and I hadn't seem it until now.

I did like @alpriest said although I didn't even have to require it... I just did

              APNS.pem = '/home/ubuntu/magikey_server/apns.pem'
              APNS.send_notification(mobile.token,message)

inside my code each time I wanted to send a notification and it worked.