JetLobster ruby local APNs testing tool

published in iOS Development, Tutorials
by Slawomir Onyszko

Are you working on an iOS mobile app and have to check if all of the programmed notifications work correctly? Keep on reading: JetLobster ruby local APNs tool can easily test the service of notifications in your iPhone app.

Testing the notification service isn’t difficult. Although, in our case, it happened to be impossible. Why? Functionalities on the back-end side weren’t ready yet, and that’s why we needed a tool that would help us send real notifications in a quick and easy way.

How did I make JetLobster ruby local APNs testing tool?

I came up with an idea to write a ruby script which will make it possible. The main goal was to make everything work efficiently and flexibly. Creating the script took me only a few minutes. To send notifications to APNs, I’ve used a gem called APNS – it happened to be easy and at the same time, it provided everything that I needed. Additionally, I’ve used the OptionParser gem to parse parameters in a terminal. Thanks to that the tool became more functional and user-friendly.

Next steps of testing the notifications

To send the notification I needed an application with configurated APNs services, generated *.pem file and the tool’s token (that I’ve managed to get after registering the service). The script requires ruby and bundler. After cloning a repository, it was needed to move on to a directory and run bundle install command. All that had to be done, was to run the script with a minimum of 3 parameters.

ruby jet_lobster.rb --pem "PathToYourPemFile.pem"  
--token DEADC00FE --message "JetLobster is awesome!"

With the --pem option I gave a path to our pem file, --token. Here I’ve provided tool’s token, and in --message, a notification message. In the above command, I didn’t use --other option – but if used, it helps to send an extra data that is placed in a notification. Exemplary:

ruby jet_lobster.rb --pem "PathToYourPemFile.pem" 
--token DEADC00FE --message "JetLobster is awesome!" 
--other "{:sent => 'with JetLobster'}"

Remember that when providing the data, you must use ruby syntax creating Hash.

And that’s it. In my opinion, JetLobster ruby local APNs is an easy, quick and flexible tool to test the service of notification in an iOS app.  And how do you like it?

Check out other iOS development tutorial on our blog: Core ML: Machine Learning for iOS.

 


You can find the source code on my Github.


 

Slawomir Onyszko Mobile Developer

Sławek is our mobile developer who mostly takes care of creating Android applications. He is constantly enhancing his skills of advanced Android app development and he wants to share this knowledge via Zaven’s blog. In his spare time Sławek enjoys watching a good movie at the cinema.

Popular posts

Artificial Intelligence in Medicine

Artificial Intelligence in Medicine

The active development of Artificial Intelligence (AI) plays an increasingly important role in the analysis, diagnosis and monitoring of patient treatment. It also improves patient-doctor contact and automatic reporting. Will modern technologies revolutionize the current health care system? This is what you will learn from the article. What is Artificial Intelligence in medicine? In a […]

Read more
IoMT – Internet of Medical Things

IoMT – Internet of Medical Things

The revolution brought by the Internet of Things (IoT) is beginning to take over more and more areas of everyday life. This also includes the use of such solutions in medicine and health care. This phenomenon is already so common that it has its name – IoMT (Internet of Medical Things). How does IoMT support […]

Read more
Mobile Healthcare Applications

Mobile Healthcare Applications

The development of mobile applications dedicated to healthcare has brought about a significant change in the once traditional healthcare industry. What used to involve spending a lot of money, waiting in long queues or consulting many professionals is now often reduced to using a mobile application. By using it, we will make an appointment, consult […]

Read more
Mobile Apps

Get your mobile app in 3 easy steps!

1

Spec out

with the help of our
business analyst

2

Develop

design, implement
and test, repeat!

3

Publish

get your app out
to the stores


back to top