urbanairship 5.4.0 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG +30 -0
- data/docs/ab_tests.rst +162 -0
- data/docs/automations.rst +212 -0
- data/docs/create_and_send.rst +551 -0
- data/docs/examples.rst +8 -8
- data/docs/index.rst +4 -0
- data/lib/urbanairship.rb +11 -0
- data/lib/urbanairship/ab_tests/ab_test.rb +89 -0
- data/lib/urbanairship/ab_tests/experiment.rb +45 -0
- data/lib/urbanairship/ab_tests/variant.rb +34 -0
- data/lib/urbanairship/automations/automation.rb +105 -0
- data/lib/urbanairship/automations/pipeline.rb +52 -0
- data/lib/urbanairship/common.rb +2 -0
- data/lib/urbanairship/devices/create_and_send.rb +96 -0
- data/lib/urbanairship/devices/email.rb +30 -40
- data/lib/urbanairship/devices/email_notification.rb +92 -0
- data/lib/urbanairship/devices/mms_notification.rb +107 -0
- data/lib/urbanairship/devices/open_channel.rb +89 -44
- data/lib/urbanairship/devices/segment.rb +6 -9
- data/lib/urbanairship/devices/sms.rb +15 -18
- data/lib/urbanairship/devices/sms_notification.rb +54 -0
- data/lib/urbanairship/devices/static_lists.rb +6 -7
- data/lib/urbanairship/push/push.rb +19 -9
- data/lib/urbanairship/version.rb +1 -1
- data/urbanairship.gemspec +1 -1
- metadata +19 -7
@@ -12,9 +12,6 @@ module Urbanairship
|
|
12
12
|
|
13
13
|
def initialize(client: required('client'))
|
14
14
|
@client = client
|
15
|
-
@display_name = nil
|
16
|
-
@criteria = nil
|
17
|
-
@id = nil
|
18
15
|
end
|
19
16
|
|
20
17
|
# Build a Segment from the display_name and criteria attributes
|
@@ -25,8 +22,8 @@ module Urbanairship
|
|
25
22
|
fail ArgumentError,
|
26
23
|
'Both display_name and criteria must be set to a value' if display_name.nil? or criteria.nil?
|
27
24
|
payload = {
|
28
|
-
:
|
29
|
-
:
|
25
|
+
'display_name': display_name,
|
26
|
+
'criteria': criteria
|
30
27
|
}
|
31
28
|
response = @client.send_request(
|
32
29
|
method: 'POST',
|
@@ -67,8 +64,8 @@ module Urbanairship
|
|
67
64
|
'Either display_name or criteria must be set to a value' if display_name.nil? and criteria.nil?
|
68
65
|
|
69
66
|
data = {}
|
70
|
-
data['display_name'] =
|
71
|
-
data['criteria'] =
|
67
|
+
data['display_name'] = display_name
|
68
|
+
data['criteria'] = criteria
|
72
69
|
response = @client.send_request(
|
73
70
|
method: 'PUT',
|
74
71
|
body: JSON.dump(data),
|
@@ -84,9 +81,9 @@ module Urbanairship
|
|
84
81
|
# @ returns [Object] response HTTP response
|
85
82
|
def delete
|
86
83
|
fail ArgumentError,
|
87
|
-
'id cannot be nil' if
|
84
|
+
'id cannot be nil' if id.nil?
|
88
85
|
|
89
|
-
url = SEGMENTS_URL +
|
86
|
+
url = SEGMENTS_URL + id
|
90
87
|
response = @client.send_request(
|
91
88
|
method: 'DELETE',
|
92
89
|
url: url
|
@@ -9,19 +9,16 @@ module Urbanairship
|
|
9
9
|
|
10
10
|
def initialize(client: required('client'))
|
11
11
|
@client = client
|
12
|
-
@sender = nil
|
13
|
-
@msisdn = nil
|
14
|
-
@opted_in = nil
|
15
12
|
end
|
16
13
|
|
17
14
|
def register
|
18
|
-
fail ArgumentError, 'sender must be set to register sms channel' if
|
19
|
-
fail ArgumentError, 'msisdn must be set to register sms channel' if
|
15
|
+
fail ArgumentError, 'sender must be set to register sms channel' if sender.nil?
|
16
|
+
fail ArgumentError, 'msisdn must be set to register sms channel' if msisdn.nil?
|
20
17
|
|
21
18
|
payload = {
|
22
|
-
'msisdn':
|
23
|
-
'sender':
|
24
|
-
'opted_in':
|
19
|
+
'msisdn': msisdn,
|
20
|
+
'sender': sender,
|
21
|
+
'opted_in': opted_in
|
25
22
|
}
|
26
23
|
|
27
24
|
response = @client.send_request(
|
@@ -35,12 +32,12 @@ module Urbanairship
|
|
35
32
|
end
|
36
33
|
|
37
34
|
def opt_out
|
38
|
-
fail ArgumentError, 'sender must be set to register sms channel' if
|
39
|
-
fail ArgumentError, 'msisdn must be set to register sms channel' if
|
35
|
+
fail ArgumentError, 'sender must be set to register sms channel' if sender.nil?
|
36
|
+
fail ArgumentError, 'msisdn must be set to register sms channel' if msisdn.nil?
|
40
37
|
|
41
38
|
payload = {
|
42
|
-
'msisdn':
|
43
|
-
'sender':
|
39
|
+
'msisdn': msisdn,
|
40
|
+
'sender': sender,
|
44
41
|
}
|
45
42
|
|
46
43
|
response = @client.send_request(
|
@@ -54,12 +51,12 @@ module Urbanairship
|
|
54
51
|
end
|
55
52
|
|
56
53
|
def uninstall
|
57
|
-
fail ArgumentError, 'sender must be set to register sms channel' if
|
58
|
-
fail ArgumentError, 'msisdn must be set to register sms channel' if
|
54
|
+
fail ArgumentError, 'sender must be set to register sms channel' if sender.nil?
|
55
|
+
fail ArgumentError, 'msisdn must be set to register sms channel' if msisdn.nil?
|
59
56
|
|
60
57
|
payload = {
|
61
|
-
'msisdn':
|
62
|
-
'sender':
|
58
|
+
'msisdn': msisdn,
|
59
|
+
'sender': sender,
|
63
60
|
}
|
64
61
|
|
65
62
|
response = @client.send_request(
|
@@ -73,8 +70,8 @@ module Urbanairship
|
|
73
70
|
end
|
74
71
|
|
75
72
|
def lookup
|
76
|
-
fail ArgumentError,'msisdn is required for lookup' if
|
77
|
-
fail ArgumentError,'sender is required for lookup' if
|
73
|
+
fail ArgumentError,'msisdn is required for lookup' if msisdn.nil?
|
74
|
+
fail ArgumentError,'sender is required for lookup' if sender.nil?
|
78
75
|
|
79
76
|
response = @client.send_request(
|
80
77
|
method: 'GET',
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'urbanairship'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Urbanairship
|
5
|
+
module Devices
|
6
|
+
class SmsNotification
|
7
|
+
include Urbanairship::Common
|
8
|
+
include Urbanairship::Loggable
|
9
|
+
|
10
|
+
attr_accessor :sms_alert,
|
11
|
+
:generic_alert,
|
12
|
+
:expiry,
|
13
|
+
:shorten_links,
|
14
|
+
:template_id
|
15
|
+
|
16
|
+
def initialize(client: required('client'))
|
17
|
+
@client = client
|
18
|
+
end
|
19
|
+
|
20
|
+
def sms_notification_override
|
21
|
+
{
|
22
|
+
"alert": generic_alert,
|
23
|
+
"sms": {
|
24
|
+
"alert": sms_alert,
|
25
|
+
"expiry": expiry,
|
26
|
+
"shorten_links": shorten_links
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def sms_inline_template
|
32
|
+
inline_template = {
|
33
|
+
"sms": {
|
34
|
+
"template": {}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
if @template_id
|
39
|
+
inline_template[:sms][:template][:template_id] = @template_id
|
40
|
+
end
|
41
|
+
|
42
|
+
if @sms_alert
|
43
|
+
inline_fields= {
|
44
|
+
"fields": {"alert": @sms_alert}
|
45
|
+
}
|
46
|
+
inline_template[:sms][:template] = inline_fields
|
47
|
+
end
|
48
|
+
|
49
|
+
inline_template
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -11,12 +11,11 @@ module Urbanairship
|
|
11
11
|
def initialize(client: required('client'))
|
12
12
|
fail ArgumentError, 'Client cannot be set to nil' if client.nil?
|
13
13
|
@client = client
|
14
|
-
@name = nil
|
15
14
|
end
|
16
15
|
|
17
16
|
def create(description: nil, extras: nil)
|
18
|
-
fail ArgumentError, 'Name must be set' if
|
19
|
-
payload = {'name'
|
17
|
+
fail ArgumentError, 'Name must be set' if name.nil?
|
18
|
+
payload = {'name': name}
|
20
19
|
payload['description'] = description unless description.nil?
|
21
20
|
payload['extras'] = extras unless extras.nil?
|
22
21
|
|
@@ -31,7 +30,7 @@ module Urbanairship
|
|
31
30
|
end
|
32
31
|
|
33
32
|
def upload(csv_file: required('csv_file'), gzip: false)
|
34
|
-
fail ArgumentError, 'Name must be set' if
|
33
|
+
fail ArgumentError, 'Name must be set' if name.nil?
|
35
34
|
if gzip
|
36
35
|
response = @client.send_request(
|
37
36
|
method: 'PUT',
|
@@ -53,7 +52,7 @@ module Urbanairship
|
|
53
52
|
end
|
54
53
|
|
55
54
|
def update(description: nil, extras: nil)
|
56
|
-
fail ArgumentError, 'Name must be set' if
|
55
|
+
fail ArgumentError, 'Name must be set' if name.nil?
|
57
56
|
fail ArgumentError,
|
58
57
|
'Either description or extras must be set to a value' if description.nil? and extras.nil?
|
59
58
|
payload = {}
|
@@ -70,7 +69,7 @@ module Urbanairship
|
|
70
69
|
end
|
71
70
|
|
72
71
|
def lookup
|
73
|
-
fail ArgumentError, 'Name must be set' if
|
72
|
+
fail ArgumentError, 'Name must be set' if name.nil?
|
74
73
|
response = @client.send_request(
|
75
74
|
method: 'GET',
|
76
75
|
url: LISTS_URL + @name
|
@@ -80,7 +79,7 @@ module Urbanairship
|
|
80
79
|
end
|
81
80
|
|
82
81
|
def delete
|
83
|
-
fail ArgumentError, 'Name must be set' if
|
82
|
+
fail ArgumentError, 'Name must be set' if name.nil?
|
84
83
|
response = @client.send_request(
|
85
84
|
method: 'DELETE',
|
86
85
|
url: LISTS_URL + @name
|
@@ -8,9 +8,17 @@ module Urbanairship
|
|
8
8
|
|
9
9
|
# A Push Notification.
|
10
10
|
class Push
|
11
|
-
attr_writer :client
|
12
|
-
|
13
|
-
|
11
|
+
attr_writer :client
|
12
|
+
|
13
|
+
attr_accessor :device_types,
|
14
|
+
:audience,
|
15
|
+
:notification,
|
16
|
+
:options,
|
17
|
+
:message,
|
18
|
+
:in_app,
|
19
|
+
:campaigns,
|
20
|
+
:localizations
|
21
|
+
|
14
22
|
include Urbanairship::Common
|
15
23
|
include Urbanairship::Loggable
|
16
24
|
|
@@ -23,12 +31,14 @@ module Urbanairship
|
|
23
31
|
|
24
32
|
def payload
|
25
33
|
compact_helper({
|
26
|
-
audience:
|
27
|
-
notification:
|
28
|
-
options:
|
29
|
-
device_types:
|
30
|
-
message:
|
31
|
-
in_app:
|
34
|
+
audience: audience,
|
35
|
+
notification: notification,
|
36
|
+
options: options,
|
37
|
+
device_types: device_types,
|
38
|
+
message: message,
|
39
|
+
in_app: in_app,
|
40
|
+
campaigns: campaigns,
|
41
|
+
localizations: localizations
|
32
42
|
})
|
33
43
|
end
|
34
44
|
|
data/lib/urbanairship/version.rb
CHANGED
data/urbanairship.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'bundler', '>= 1'
|
33
33
|
spec.add_development_dependency 'guard-rspec'
|
34
34
|
spec.add_development_dependency 'pry', '~> 0'
|
35
|
-
spec.add_development_dependency 'rake', '~>
|
35
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
36
36
|
spec.add_development_dependency 'rspec', '~> 3'
|
37
37
|
spec.add_development_dependency 'terminal-notifier-guard', '~> 1'
|
38
38
|
end
|
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: 5.
|
4
|
+
version: 5.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airship
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 12.3.3
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 12.3.3
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,8 +138,11 @@ files:
|
|
138
138
|
- bin/console
|
139
139
|
- bin/setup
|
140
140
|
- docs/Makefile
|
141
|
+
- docs/ab_tests.rst
|
142
|
+
- docs/automations.rst
|
141
143
|
- docs/channel_uninstall.rst
|
142
144
|
- docs/conf.py
|
145
|
+
- docs/create_and_send.rst
|
143
146
|
- docs/devices.rst
|
144
147
|
- docs/email.rst
|
145
148
|
- docs/examples.rst
|
@@ -156,17 +159,26 @@ files:
|
|
156
159
|
- docs/tags.rst
|
157
160
|
- example/pusher.rb
|
158
161
|
- lib/urbanairship.rb
|
162
|
+
- lib/urbanairship/ab_tests/ab_test.rb
|
163
|
+
- lib/urbanairship/ab_tests/experiment.rb
|
164
|
+
- lib/urbanairship/ab_tests/variant.rb
|
165
|
+
- lib/urbanairship/automations/automation.rb
|
166
|
+
- lib/urbanairship/automations/pipeline.rb
|
159
167
|
- lib/urbanairship/client.rb
|
160
168
|
- lib/urbanairship/common.rb
|
161
169
|
- lib/urbanairship/configuration.rb
|
162
170
|
- lib/urbanairship/devices/channel_tags.rb
|
163
171
|
- lib/urbanairship/devices/channel_uninstall.rb
|
172
|
+
- lib/urbanairship/devices/create_and_send.rb
|
164
173
|
- lib/urbanairship/devices/devicelist.rb
|
165
174
|
- lib/urbanairship/devices/email.rb
|
175
|
+
- lib/urbanairship/devices/email_notification.rb
|
176
|
+
- lib/urbanairship/devices/mms_notification.rb
|
166
177
|
- lib/urbanairship/devices/named_user.rb
|
167
178
|
- lib/urbanairship/devices/open_channel.rb
|
168
179
|
- lib/urbanairship/devices/segment.rb
|
169
180
|
- lib/urbanairship/devices/sms.rb
|
181
|
+
- lib/urbanairship/devices/sms_notification.rb
|
170
182
|
- lib/urbanairship/devices/static_lists.rb
|
171
183
|
- lib/urbanairship/loggable.rb
|
172
184
|
- lib/urbanairship/push/audience.rb
|
@@ -183,7 +195,7 @@ licenses:
|
|
183
195
|
- Apache-2.0
|
184
196
|
metadata:
|
185
197
|
allowed_push_host: https://rubygems.org
|
186
|
-
post_install_message:
|
198
|
+
post_install_message:
|
187
199
|
rdoc_options: []
|
188
200
|
require_paths:
|
189
201
|
- lib
|
@@ -199,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
211
|
version: '0'
|
200
212
|
requirements: []
|
201
213
|
rubygems_version: 3.0.1
|
202
|
-
signing_key:
|
214
|
+
signing_key:
|
203
215
|
specification_version: 4
|
204
216
|
summary: Ruby Gem for using the Airship API
|
205
217
|
test_files: []
|