urbanairship 5.6.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +30 -0
  3. data/README.rst +91 -34
  4. data/docs/ab_tests.rst +162 -0
  5. data/docs/attributes.rst +52 -0
  6. data/docs/automations.rst +212 -0
  7. data/docs/index.rst +3 -0
  8. data/docs/push.rst +24 -0
  9. data/docs/sms.rst +19 -0
  10. data/docs/static_lists.rst +2 -2
  11. data/lib/urbanairship.rb +12 -0
  12. data/lib/urbanairship/ab_tests/ab_test.rb +88 -0
  13. data/lib/urbanairship/ab_tests/experiment.rb +45 -0
  14. data/lib/urbanairship/ab_tests/variant.rb +34 -0
  15. data/lib/urbanairship/automations/automation.rb +105 -0
  16. data/lib/urbanairship/automations/pipeline.rb +52 -0
  17. data/lib/urbanairship/client.rb +32 -10
  18. data/lib/urbanairship/common.rb +108 -42
  19. data/lib/urbanairship/configuration.rb +2 -1
  20. data/lib/urbanairship/custom_events/custom_event.rb +60 -0
  21. data/lib/urbanairship/custom_events/payload.rb +89 -0
  22. data/lib/urbanairship/devices/attribute.rb +54 -0
  23. data/lib/urbanairship/devices/channel_tags.rb +2 -2
  24. data/lib/urbanairship/devices/channel_uninstall.rb +10 -10
  25. data/lib/urbanairship/devices/create_and_send.rb +4 -4
  26. data/lib/urbanairship/devices/devicelist.rb +28 -7
  27. data/lib/urbanairship/devices/email.rb +5 -5
  28. data/lib/urbanairship/devices/named_user.rb +6 -6
  29. data/lib/urbanairship/devices/open_channel.rb +22 -23
  30. data/lib/urbanairship/devices/segment.rb +6 -8
  31. data/lib/urbanairship/devices/sms.rb +40 -9
  32. data/lib/urbanairship/devices/static_lists.rb +12 -12
  33. data/lib/urbanairship/push/location.rb +18 -18
  34. data/lib/urbanairship/push/push.rb +23 -13
  35. data/lib/urbanairship/push/schedule.rb +9 -0
  36. data/lib/urbanairship/reports/response_statistics.rb +42 -31
  37. data/lib/urbanairship/version.rb +1 -1
  38. metadata +16 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65cc3a3fd4338610d0689454dad88addc5529cd5e8011e839360be5ab49146f3
4
- data.tar.gz: af48efa2117b79b9bac9f9c634cff5ce43e572a6eaf46d4d1e940f8678adcaa7
3
+ metadata.gz: fffdb1489ab1f833e816db52d94b9aea7dac527f07bde6507af1dee57f491140
4
+ data.tar.gz: 2255e7731044332f60b883568929e197905a690c45d905d0a75214806163434a
5
5
  SHA512:
6
- metadata.gz: 295d9fc6469ce209e9c2b3a108641089e65993a9e6a54673702d8f7fc97c0204a7ee2b22c2e5fed80985c262ee4690586992d0f57d7ccb8fce98fcaa548b0f53
7
- data.tar.gz: f91849ee2e0b5f0e8cb4e5897058937b71c140bb25de8c283c450e16971dffc3fa996a179804eed2e6bf765817f6efbe5c4f85294ac8de2741bae71f88b2349b
6
+ metadata.gz: c39e8417e51bd08077a8658589cdee0db2639e5e5d60e6de2596aa361e9640f16cb25ff284cfa55da044dd814b1b01001b84bc7b1c1dbcbbdc441c1dab7b6405
7
+ data.tar.gz: 209ebf90c4d266092557e387d0479ccaf8fbd3d07d05f12f78e74186c4fd0c32a00a83b306994c64de9961554cd7eb39b115dc32b5130cc9c2f564553df72eb5
data/CHANGELOG CHANGED
@@ -1,3 +1,33 @@
1
+ --------------------
2
+ 7.0.0
3
+ --------------------
4
+ - Refactors base url naming
5
+
6
+ --------------------
7
+ 6.0.0
8
+ --------------------
9
+ - Creates custom base url, and refactors urls within classes
10
+ - Adds support for sending custom events
11
+
12
+ --------------------
13
+ 5.9.0
14
+ --------------------
15
+ - Adds support for bearer token auth
16
+ - Updates broken code for static lists
17
+ - Adds support for update sms channel
18
+
19
+ --------------------
20
+ 5.8.0
21
+ --------------------
22
+ - Adds scheudling support for PTSO
23
+ - Adds attribute support
24
+
25
+ --------------------
26
+ 5.7.0
27
+ --------------------
28
+ - Adds Automation support
29
+ - Adds A/B test support
30
+
1
31
  --------------------
2
32
  5.6.1
3
33
  --------------------
data/README.rst CHANGED
@@ -38,17 +38,23 @@ Installation
38
38
 
39
39
  If you have the ``bundler`` gem (if not you can get it with
40
40
  ``$ gem install bundler``) add this line to your application's
41
- Gemfile::
41
+ Gemfile:
42
42
 
43
- >>> gem 'urbanairship'
43
+ .. code-block::
44
44
 
45
- And then execute::
45
+ >>> $ gem 'urbanairship'
46
46
 
47
- >>> $ bundle
47
+ And then execute:
48
48
 
49
- OR install it yourself as::
49
+ .. code-block::
50
50
 
