urbanairship 4.1.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +8 -18
- data/README.rst +1 -1
- data/docs/devices.rst +0 -35
- data/docs/named_user.rst +4 -3
- data/docs/push.rst +57 -4
- data/lib/urbanairship/common.rb +0 -2
- data/lib/urbanairship/devices/devicelist.rb +0 -37
- data/lib/urbanairship/devices/named_user.rb +4 -4
- data/lib/urbanairship/push/audience.rb +2 -2
- data/lib/urbanairship/push/payload.rb +33 -2
- data/lib/urbanairship/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6f0d564484013c5bd00e79332ba4627eed3c88d6
|
4
|
+
data.tar.gz: 5539b387ffb95fe9275f16e26cd0d742d0ccce6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a85f430e036579a1b331a8b80d119407deec4a3c4c4757a7af5819e39d5ac0aa7ece81e7be79735f9039abfab61fe040b9b518292c54435a5f4acd4f68f3e805
|
7
|
+
data.tar.gz: c960ef78dda1bd889d8aae622b929bd1412fd7033e8612afa5ad9aed9210469887dd5de1e9bd04bd07ac70001e0fb5da658d8fce8e729c57d16bba962394825f
|
data/CHANGELOG
CHANGED
@@ -1,15 +1,20 @@
|
|
1
|
+
--------------------
|
2
|
+
5.0.0
|
3
|
+
--------------------
|
4
|
+
- Add support for Web Notify, expand Open Platform support
|
5
|
+
- Removing support for Feedback API (EOL July 2018)
|
6
|
+
- Removing support for Device Token Count (also EOL in 2018)
|
7
|
+
|
1
8
|
--------------------
|
2
9
|
4.1.1
|
3
10
|
--------------------
|
4
11
|
- Added configuration value for timeout.
|
5
12
|
|
6
|
-
|
7
13
|
--------------------
|
8
14
|
4.1.0
|
9
15
|
--------------------
|
10
16
|
- Added support for Open Channels
|
11
17
|
|
12
|
-
|
13
18
|
--------------------
|
14
19
|
4.0.0
|
15
20
|
--------------------
|
@@ -22,47 +27,38 @@
|
|
22
27
|
- Removed support for Blackberry and MPNS platforms
|
23
28
|
- Removed support for per-push reports
|
24
29
|
|
25
|
-
|
26
30
|
--------------------
|
27
31
|
3.2.4
|
28
32
|
--------------------
|
29
33
|
- Replace unirest dependency with rest-client
|
30
34
|
|
31
|
-
|
32
35
|
--------------------
|
33
36
|
3.2.3
|
34
37
|
--------------------
|
35
38
|
- Added support for named user audience selector
|
36
39
|
|
37
|
-
|
38
40
|
--------------------
|
39
41
|
3.2.2
|
40
42
|
--------------------
|
41
43
|
- Bug fix: only open a single copy of the log file
|
42
44
|
|
43
|
-
|
44
45
|
--------------------
|
45
46
|
3.2.1
|
46
47
|
--------------------
|
47
48
|
- Bug fix: allow audience tag selector to specify tag group if desired
|
48
49
|
|
49
|
-
|
50
50
|
--------------------
|
51
51
|
3.2.0
|
52
52
|
--------------------
|
53
53
|
- Added support for static lists
|
54
|
-
- Added support for device tokens,
|
54
|
+
- Added support for device tokens, APIDs, and Blackberry PINs
|
55
55
|
- Added support for locations
|
56
56
|
|
57
|
-
|
58
|
-
|
59
57
|
--------------------
|
60
58
|
3.1.1
|
61
59
|
--------------------
|
62
60
|
- Changed UA to Urbanairship in client.rb to fix aliasing issue
|
63
61
|
|
64
|
-
|
65
|
-
|
66
62
|
--------------------
|
67
63
|
3.1.0
|
68
64
|
--------------------
|
@@ -75,22 +71,16 @@
|
|
75
71
|
- Added support for named user
|
76
72
|
- Added support for reports
|
77
73
|
|
78
|
-
|
79
|
-
|
80
74
|
--------------------
|
81
75
|
3.0.2
|
82
76
|
--------------------
|
83
77
|
- Resolve compatibility issues with Rails ActiveSupport
|
84
78
|
|
85
|
-
|
86
|
-
|
87
79
|
--------------------
|
88
80
|
3.0.1
|
89
81
|
--------------------
|
90
82
|
- Updating Gemspec to show required Ruby Version correctly
|
91
83
|
|
92
|
-
|
93
|
-
|
94
84
|
--------------------
|
95
85
|
3.0.0
|
96
86
|
--------------------
|
data/README.rst
CHANGED
@@ -23,7 +23,7 @@ Newer versions should work as well.
|
|
23
23
|
Functionality
|
24
24
|
=============
|
25
25
|
|
26
|
-
Version
|
26
|
+
Version 5.0 is a major upgrade, as some features have been removed that were present in earlier versions. A more detailed list of changes can be found in the CHANGELOG.
|
27
27
|
|
28
28
|
|
29
29
|
Installation
|
data/docs/devices.rst
CHANGED
@@ -37,26 +37,6 @@ Device metadata is fetched for a specific channel by using
|
|
37
37
|
channel_info = channel_client.lookup(uuid: 'uuid')
|
38
38
|
puts(channel_info)
|
39
39
|
|
40
|
-
Feedback
|
41
|
-
--------
|
42
|
-
|
43
|
-
Feedback returns a list of dictionaries of device tokens/APIDs that the
|
44
|
-
respective push provider has told us are uninstalled since the given
|
45
|
-
timestamp. For more information, see `the API documentation for feedback
|
46
|
-
<http://docs.urbanairship.com/api/ua.html#feedback>`_
|
47
|
-
|
48
|
-
.. code-block:: ruby
|
49
|
-
|
50
|
-
require 'urbanairship'
|
51
|
-
require 'time'
|
52
|
-
UA = Urbanairship
|
53
|
-
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
54
|
-
since = (Time.now.utc - (60 * 60 * 24 * 3)).iso8601
|
55
|
-
feedback = UA::Feedback.new(client: airship)
|
56
|
-
tokens = feedback.device_token(since: since)
|
57
|
-
apids = feedback.apid(since: since)
|
58
|
-
|
59
|
-
|
60
40
|
Device Token Lookup
|
61
41
|
-------------------
|
62
42
|
|
@@ -90,21 +70,6 @@ Get a list of iOS device tokens for the application:
|
|
90
70
|
end
|
91
71
|
|
92
72
|
|
93
|
-
Device Token Count
|
94
|
-
------------------
|
95
|
-
|
96
|
-
Get the total iOS device tokens registered to the application.
|
97
|
-
|
98
|
-
.. code-block:: ruby
|
99
|
-
|
100
|
-
require 'urbanairship'
|
101
|
-
|
102
|
-
UA = Urbanairship
|
103
|
-
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
104
|
-
device_token_list = UA::DeviceTokenList.new(client: airship)
|
105
|
-
puts(device_token_list.count)
|
106
|
-
|
107
|
-
|
108
73
|
APID Lookup
|
109
74
|
-----------
|
110
75
|
|
data/docs/named_user.rst
CHANGED
@@ -31,14 +31,14 @@ Associate a channel with a named user ID. For more information, see
|
|
31
31
|
|
32
32
|
require 'urbanairship'
|
33
33
|
UA = Urbanairship
|
34
|
-
airship = UA::Client.new(key:'application_key', secret:'
|
34
|
+
airship = UA::Client.new(key:'application_key', secret:'app_or_master_secret')
|
35
35
|
named_user = UA::NamedUser.new(client: airship)
|
36
36
|
named_user.named_user_id = 'named_user'
|
37
37
|
named_user.associate(channel_id: 'channel_id', device_type: 'ios')
|
38
38
|
|
39
39
|
.. note::
|
40
40
|
|
41
|
-
|
41
|
+
Do not include a ``device_type`` for Web and Open platform associations.
|
42
42
|
|
43
43
|
Disassociation
|
44
44
|
--------------
|
@@ -51,7 +51,7 @@ For more information, see `the API documentation
|
|
51
51
|
|
52
52
|
require 'urbanairship'
|
53
53
|
UA = Urbanairship
|
54
|
-
airship = UA::Client.new(key:'application_key', secret:'
|
54
|
+
airship = UA::Client.new(key:'application_key', secret:'app_or_master_secret')
|
55
55
|
named_user = UA::NamedUser.new(client: airship)
|
56
56
|
named_user.disassociate(channel_id: 'channel_id', device_type: 'ios')
|
57
57
|
|
@@ -59,6 +59,7 @@ For more information, see `the API documentation
|
|
59
59
|
|
60
60
|
``named_user_id`` does not have to be set on the named_user object for this
|
61
61
|
method call since ``channel_id`` can only be associated with one named user.
|
62
|
+
Do not include a ``device_type`` for Web and Open platform disassociations.
|
62
63
|
|
63
64
|
Lookup
|
64
65
|
------
|
data/docs/push.rst
CHANGED
@@ -59,6 +59,18 @@ Select a single Amazon Channel:
|
|
59
59
|
|
60
60
|
push.audience = UA.amazon_channel(uuid)
|
61
61
|
|
62
|
+
Select a single Web Channel:
|
63
|
+
|
64
|
+
.. code-block:: ruby
|
65
|
+
|
66
|
+
push.audience = UA.channel(uuid)
|
67
|
+
|
68
|
+
Select a single Open Channel:
|
69
|
+
|
70
|
+
.. code-block:: ruby
|
71
|
+
|
72
|
+
push.audience = UA.open_channel(uuid)
|
73
|
+
|
62
74
|
Select a single iOS device token:
|
63
75
|
|
64
76
|
.. code-block:: ruby
|
@@ -71,7 +83,7 @@ Select a single Android APID:
|
|
71
83
|
|
72
84
|
push.audience = UA.apid(uuid)
|
73
85
|
|
74
|
-
Select a single Windows
|
86
|
+
Select a single Windows APID:
|
75
87
|
|
76
88
|
.. code-block:: ruby
|
77
89
|
|
@@ -204,7 +216,7 @@ platform-specific alerts, and we set a number of other platform-specific options
|
|
204
216
|
badge: 123,
|
205
217
|
sound: 'sound file',
|
206
218
|
extra: { 'key' => 'value', 'key2' => 'value2' },
|
207
|
-
expiry: '
|
219
|
+
expiry: '2019-01-01 12:45:00',
|
208
220
|
category: 'category_name',
|
209
221
|
interactive: UA.interactive(
|
210
222
|
type: 'ua_share',
|
@@ -226,7 +238,7 @@ platform-specific alerts, and we set a number of other platform-specific options
|
|
226
238
|
amazon: UA.amazon(
|
227
239
|
alert: 'Hello Amazon!',
|
228
240
|
consolidation_key: 'key',
|
229
|
-
expires_after: '
|
241
|
+
expires_after: '2019-01-01 12:45:00',
|
230
242
|
extra: { 'key' => 'value', 'key2' => 'value2' },
|
231
243
|
title: 'title',
|
232
244
|
summary: 'summary',
|
@@ -260,6 +272,47 @@ platform-specific alerts, and we set a number of other platform-specific options
|
|
260
272
|
)
|
261
273
|
)
|
262
274
|
|
275
|
+
**Example Web Override**
|
276
|
+
|
277
|
+
.. code-block:: ruby
|
278
|
+
|
279
|
+
push.notification = UA.notification(
|
280
|
+
alert: 'Hello World!',
|
281
|
+
web: UA.web(
|
282
|
+
alert: 'Hello Web!',
|
283
|
+
title: 'My Title',
|
284
|
+
extra: { 'key' => 'value', 'key2' => 'value2' },
|
285
|
+
require_interaction: true,
|
286
|
+
icon: { 'url' => 'https://www.urbanairship.com'}
|
287
|
+
)
|
288
|
+
)
|
289
|
+
|
290
|
+
**Example Open Platform Override**
|
291
|
+
|
292
|
+
.. code-block:: ruby
|
293
|
+
|
294
|
+
push.notification = UA.notification(
|
295
|
+
alert: 'Hello World!',
|
296
|
+
open_platforms: {
|
297
|
+
'open::toaster': UA.open_platform(
|
298
|
+
alert: 'Hello Toaster',
|
299
|
+
title: 'My Title',
|
300
|
+
summary: 'My Summary',
|
301
|
+
extra: { 'key' => 'value', 'key2' => 'value2' },
|
302
|
+
media_attachment: 'https://media.giphy.com/media/JYsWwF82EGnpC/giphy.gif',
|
303
|
+
interactive: UA.interactive(
|
304
|
+
type: 'ua_share',
|
305
|
+
button_actions: {
|
306
|
+
share: { share: 'Sharing is caring!' }
|
307
|
+
}
|
308
|
+
)
|
309
|
+
),
|
310
|
+
'open::refrigerator': UA.open_platform(
|
311
|
+
alert: 'Hello Fridge'
|
312
|
+
)
|
313
|
+
}
|
314
|
+
)
|
315
|
+
|
263
316
|
**Example WNS Override**
|
264
317
|
|
265
318
|
.. code-block:: ruby
|
@@ -351,7 +404,7 @@ types you wish to target with a list of strings:
|
|
351
404
|
|
352
405
|
.. code-block:: ruby
|
353
406
|
|
354
|
-
push.device_types = UA.device_types(['ios', 'android'])
|
407
|
+
push.device_types = UA.device_types(['ios', 'android', 'web', 'open::example'])
|
355
408
|
|
356
409
|
or with the ``all`` shortcut.
|
357
410
|
|
data/lib/urbanairship/common.rb
CHANGED
@@ -11,8 +11,6 @@ module Urbanairship
|
|
11
11
|
DEVICE_TOKEN_URL = BASE_URL + '/device_tokens/'
|
12
12
|
APID_URL = BASE_URL + '/apids/'
|
13
13
|
PUSH_URL = BASE_URL + '/push/'
|
14
|
-
DT_FEEDBACK_URL = BASE_URL + '/device_tokens/feedback/'
|
15
|
-
APID_FEEDBACK_URL = BASE_URL + '/apids/feedback/'
|
16
14
|
SCHEDULES_URL = BASE_URL + '/schedules/'
|
17
15
|
SEGMENTS_URL = BASE_URL + '/segments/'
|
18
16
|
NAMED_USER_URL = BASE_URL + '/named_users/'
|
@@ -30,34 +30,6 @@ module Urbanairship
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
class Feedback
|
34
|
-
include Urbanairship::Common
|
35
|
-
include Urbanairship::Loggable
|
36
|
-
|
37
|
-
def initialize(client: required('client'))
|
38
|
-
@client = client
|
39
|
-
end
|
40
|
-
|
41
|
-
def device_token(since: required('device token'))
|
42
|
-
url = DT_FEEDBACK_URL + '?since=' + since
|
43
|
-
get_feedback(url: url)
|
44
|
-
end
|
45
|
-
|
46
|
-
def apid(since: required('since'))
|
47
|
-
url = APID_FEEDBACK_URL + '?since=' + since
|
48
|
-
get_feedback(url: url)
|
49
|
-
end
|
50
|
-
|
51
|
-
def get_feedback(url: required('url'))
|
52
|
-
response = @client.send_request(
|
53
|
-
method: 'GET',
|
54
|
-
url: url
|
55
|
-
)
|
56
|
-
logger.info("Requested feedback at url #{url}")
|
57
|
-
response
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
33
|
class DeviceToken
|
62
34
|
include Urbanairship::Common
|
63
35
|
include Urbanairship::Loggable
|
@@ -87,15 +59,6 @@ module Urbanairship
|
|
87
59
|
@next_page = DEVICE_TOKEN_URL
|
88
60
|
@data_attribute = 'device_tokens'
|
89
61
|
end
|
90
|
-
|
91
|
-
def count
|
92
|
-
resp = @client.send_request(
|
93
|
-
method: 'GET',
|
94
|
-
url: DEVICE_TOKEN_URL + 'count/'
|
95
|
-
)
|
96
|
-
logger.info("Retrieved count of Device Token List.")
|
97
|
-
resp
|
98
|
-
end
|
99
62
|
end
|
100
63
|
|
101
64
|
class APID
|
@@ -13,13 +13,13 @@ module Urbanairship
|
|
13
13
|
@named_user_id = nil
|
14
14
|
end
|
15
15
|
|
16
|
-
def associate(channel_id: required('channel_id'), device_type:
|
16
|
+
def associate(channel_id: required('channel_id'), device_type: nil)
|
17
17
|
fail ArgumentError,
|
18
18
|
'named_user_id is required for association' if @named_user_id.nil?
|
19
19
|
|
20
20
|
payload = {}
|
21
21
|
payload['channel_id'] = channel_id
|
22
|
-
payload['device_type'] = device_type
|
22
|
+
payload['device_type'] = @device_type unless @device_type.nil?
|
23
23
|
payload['named_user_id'] = @named_user_id
|
24
24
|
|
25
25
|
response = @client.send_request(
|
@@ -32,10 +32,10 @@ module Urbanairship
|
|
32
32
|
response
|
33
33
|
end
|
34
34
|
|
35
|
-
def disassociate(channel_id: required('channel_id'), device_type:
|
35
|
+
def disassociate(channel_id: required('channel_id'), device_type: nil)
|
36
36
|
payload = {}
|
37
37
|
payload['channel_id'] = channel_id
|
38
|
-
payload['device_type'] = device_type
|
38
|
+
payload['device_type'] = @device_type unless @device_type.nil?
|
39
39
|
payload['named_user_id'] = @named_user_id unless @named_user_id.nil?
|
40
40
|
response = @client.send_request(
|
41
41
|
method: 'POST',
|
@@ -12,12 +12,12 @@ module Urbanairship
|
|
12
12
|
|
13
13
|
|
14
14
|
# Methods to select a single iOS Channel, Android Channel, Amazon Channel,
|
15
|
-
#
|
15
|
+
# Web Channel, Open Channel, Android APID, or Windows APID respectively.
|
16
16
|
#
|
17
17
|
# @example
|
18
18
|
# ios_channel(<channel>) # ==>
|
19
19
|
# {:ios_channel=>"<channel>"}
|
20
|
-
%w(ios_channel android_channel amazon_channel apid wns).each do |name|
|
20
|
+
%w(ios_channel android_channel amazon_channel channel open_channel apid wns).each do |name|
|
21
21
|
define_method(name) do |uuid|
|
22
22
|
{ name.to_sym => cleanup(uuid) }
|
23
23
|
end
|
@@ -7,16 +7,23 @@ module Urbanairship
|
|
7
7
|
|
8
8
|
# Notification Object for a Push Payload
|
9
9
|
def notification(alert: nil, ios: nil, android: nil, amazon: nil,
|
10
|
-
|
10
|
+
web: nil, wns: nil, open_platforms: nil,
|
11
|
+
actions: nil, interactive: nil)
|
11
12
|
payload = compact_helper({
|
12
13
|
alert: alert,
|
13
|
-
actions: actions,
|
14
14
|
ios: ios,
|
15
15
|
android: android,
|
16
16
|
amazon: amazon,
|
17
|
+
web: web,
|
17
18
|
wns: wns,
|
19
|
+
actions: actions,
|
18
20
|
interactive: interactive
|
19
21
|
})
|
22
|
+
if open_platforms
|
23
|
+
open_platforms.each {|platform, overrides|
|
24
|
+
payload[platform] = overrides
|
25
|
+
}
|
26
|
+
end
|
20
27
|
fail ArgumentError, 'Notification body is empty' if payload.empty?
|
21
28
|
payload
|
22
29
|
end
|
@@ -93,6 +100,17 @@ module Urbanairship
|
|
93
100
|
})
|
94
101
|
end
|
95
102
|
|
103
|
+
# Web Notify specific portion of Push Notification Object
|
104
|
+
def web(alert: nil, title: nil, extra: nil, require_interaction: nil, icon: nil)
|
105
|
+
compact_helper({
|
106
|
+
alert: alert,
|
107
|
+
title: title,
|
108
|
+
extra: extra,
|
109
|
+
require_interaction: require_interaction,
|
110
|
+
icon: icon
|
111
|
+
})
|
112
|
+
end
|
113
|
+
|
96
114
|
# WNS specific portion of Push Notification Object
|
97
115
|
def wns_payload(alert: nil, toast: nil, tile: nil, badge: nil)
|
98
116
|
payload = compact_helper({
|
@@ -105,6 +123,19 @@ module Urbanairship
|
|
105
123
|
payload
|
106
124
|
end
|
107
125
|
|
126
|
+
# Open Platform specific portion of Push Notification Object.
|
127
|
+
def open_platform(alert: nil, title: nil, summary: nil,
|
128
|
+
extra: nil, media_attachment: nil, interactive: nil)
|
129
|
+
compact_helper({
|
130
|
+
alert: alert,
|
131
|
+
title: title,
|
132
|
+
summary: summary,
|
133
|
+
extra: extra,
|
134
|
+
media_attachment: media_attachment,
|
135
|
+
interactive: interactive
|
136
|
+
})
|
137
|
+
end
|
138
|
+
|
108
139
|
# Rich Message specific portion of Push Notification Object
|
109
140
|
def message(title: required('title'), body: required('body'), content_type: nil, content_encoding: nil,
|
110
141
|
extra: nil, expiry: nil, icons: nil, options: nil)
|
data/lib/urbanairship/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: urbanairship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Urban Airship
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: '0'
|
195
195
|
requirements: []
|
196
196
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.
|
197
|
+
rubygems_version: 2.5.2.1
|
198
198
|
signing_key:
|
199
199
|
specification_version: 4
|
200
200
|
summary: Ruby Gem for using the Urban Airship API
|