urbanairship 5.5.0 → 5.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 473e83567cb51164c9ed471d2e5ecbd73902624f231fd6463a07d2626d6233a6
4
- data.tar.gz: dd676b778158ed24687223009942bdff1ec105bfc485987767c27f10c6de0344
3
+ metadata.gz: 0e4a3dfc0a925ebcaf22800eabbc1fec1c8c59f5fd52e26f24ca87ff7eec2d5c
4
+ data.tar.gz: 593f328489aaffcfad92e1da6c9a86351aabee461ab408bf94d66a374bef8625
5
5
  SHA512:
6
- metadata.gz: e0ca4c22e57d83a0d89fa0e32ecb19db0f3ffa3b3ff5913b6f4df38df3dd73dc862b5d526cbb9654ff9fa92535dbad29b50cb516a8772ccdcbc50f416cca6068
7
- data.tar.gz: 1ce0f4984b438dd40df90ccc29eeb0e4f10c99ef8a9e2f85a5af601f6ad241aa47586f78c4c2b089e989b0e01f5a595414faae82c1b6643271daf213a7b9a92a
6
+ metadata.gz: 5441fa97e0611f195f39d06022e30fa7a32d55a6d8a6052c0d5f366d97a687f6e789e9de9c4ceebe0f6cc192414cf706a24a0b8572bf4d5b914e147acec94c39
7
+ data.tar.gz: ff5234432140b9cabac03ed2df6ef29d5398f6e8ea886d1a161fc31ee0f0c758bbc10647e736597d8524b43b9d34a1be17887af24f9a9376b1d1b75c11dd196c
data/CHANGELOG CHANGED
@@ -1,3 +1,31 @@
1
+ --------------------
2
+ 5.8.0
3
+ --------------------
4
+ - Adds scheudling support for PTSO
5
+ - Adds attribute support
6
+
7
+ --------------------
8
+ 5.7.0
9
+ --------------------
10
+ - Adds Automation support
11
+ - Adds A/B test support
12
+
13
+ --------------------
14
+ 5.6.1
15
+ --------------------
16
+ - Updates EmailNotification templating
17
+
18
+ --------------------
19
+ 5.6.0
20
+ --------------------
21
+ - Refactors EmailNotification class
22
+ - Adds Create and Send implementation to Open Channel class
23
+
24
+ --------------------
25
+ 5.5.1
26
+ --------------------
27
+ - Updates validate_url method
28
+
1
29
  --------------------
2
30
  5.5.0
3
31
  --------------------
