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 tutorials on our blog.


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

Interviews with startup founders: Fonn Byggemappen

Interviews with startup founders: Fonn Byggemappen

Fonn Byggemappen is an iOS, Android and web application for construction industry projects. The tool’s co-founder Jan Tore Grindheim told us about the beginnings and crucial moments of the app.

Read more
Core ML: Machine Learning for iOS

Core ML: Machine Learning for iOS

You have probably heard phrases like “Machine Learning” or “Artificial Intelligence” without knowing exactly what they mean. In this article, I will shed some light on “What Machine Learning is” by showing you a Core ML iOS sample.

Read more
3 steps to choose a software development company

3 steps to choose a software development company

Do you have a new business idea for a profitable web or mobile application only needing a qualified team to make it happen? If that is the case, this checklist is for you! Keep on reading and learn how to find the right software development company.

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

Contact us

Hire us now!

back to top