urbanairship 9.3.0 → 9.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/docs/email.rst +30 -2
- data/lib/urbanairship/devices/email.rb +48 -3
- data/lib/urbanairship/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 979edbaca3a95cc2b422ae5f1c3fda149f0eccc9b3aada416b26a50dc1e360a6
|
4
|
+
data.tar.gz: 002a4f86ec42e19c23c60f368a3175bd9c789312c43400705989d173b50e8ddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba953bb68f8c20f2c5854447fd95419311ef27c8c898bb9453e35f3d00b6d23cd8febc08e47661f8e1ba50128fcc89d89159a6fefe2c76a7b4ae96a974b78f5
|
7
|
+
data.tar.gz: b59971c8adcd4b59f93b79bc69a1d0adbf35e5c0938729d7f213d8bb7d0f6ae3c000384c3aee604bfadfde94363ecea27942300531b35f4acaed9bd5a082aa5e
|
data/CHANGELOG
CHANGED
data/docs/email.rst
CHANGED
@@ -66,7 +66,6 @@ Update Email Channel
|
|
66
66
|
email_channel.channel_id = '01234567-890a-bcde-f012-3456789abc0'
|
67
67
|
email_channel.type = 'email'
|
68
68
|
email_channel.commercial_opted_in = '2018-10-28T10:34:22'
|
69
|
-
email_channel.address = 'new.name@new.domain.com'
|
70
69
|
email_channel.timezone = 'America/Los_Angeles'
|
71
70
|
email_channel.locale_country = 'US'
|
72
71
|
email_channel.locale_language = 'en'
|
@@ -75,7 +74,36 @@ Update Email Channel
|
|
75
74
|
.. note::
|
76
75
|
|
77
76
|
The only thing required to make a request is the channel_id. However, anything
|
78
|
-
that needs to be updated must also be included.
|
77
|
+
that needs to be updated must also be included. Please note that you cannot
|
78
|
+
update an email address with this method. Please use the replace method instead.
|
79
|
+
|
80
|
+
Replace Email Channel
|
81
|
+
--------------------
|
82
|
+
|
83
|
+
.. code-block:: ruby
|
84
|
+
|
85
|
+
require 'urbanairship'
|
86
|
+
UA = Urbanairship
|
87
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
88
|
+
email_channel = UA::Email.new(client: airship)
|
89
|
+
email_channel.channel_id = '01234567-890a-bcde-f012-3456789abc0'
|
90
|
+
email_channel.address = 'new.name@new.domain.com'
|
91
|
+
email_channel.type = 'email'
|
92
|
+
email_channel.commercial_opted_in = '2018-10-28T10:34:22'
|
93
|
+
email_channel.timezone = 'America/Los_Angeles'
|
94
|
+
email_channel.locale_country = 'US'
|
95
|
+
email_channel.locale_language = 'en'
|
96
|
+
email_channel.update
|
97
|
+
|
98
|
+
.. note::
|
99
|
+
|
100
|
+
This will replace an existing email channel and will do the following actions:
|
101
|
+
|
102
|
+
- Register a new channel
|
103
|
+
- Associate the new email channel with the same user as the source channel
|
104
|
+
- Uninstall the source channel
|
105
|
+
|
106
|
+
Address, Channel ID and type are all required parameters for this method.
|
79
107
|
|
80
108
|
Email Tags
|
81
109
|
----------
|
@@ -7,10 +7,15 @@ module Urbanairship
|
|
7
7
|
include Urbanairship::Common
|
8
8
|
include Urbanairship::Loggable
|
9
9
|
attr_accessor :address,
|
10
|
+
:click_tracking_opted_in,
|
11
|
+
:click_tracking_opted_out,
|
10
12
|
:commercial_opted_in,
|
11
13
|
:commercial_opted_out,
|
12
14
|
:locale_country,
|
13
15
|
:locale_language,
|
16
|
+
:open_tracking_opted_in,
|
17
|
+
:open_tracking_opted_out,
|
18
|
+
:suppression_state,
|
14
19
|
:timezone,
|
15
20
|
:transactional_opted_in,
|
16
21
|
:transactional_opted_out,
|
@@ -27,10 +32,15 @@ module Urbanairship
|
|
27
32
|
payload = {
|
28
33
|
'channel': {
|
29
34
|
'address': address,
|
35
|
+
'click_tracking_opted_in': click_tracking_opted_in,
|
36
|
+
'click_tracking_opted_out': click_tracking_opted_out,
|
30
37
|
'commercial_opted_in': commercial_opted_in,
|
31
38
|
'commercial_opted_out': commercial_opted_out,
|
32
39
|
'locale_country': locale_country,
|
33
40
|
'locale_language': locale_language,
|
41
|
+
'open_tracking_opted_in': open_tracking_opted_in,
|
42
|
+
'open_tracking_opted_out': open_tracking_opted_out,
|
43
|
+
'suppression_state': suppression_state,
|
34
44
|
'timezone': timezone,
|
35
45
|
'transactional_opted_in': transactional_opted_in,
|
36
46
|
'transactional_opted_out': transactional_opted_out,
|
@@ -77,18 +87,19 @@ module Urbanairship
|
|
77
87
|
end
|
78
88
|
|
79
89
|
def update
|
80
|
-
fail ArgumentError, '
|
90
|
+
fail ArgumentError, 'channel_id must be set to update email channel' if channel_id.nil?
|
81
91
|
|
82
92
|
channel_data = {
|
83
93
|
'address': address,
|
84
94
|
'commercial_opted_in': commercial_opted_in,
|
85
95
|
'commercial_opted_out': commercial_opted_out,
|
86
|
-
'
|
96
|
+
'locale_country': locale_country,
|
87
97
|
'locale_language': locale_language,
|
88
98
|
'timezone': timezone,
|
89
99
|
'transactional_opted_in': transactional_opted_in,
|
90
100
|
'transactional_opted_out': transactional_opted_out,
|
91
|
-
'
|
101
|
+
'device_type': type,
|
102
|
+
'suppression_state': suppression_state
|
92
103
|
}.delete_if {|key, value| value.nil?} #this removes the nil key value pairs
|
93
104
|
|
94
105
|
payload = {'channel': channel_data}
|
@@ -102,6 +113,40 @@ module Urbanairship
|
|
102
113
|
logger.info("Updating email channel with address #{@address}")
|
103
114
|
response
|
104
115
|
end
|
116
|
+
|
117
|
+
def replace
|
118
|
+
fail ArgumentError, 'channel_id must be set to update email channel' if channel_id.nil?
|
119
|
+
fail ArgumentError, 'address must be set to update email channel' if address.nil?
|
120
|
+
fail ArgumentError, 'type must be set to update email channel' if type.nil?
|
121
|
+
|
122
|
+
channel_data = {
|
123
|
+
'address': address,
|
124
|
+
'click_tracking_opted_in': click_tracking_opted_in,
|
125
|
+
'click_tracking_opted_out': click_tracking_opted_out,
|
126
|
+
'commercial_opted_in': commercial_opted_in,
|
127
|
+
'commercial_opted_out': commercial_opted_out,
|
128
|
+
'locale_country': locale_country,
|
129
|
+
'locale_language': locale_language,
|
130
|
+
'open_tracking_opted_in': open_tracking_opted_in,
|
131
|
+
'open_tracking_opted_out': open_tracking_opted_out,
|
132
|
+
'suppression_state': suppression_state,
|
133
|
+
'timezone': timezone,
|
134
|
+
'transactional_opted_in': transactional_opted_in,
|
135
|
+
'transactional_opted_out': transactional_opted_out,
|
136
|
+
'type': type
|
137
|
+
}.delete_if {|key, value| value.nil?} #this removes the nil key value pairs
|
138
|
+
|
139
|
+
payload = {'channel': channel_data}
|
140
|
+
|
141
|
+
response = @client.send_request(
|
142
|
+
method: 'POST',
|
143
|
+
path: channel_path('email/replace/' + channel_id),
|
144
|
+
body: JSON.dump(payload),
|
145
|
+
content_type: 'application/json'
|
146
|
+
)
|
147
|
+
logger.info("Replacing email channel with address #{@address}")
|
148
|
+
response
|
149
|
+
end
|
105
150
|
end
|
106
151
|
|
107
152
|
class EmailTags < ChannelTags
|
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: 9.
|
4
|
+
version: 9.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airship
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|