@@ -0,0 +1,162 @@
1
+ A/B Tests
2
+ =========
3
+
4
+ In this client, we format A/B tests with three nesting components. The first is the Variant,
5
+ the difference between one kind of push and another. The Variant is a part of the Experiment
6
+ object, with many variants in an array. Lastly. AbTest handles what Experiments along with their Variants
7
+ get sent to the various API endpoints. Basic pushes can be added straight to the Variant object
8
+ on the push instance variable, or a Push object can be created, and the payload applied to the
9
+ Variant object. For more information on this please visit: https://docs.airship.com/api/ua/#tag/a/b-tests
10
+
11
+ List Existing A/B Tests
12
+ -----------------------
13
+
14
+ This endpoint will return the existing A/B tests on a project.
15
+
16
+ .. code-block:: ruby
17
+
18
+ require 'urbanairship'
19
+ UA = Urbanairship
20
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
21
+ ab_test = UA::AbTest.new(client: airship)
22
+ ab_test.limit = 5
23
+ ab_test.list_ab_test
24
+
25
+ .. note::
26
+
27
+ Should return a 200 HTTP status code as well as a list of existing A/B tests with a
28
+ default offset and a limit of 5. The limit and offset are optional here.
29
+
30
+ Create A/B Test
31
+ ----------------
32
+
33
+ As described above, the creation of an A/B Test consists of creating a few objects, grabbing
34
+ pertinent data out of them, and creating an A/B Test that is as complicated or as simple as you
35
+ like. In some cases, it might be easier to assign the payload values yourself, but as pushes,
36
+ and the tests themselves get more complicated, it is easier to let the objects do the work for you.
37
+
38
+
39
+ .. code-block:: ruby
40
+
41
+ require 'urbanairship'
42
+ UA = Urbanairship
43
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
44
+ variant_one = UA::Variant.new(client: airship)
45
+ variant_one.push = {
46
+ "notification": {
47
+ "alert": "I love cereal"
48
+ }
49
+ }
50
+ variant_two = UA::Variant.new(client: airship)
51
+ variant_two.push = {
52
+ "notification": {
53
+ "alert": "I prefer oatmeal"
54
+ }
55
+ }
56
+ experiment = UA::Experiment.new(client: airship)
57
+ experiment.name = 'Neat experiment'
58
+ experiment.description = 'See how neat we can get'
59
+ experiment.audience = 'all'
60
+ experiment.device_types = 'all'
61
+ experiment.variants << variant_one.payload
62
+ experiment.variants << variant_two.payload
63
+ ab_test = UA::AbTest.new(client: airship)
64
+ ab_test.experiment_object = experiment.payload
65
+ ab_test.create_ab_test
66
+
67
+ .. note::
68
+
69
+ Should return a 201 HTTP status code as well as other information detailing specific
70
+ information (such as push_id) for the newly created A/B Test.
71
+
72
+ List Scheduled A/B Tests
73
+ ------------------------
74
+
75
+ This will list all the scheduled A/B Tests for a project.
76
+
77
+ .. code-block:: ruby
78
+
79
+ require 'urbanairship'
80
+ UA = Urbanairship
81
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
82
+ ab_test = UA::AbTest.new(client: airship)
83
+ ab_test.list_scheduled_ab_test
84
+
85
+ .. note::
86
+
87
+ Should return a 200 HTTP status code. Here, you can also apply limit and offset by assigning
88
+ values to the instance variables on the AbTest object.
89
+
90
+ Delete A/B Test
91
+ ----------------
92
+
93
+ This will delete an A/B Test with a given experiment ID.
94
+
95
+ .. code-block:: ruby
96
+
97
+ require 'urbanairship'
98
+ UA = Urbanairship
99
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
100
+ ab_test = UA::AbTest.new(client: airship)
101
+ ab_test.experiment_id = '<experiment_id>'
102
+ ab_test.delete_ab_test
103
+
104
+ .. note::
105
+
106
+ Response should be a 200 HTTP Response
107
+
108
+ Validate A/B Test
109
+ ------------------
110
+
111
+ Very similar to the create A/B Test endpoint, this will validate an A/B Test to
112
+ see if it is formatted properly.
113
+
114
+ .. code-block:: ruby
115
+
116
+ require 'urbanairship'
117
+ UA = Urbanairship
118
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
119
+ variant_one = UA::Variant.new(client: airship)
120
+ variant_one.push = {
121
+ "notification": {
122
+ "alert": "I love cereal"
123
+ }
124
+ }
125
+ variant_two = UA::Variant.new(client: airship)
126
+ variant_two.push = {
127
+ "notification": {
128
+ "alert": "I prefer oatmeal"
129
+ }
130
+ }
131
+ experiment = UA::Experiment.new(client: airship)
132
+ experiment.name = 'Neat experiment'
133
+ experiment.description = 'See how neat we can get'
134
+ experiment.audience = 'all'
135
+ experiment.device_types = 'all'
136
+ experiment.variants << variant_one.payload
137
+ experiment.variants << variant_two.payload
138
+ ab_test = UA::AbTest.new(client: airship)
139
+ ab_test.experiment_object = experiment.payload
140
+ ab_test.validate_ab_test
141
+
142
+ .. note::
143
+
144
+ Should return a 200 HTTP status code.
145
+
146
+ Individual A/B Test Lookup
147
+ --------------------------
148
+
149
+ This will lookup a specific A/B Test with a given experiment_id
150
+
151
+ .. code-block:: ruby
152
+
153
+ require 'urbanairship'
154
+ UA = Urbanairship
155
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
156
+ ab_test = UA::AbTest.new(client: airship)
157
+ ab_test.experiment_id = '<experiment_id>'
158
+ ab_test.lookup_ab_test
159
+
160
+ .. note::
161
+
162
+ Should return a 200 HTTP status code
@@ -0,0 +1,52 @@
1
+ Attributes
2
+ ==========
3
+
4
+ Set Attribute for a Channel
5
+ ---------------------------
6
+
7
+ The following will set an attribute for a given channel ID.
8
+
9
+ .. code-block:: ruby
10
+
11
+ require 'urbanairship'
12
+ UA = Urbanairship
13
+ airship = UA::Client.new(key:'app_key', secret:'secret_key')
14
+ channel_info = UA::ChannelInfo.new(client: airship)
15
+ channel_info.audience = {"ios_channel": "b8f9b663-0a3b-cf45-587a-be880946e881"}
16
+ channel_info.attributes = {
17
+ "action": "set",
18
+ "key": "favorite_food",
19
+ "value": "cake"
20
+ }
21
+ channel_info.set_attributes
22
+
23
+ .. note::
24
+
25
+ This should return a 200 response
26
+
27
+ Send Push to Audience with Attribute Specifications
28
+ ---------------------------------------------------
29
+
30
+ This will send a push to an audience who meet the specifications of attribute we
31
+ set here. This example is using a text attribute where we are looking for audience
32
+ members whose favorite food includes 'apple'. Some examples of what this could return
33
+ would be 'apple', 'pineapple', or 'apple pie'.
34
+
35
+ .. code-block:: ruby
36
+
37
+ require 'urbanairship'
38
+ UA = Urbanairship
39
+ airship = UA::Client.new(key:'app_key', secret:'secret_key')
40
+ new_attribute = UA::Attribute.new(client: airship)
41
+ new_attribute.attribute = 'favorite_food'
42
+ new_attribute.operator = 'contains'
43
+ new_attribute.value = 'apple'
44
+ push = airship.create_push
45
+ push.audience = new_attribute.payload
46
+ push.notification = UA.notification(alert: 'Hello')
47
+ push.device_types = ['android', 'ios', 'web']
48
+ push.send_push
49
+
50
+ .. note::
51
+
52
+ This should return a 202 response
@@ -0,0 +1,212 @@
1
+ Automations
2
+ ===========
3
+
4
+ The Automation class harnesses the Pipeline class in order to provide functionality
5
+ for creating, listing, validating, updating, and deleting pipelines. There are a lot
6
+ of moving parts that go into creating a pipeline, so please view our docs on that
7
+ topic here: https://docs.airship.com/api/ua/#schemas%2fpipelineobject
8
+
9
+ List Existing Automations
10
+ -------------------------
11
+
12
+ This is for viewing existing pipeleines for a project. There are optional parameters
13
+ that can be passed into the URI to have control over what pipelines are returned. In the
14
+ following example a limit query of 5 will be added to the URI.
15
+
16
+ .. code-block:: ruby
17
+
18
+ require 'urbanairship'
19
+ UA = Urbanairship
20
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
21
+ automation = UA::Automation.new(client: airship)
22
+ automation.limit = 5
23
+ automation.list_automations
24
+
25
+ .. note::
26
+
27
+ Should return a 200 HTTP status code, and 5 of the most recent Automations
28
+
29
+ Create Automation
30
+ -----------------
31
+
32
+ This will use the Pipeline model to create an automation. You may add several
33
+ pipelines objects to create several automations/pipelines at once. The example
34
+ below adds two. If you would like to just add one pipeline, forgo the array,
35
+ and assign the pipeline payload directly to automation.pipeline_object.
36
+
37
+ .. code-block:: ruby
38
+
39
+ require 'urbanairship'
40
+ UA = Urbanairship
41
+ airship = UA::Client.new(key:'<app_key>', secret:'<app_secret>')
42
+ pipeline_one = UA::Pipeline.new(client: airship)
43
+ pipeline_one.enabled = true
44
+ pipeline_one.immediate_trigger = {
45
+ "tag_added": {
46
+ "tag": "new_customer",
47
+ "group": "crm"
48
+ }
49
+ }
50
+ pipeline_one.outcome = {
51
+ "push": {
52
+ "audience": "triggered",
53
+ "device_types": "all",
54
+ "notification": {
55
+ "alert": "Hello new customer!"
56
+ }
57
+ }
58
+ }
59
+ pipeline_two = UA::Pipeline.new(client: airship)
60
+ pipeline_two.enabled = true
61
+ pipeline_two.immediate_trigger = {
62
+ "tag_added": {
63
+ "tag": "new_customer",
64
+ "group": "crm"
65
+ }
66
+ }
67
+ pipeline_two.outcome = {
68
+ "push": {
69
+ "audience": "triggered",
70
+ "device_types": "all",
71
+ "notification": {
72
+ "alert": "Here is a different second alert!"
73
+ }
74
+ }
75
+ }
76
+ pipelines = [pipeline_one.payload, pipeline_two.payload]
77
+ automation = UA::Automation.new(client: airship)
78
+ automation.pipeline_object = pipelines
79
+ automation.create_automation
80
+
81
+ .. note::
82
+
83
+ Should return a 201 HTTP status code.
84
+
85
+ List Deleted Automations
86
+ ------------------------
87
+
88
+ This is for viewing deleted pipeleines for a project. The optional param here is for "start";
89
+ a timestamp of the starting element for paginating results in the format of YYYY-MM-DD.
90
+
91
+ .. code-block:: ruby
92
+
93
+ require 'urbanairship'
94
+ UA = Urbanairship
95
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
96
+ automation = UA::Automation.new(client: airship)
97
+ automation.start = 2020-02-20
98
+ automation.list_deleted_automations
99
+
100
+ .. note::
101
+
102
+ Should return a 200 HTTP status code, and the deleted automations from either most current
103
+ or from a given start date.
104
+
105
+ Validate Automation
106
+ -------------------
107
+
108
+ This endpoint is a lot like the create automation endpoint, the basic set up is the same,
109
+ only difference here is the method selected.
110
+
111
+ .. code-block:: ruby
112
+
113
+ require 'urbanairship'
114
+ UA = Urbanairship
115
+ airship = UA::Client.new(key:'<app_key>', secret:'<app_secret>')
116
+ pipeline = UA::Pipeline.new(client: airship)
117
+ pipeline.enabled = true
118
+ pipeline.immediate_trigger = {
119
+ "tag_added": {
120
+ "tag": "new_customer",
121
+ "group": "crm"
122
+ }
123
+ }
124
+ pipeline.outcome = {
125
+ "push": {
126
+ "audience": "triggered",
127
+ "device_types": "all",
128
+ "notification": {
129
+ "alert": "Hello new customer!"
130
+ }
131
+ }
132
+ }
133
+ automation = UA::Automation.new(client: airship)
134
+ automation.pipeline_object = pipeline.payload
135
+ automation.validate_automation
136
+
137
+ .. note::
138
+
139
+ Should return a 200 HTTP status code.
140
+
141
+ Individual Automation Lookup
142
+ ----------------------------
143
+
144
+ This is for looking up a single automation with a given ID.
145
+
146
+ .. code-block:: ruby
147
+
148
+ require 'urbanairship'
149
+ UA = Urbanairship
150
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
151
+ automation = UA::Automation.new(client: airship)
152
+ automation.pipeline_id = '86ad9239-373d-d0a5-d5d8-04fed18f79bc'
153
+ automation.lookup_automation
154
+
155
+ .. note::
156
+
157
+ Should return a 200 HTTP status code, and the payload for the automation in question.
158
+
159
+ Update Automation
160
+ -----------------
161
+
162
+ This is for updating an existing automation. You must include the full payload from a POST
163
+ response, with the updates that you want to make within the payload.
164
+
165
+ .. code-block:: ruby
166
+
167
+ require 'urbanairship'
168
+ UA = Urbanairship
169
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
170
+ pipeline = UA::Pipeline.new(client: airship)
171
+ pipeline.enabled = true
172
+ pipeline.immediate_trigger = {
173
+ "tag_added": {
174
+ "tag": "new_tag_update",
175
+ "group": "Locale"
176
+ }
177
+ }
178
+ pipeline.outcome = {
179
+ "push": {
180
+ "audience": "triggered",
181
+ "device_types": "all",
182
+ "notification": {
183
+ "alert": "Newly created alert message!"
184
+ }
185
+ }
186
+ }
187
+ automation = UA::Automation.new(client: airship)
188
+ automation.pipeline_id = '0f927674-918c-31ef-51ca-e96fdd234da4'
189
+ automation.pipeline_object = pipeline.payload
190
+ automation.update_automation
191
+
192
+ .. note::
193
+
194
+ Should return a 200 HTTP status code.
195
+
196
+ Delete Automation
197
+ -----------------
198
+
199
+ This is for deleting a pipeline with a given ID.
200
+
201
+ .. code-block:: ruby
202
+
203
+ require 'urbanairship'
204
+ UA = Urbanairship
205
+ airship = UA::Client.new(key:'<app_key>', secret:'<secret_key>')
206
+ automation = UA::Automation.new(client: airship)
207
+ automation.pipeline_id = '86ad9239-373d-d0a5-d5d8-04fed18f79bc'
208
+ automation.delete_automation
209
+
210
+ .. note::
211
+
212
+ Response should be a 204 No Content