• Stars
    star
    201
  • Rank 194,491 (Top 4 %)
  • Language
    Ruby
  • License
    Other
  • Created over 13 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Ruby wrapper for the Urban Airship API.

About

urbanairship is a Ruby library for using the Airship REST API for push notifications, message center messages, email, and SMS.

Requirements

We officially support the following Ruby versions:

2.6.7
2.7.2

Newer 2.x versions should work as well.

Functionality

Version 8.0 is a major upgrade, as we have changed the tested/supported versions of Ruby. A more detailed list of changes can be found in the CHANGELOG.

Questions

The best place to ask questions or report a problem is our support site: http://support.airship.com/

Installation

If you have the bundler gem (if not you can get it with $ gem install bundler) add this line to your application's Gemfile:

>>> $ gem 'urbanairship'

And then execute:

>>> $ bundle

OR install it yourself as:

>>> $ gem install urbanairship

Configuration

In your app initialization, you can do something like the following:

require 'urbanairship'

Urbanairship.configure do |config|
  config.server = 'go.airship.eu'
  config.log_path = '/path/to/your/logfile'
  config.log_level = Logger::WARN
  config.timeout = 60
end

If you want to use a custom logger (e.g Rails.logger), you can do:

require 'urbanairship'

Urbanairship.configure do |config|
  config.custom_logger = Rails.logger
  config.log_level = Logger::WARN
end

Available Configurations

  • log_path: Allows to define the folder where the log file will be created (the default is nil).
  • log_level: Allows to define the log level and only messages at that level or higher will be printed (the default is INFO).
  • server: Allow to define the Airship server you want to use ("go.airship.eu" or "go.urbanairship.com")
  • timeout: Allows to define the request timeout in seconds (the default is 5).

Usage

Once the gem has been installed you can start sending pushes! See the full documentation, api examples, as well as the Airship API Documentation for more information.

Broadcast to All Devices

require 'urbanairship'

UA = Urbanairship

airship = UA::Client.new(key:'application_key', secret:'master_secret')
p = airship.create_push
p.audience = UA.all
p.notification = UA.notification(alert: 'Hello')
p.device_types = UA.device_types(['ios','android'])
p.send_push

Simple Tag Push

require 'urbanairship'

UA = Urbanairship

airship = UA::Client.new(key:'application_key', secret:'master_secret')
p = airship.create_push
p.audience = UA.tag('some_tag')
p.notification = UA.notification(alert: 'Hello')
p.device_types = UA.device_types(['ios','android'])
p.send_push

Specify the Airship server used to make your requests

By default, the request will be sent to the 'go.urbanairship.com' server:

require 'urbanairship'

Urbanairship::Client.new(key:'application_key', secret:'master_secret')

You can change the server globally in the Urbanairship configuration:

require 'urbanairship'

Urbanairship.configure do |config|
  config.server = 'go.airship.eu'
end

Urbanairship::Client.new(key:'application_key', secret:'master_secret')
# request will be sent to the 'go.airship.eu' server

Finally, you can change the targeted server on a request basis:

require 'urbanairship'

Urbanairship.configure do |config|
  config.server = 'go.airship.eu'
end

Urbanairship::Client.new(key:'application_key', secret:'master_secret', server: 'go.urbanairship.com')
# The Urbanairship configuration is overridden by the client and the
# request will be sent to the 'go.urbanairship.com' server

Using Bearer Token Auth

require 'urbanairship'

UA = Urbanairship
airship = UA::Client.new(key:'application_key', token:'token')
# Then continue as you would otherwise

Note: If you include a token in your instantiation, the request will use bearer token auth. Bearer token auth is required for some endpoints, but not supported by others. Please check the Airship docs site to see where it is supported.