51
- >>> gem install urbanairship
51
+ >>> $ bundle
52
+
53
+ OR install it yourself as:
54
+
55
+ .. code-block::
56
+
57
+ >>> $ gem install urbanairship
52
58
 
53
59
 
54
60
  Configuration
@@ -56,27 +62,35 @@ Configuration
56
62
 
57
63
  In your app initialization, you can do something like the following:
58
64
 
59
- >>> require 'urbanairship'
60
- >>> Urbanairship.configure do |config|
61
- >>> config.log_path = '/path/to/your/logfile'
62
- >>> config.log_level = Logger::WARN
63
- >>> config.timeout = 60
64
- >>> end
65
+ .. code-block:: ruby
66
+
67
+ require 'urbanairship'
68
+
69
+ Urbanairship.configure do |config|
70
+ config.server = 'go.airship.eu'
71
+ config.log_path = '/path/to/your/logfile'
72
+ config.log_level = Logger::WARN
73
+ config.timeout = 60
74
+ end
75
+
65
76
 
66
77
  If you want to use a custom logger (e.g Rails.logger), you can do:
67
78
 
68
- >>> require 'urbanairship'
69
- >>> Urbanairship.configure do |config|
70
- >>> config.custom_logger = Rails.logger
71
- >>> config.log_level = Logger::WARN
72
- >>> config.timeout = 60
73
- >>> end
79
+ .. code-block:: ruby
80
+
81
+ require 'urbanairship'
82
+
83
+ Urbanairship.configure do |config|
84
+ config.custom_logger = Rails.logger
85
+ config.log_level = Logger::WARN
86
+ end
74
87
 
75
88
  Available Configurations
76
89
  ------------------------
77
90
 
78
91
  - **log_path**: Allows to define the folder where the log file will be created (the default is nil).
79
92
  - **log_level**: Allows to define the log level and only messages at that level or higher will be printed (the default is INFO).
93
+ - **server**: Allow to define the Airship server you want to use ("go.airship.eu" or "go.urbanairship.com")
80
94
  - **timeout**: Allows to define the request timeout in seconds (the default is 5).
81
95
 
82
96
 
@@ -96,28 +110,71 @@ information.
96
110
  Broadcast to All Devices
97
111
  ------------------------
98
112
 
99
- >>> require 'urbanairship'
100
- >>> UA = Urbanairship
101
- >>> airship = UA::Client.new(key:'application_key', secret:'master_secret')
102
- >>> p = airship.create_push
103
- >>> p.audience = UA.all
104
- >>> p.notification = UA.notification(alert: 'Hello')
105
- >>> p.device_types = UA.all
106
- >>> p.send_push
113
+ .. code-block:: ruby
114
+
115
+ require 'urbanairship'
116
+
117
+ UA = Urbanairship
107
118
 
119
+ airship = UA::Client.new(key:'application_key', secret:'master_secret')
120
+ p = airship.create_push
121
+ p.audience = UA.all
122
+ p.notification = UA.notification(alert: 'Hello')
123
+ p.device_types = UA.all
124
+ p.send_push
108
125
 
109
126
  Simple Tag Push
110
127
  ---------------
111
128
 
112
- >>> require 'urbanairship'
113
- >>> UA = Urbanairship
114
- >>> airship = UA::Client.new(key:'application_key', secret:'master_secret')
115
- >>> p = airship.create_push
116
- >>> p.audience = UA.tag('some_tag')
117
- >>> p.notification = UA.notification(alert: 'Hello')
118
- >>> p.device_types = UA.all
119
- >>> p.send_push
129
+ .. code-block:: ruby
130
+
131
+ require 'urbanairship'
132
+
133
+ UA = Urbanairship
134
+
135
+ airship = UA::Client.new(key:'application_key', secret:'master_secret')
136
+ p = airship.create_push
137
+ p.audience = UA.tag('some_tag')
138
+ p.notification = UA.notification(alert: 'Hello')
139
+ p.device_types = UA.all
140
+ p.send_push
141
+
142
+ Specify the Airship server used to make your requests
143
+ -----------------------------------------------------
144
+ By default, the request will be sent to the 'go.airship.us' server:
145
+
146
+ .. code-block:: ruby
147
+
148
+ require 'urbanairship'
149
+
150
+ Urbanairship::Client.new(key:'application_key', secret:'master_secret')
151
+
152
+ You can change the server globally in the Urbanairship configuration:
153
+
154
+ .. code-block:: ruby
155
+
156
+ require 'urbanairship'
157
+
158
+ Urbanairship.configure do |config|
159
+ config.server = 'go.airship.eu'
160
+ end
161
+
162
+ Urbanairship::Client.new(key:'application_key', secret:'master_secret')
163
+ # request will be sent to the 'go.airship.eu' server
164
+
165
+ Finally, you can change the targeted server on a request basis:
166
+
167
+ .. code-block:: ruby
168
+
169
+ require 'urbanairship'
170
+
171
+ Urbanairship.configure do |config|
172
+ config.server = 'go.airship.eu'
173
+ end
120
174
 
175
+ Urbanairship::Client.new(key:'application_key', secret:'master_secret', server: 'go.airship.us')
176
+ # The Urbanairship configuration is overridden by the client and the
177
+ # request will be sent to the 'go.airship.us' server
121
178
 
122
179
  Contributing
123
180
  ============
data/docs/ab_tests.rst ADDED
@@ -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