Contributing

  1. Fork it ( https://github.com/urbanairship/ruby-library )
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes git commit -am 'Add some feature'
  4. Push to the branch git push origin my-new-feature
  5. Create a new Pull Request
  6. Sign Airship's contribution agreement.

7. Reach out to our support team at https://support.airship.com to let us know about your PR and your urgency level.

Note: Changes will not be approved and merged without a signed contribution agreement.

Development

After checking out the repo, ensure you have bundler installed ($ gem install bundler) run:

>>> $ bin/setup

to install dependencies. Then, run:

>>> $ bin/console

for an interactive prompt that will allow you to experiment.

OR you can build a local gem to play with:

>>> $ gem build urbanairship.gemspec
>>> $ gem install ./urbanairship-<VERSION>.gem

Having a local build will give you better logging if you are running into issues, but be careful to make sure to use our released public gem in Production.

More Repositories

1

ios-library

Urban Airship iOS SDK
Swift
474
star
2

datacube

Multidimensional data storage with rollups for numerical data
Java
264
star
3

urbanairship-cordova

Urban Airship integration with Apache Cordova
JavaScript
142
star
4

frock

A plugin-based tool for running fake HTTP and socket services
JavaScript
140
star
5

techladder

Job titles and descriptions for UA engineering
Makefile
113
star
6

android-library

Urban Airship Android SDK
Kotlin
111
star
7

react-native-airship

Airship React Native module
TypeScript
88
star
8

python-library

A Python library for using the Airship APIs for push notifications, reporting and other message types
Python
82
star
9

ios-phonegap-plugin

This repo is deprecated. Please see: https://github.com/urbanairship/phonegap-ua-push
JavaScript
69
star
10

statshtable

Java
45
star
11

drive.js

Drive.js makes testing JavaScript applications easy, wherever they live
JavaScript
43
star
12

php-library2

Urban Airship PHP Library
PHP
38
star
13

java-library

Java client library for the Urban Airship API
Java
33
star
14

android-samples

DEPRECATED - Use https://github.com/urbanairship/android-library instead
Java
33
star
15

mvn-python-packaging

A code sample and article describing how maven can be used to build python packages.
Python
32
star
16

beanstalk-munin

Munin plugins for Beanstalkd written in Python
Python
30
star
17

ios-samples

A collection of samples using the Urban Airship ios-library
Objective-C
26
star
18

aerostat

Cloud Naming Client/Service
Python
25
star
19

hbackup

Java
22
star
20

go-iapclient

A Google Cloud Platform Identity Aware Proxy authentication library for Golang
Go
20
star
21

airship-flutter

Flutter integration
Dart
17
star
22

ua-unity-plugin

C#
15
star
23

ua-ios-pod

a project for staging, testing and managing Urban Airship's cocoapod situation
Objective-C
15
star
24

pubsubsuperfeedr

Simple Python library to interface with Superfeedr's pubsubhubbub interface.
Python
10
star
25

titanium-module

Urban Airship Titanium module
Swift
9
star
26

urbanairship-xamarin

Urban Airship Xamarin Libraries
C#
9
star
27

node-connect-client

A node client for connecting to the Urban Airship Connect API.
JavaScript
8
star
28

passtools-api

Official documentation and resources for the PassTools API
8
star
29

pykafkap

Python Kafka Producer
Python
7
star
30

connect-java-library

Java client library for Urban Airship Connect
Java
6
star
31

django-subforms

An implementation of Hierarchical forms and form-to-model mapping.
Python
6
star
32

objectstate

Streaming state management for node and the browser
JavaScript
6
star
33

django-finial

Hierarchical template overriding on a per request basis.
Python
5
star
34

bb-push-sample-os5

BlackBerry push notification sample application, OS 5.0 and up
Java
5
star
35

android-gimbal-adapter

The Android Gimbal adapter for Urban Airship
Java
5
star
36

django-mithril

IP (v4 and v6) Whitelisting for Django
Python
5
star
37

connect-json-schema

JSON Schema for connect events
4
star
38

bb-push-sample-os4

BlackBerry push notification sample application, OS 4.x compatible
Java
4
star
39

passtools-ruby

Official Ruby SDK for the PassTools API
Ruby
4
star
40

kiddiepool

Python Client Driver Pool
Python
4
star
41

tap-set-exit

Sets the correct exit code based on tap output.
JavaScript
4
star
42

dedupe-stream

A stream that prevents consecutive duplicate emissions.
JavaScript
3
star
43

sarlacc-pit

Library for maintaining a complete in-memory copy of a remote data source.
Java
3
star
44

android-automator-utils

This project contains utilities that are used for UI Automation testing.
Java
3
star
45

google-v3-geocoder

Geokit::Geocoder subclass for interacting with google's v3 geocoder
3
star
46

ios-gimbal-adapter

The iOS Gimbal adapter for Urban Airship
Swift
3
star
47

ua-api-utils

Urban Airship API Utilities
Python
2
star
48

frock-middleware-delay

Delay middleware for frock. Introduce some latency.
JavaScript
2
star
49

passtools-java

Official Java SDK for the PassTools API
Java
2
star
50

object-cursor-stream

de-duped keypath stream
JavaScript
2
star
51

frock-static

A static file server for frock
JavaScript
2
star
52

apptimize-ios-kit

Swift
2
star
53

passtools-python

Official Python SDK for the PassTools API
Python
2
star
54

api-specs

OpenAPI specs for Airship APIs
2
star
55

logbot

IRC Logging Bot
Python
2
star
56

frock-proxy

A proxy plugin for frock
JavaScript
2
star
57

accengage-mobile-react-native

React Native module wrapping Android and iOS SDKs
Objective-C
2
star
58

padlocker-client

Encryption key dispersion service - Client
Python
2
star
59

cordova-gimbal-bridge

Gimbal Phongap plugin that uses the GimbalAdapter
Objective-C
2
star
60

streaming-set

A stream which adds objects written to it to a set, and then emits the updated array.
JavaScript
2
star
61

mongotools

Python tools for working with MongoDB
Python
1
star
62

connect-python-library

Python client library for Urban Airship Connect
Python
1
star
63

apptimize-flutter

Apptimize Flutter Plugin for iOS and Android
Dart
1
star
64

urbanairship-accengage-cordova

DEPRECATED
1
star
65

accengage-ios-sdk-releases

The Accengage iOS Framework Releases
1
star
66

capacitor-airship

TypeScript
1
star
67

cordova-gimbal-sdk

Objective-C
1
star
68

ios-pod-specs

Repository for Accengage CocoaPods specifications.
Ruby
1
star
69

android-ga-tracker

Android extension to the Google Analytics SDK
Java
1
star
70

react-native-gimbal-adapter

Objective-C
1
star
71

apptimize-qa-console-ios

Preview variants in different combinations from all of your active feature flags and experiments.
Swift
1
star
72

airship-mobile-framework-proxy

Kotlin
1
star
73

accengage-android-sdk-samples

Java
1
star
74

react-native-acc-fcm

Accengage FCM Plugin for React Native
Java
1
star
75

reach-python-library

Python client library for Urban Airship Reach
Python
1
star
76

airship-dotnet

C#
1
star
77

break-the-intranet

Hack week / Intranet
JavaScript
1
star
78

apptimize-qa-console-android

Java
1
star
79

accengage-android-lib-sample

Java
1
star
80

analytics-swift-apptimize

Swift
1
star
81

cordova-firebase-app-init

Java
1
star
82

ua-extensions

Urban Airship extensions repository houses drop in classes that provide additional functionality for the Urban Airship SDK
Objective-C
1
star
83

padlocker-server

Encryption key dispersion service - Server
JavaScript
1
star
84

ios-segment-integration

A simple way to integrate Urban Airship and Segment.
Objective-C
1
star