urbanairship 5.2.0 → 9.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +1 -1
  3. data/.github/ISSUE_TEMPLATE.md +2 -2
  4. data/.github/PULL_REQUEST_TEMPLATE.md +9 -4
  5. data/.github/SUPPORT.md +3 -3
  6. data/.github/workflows/ci.yaml +26 -0
  7. data/.github/workflows/release.yaml +30 -0
  8. data/.gitignore +2 -0
  9. data/CHANGELOG +198 -51
  10. data/LICENSE +1 -1
  11. data/README.rst +159 -57
  12. data/docs/ab_tests.rst +162 -0
  13. data/docs/attributes.rst +73 -0
  14. data/docs/automations.rst +212 -0
  15. data/docs/channel_uninstall.rst +1 -1
  16. data/docs/conf.py +11 -6
  17. data/docs/create_and_send.rst +551 -0
  18. data/docs/devices.rst +1 -1
  19. data/docs/examples.rst +10 -10
  20. data/docs/index.rst +23 -19
  21. data/docs/named_user.rst +27 -5
  22. data/docs/push.rst +37 -18
  23. data/docs/reports.rst +9 -9
  24. data/docs/segment.rst +5 -5
  25. data/docs/sms.rst +19 -0
  26. data/docs/static_lists.rst +4 -4
  27. data/docs/tag_lists.rst +76 -0
  28. data/docs/tags.rst +1 -1
  29. data/example/pusher.rb +3 -7
  30. data/lib/urbanairship/ab_tests/ab_test.rb +88 -0
  31. data/lib/urbanairship/ab_tests/experiment.rb +45 -0
  32. data/lib/urbanairship/ab_tests/variant.rb +34 -0
  33. data/lib/urbanairship/automations/automation.rb +105 -0
  34. data/lib/urbanairship/automations/pipeline.rb +52 -0
  35. data/lib/urbanairship/client.rb +57 -14
  36. data/lib/urbanairship/common.rb +110 -41
  37. data/lib/urbanairship/configuration.rb +3 -1
  38. data/lib/urbanairship/custom_events/custom_event.rb +60 -0
  39. data/lib/urbanairship/custom_events/payload.rb +89 -0
  40. data/lib/urbanairship/devices/attribute.rb +54 -0
  41. data/lib/urbanairship/devices/attributes.rb +53 -0
  42. data/lib/urbanairship/devices/channel_tags.rb +2 -2
  43. data/lib/urbanairship/devices/channel_uninstall.rb +10 -10
  44. data/lib/urbanairship/devices/create_and_send.rb +96 -0
  45. data/lib/urbanairship/devices/devicelist.rb +28 -7
  46. data/lib/urbanairship/devices/email.rb +33 -43
  47. data/lib/urbanairship/devices/email_notification.rb +92 -0
  48. data/lib/urbanairship/devices/mms_notification.rb +107 -0
  49. data/lib/urbanairship/devices/named_user.rb +22 -12
  50. data/lib/urbanairship/devices/open_channel.rb +105 -61
  51. data/lib/urbanairship/devices/segment.rb +10 -15
  52. data/lib/urbanairship/devices/sms.rb +51 -23
  53. data/lib/urbanairship/devices/sms_notification.rb +54 -0
  54. data/lib/urbanairship/devices/static_lists.rb +18 -19
  55. data/lib/urbanairship/devices/tag_lists.rb +82 -0
  56. data/lib/urbanairship/oauth.rb +129 -0
  57. data/lib/urbanairship/push/audience.rb +0 -61
  58. data/lib/urbanairship/push/payload.rb +78 -8
  59. data/lib/urbanairship/push/push.rb +23 -13
  60. data/lib/urbanairship/push/schedule.rb +9 -0
  61. data/lib/urbanairship/reports/response_statistics.rb +42 -31
  62. data/lib/urbanairship/version.rb +1 -1
  63. data/lib/urbanairship.rb +20 -1
  64. data/urbanairship.gemspec +8 -6
  65. metadata +74 -15
  66. data/.travis.yml +0 -4
  67. data/docs/location.rst +0 -127
  68. data/lib/urbanairship/push/location.rb +0 -103
@@ -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
@@ -4,7 +4,7 @@ Channel Uninstall
4
4
 
5
5
  Channels can be uninstalled using ``ChannelUninstall``. There is a limit of 200 channels that
6
6
  can be uninstalled at one time. For more information, see `the API documentation
7
- <http://docs.urbanairship.com/api/ua.html#uninstall-channels>`__.
7
+ <http://docs.airship.com/api/ua.html#uninstall-channels>`__.
8
8
 
9
9
  .. sourcecode:: ruby
10
10
 
data/docs/conf.py CHANGED
@@ -16,6 +16,8 @@ import sys
16
16
  import os
17
17
  import shlex
18
18
  import re
19
+ import sphinx_rtd_theme
20
+ from datetime import datetime
19
21
 
20
22
  # If extensions (or modules to document with autodoc) are in another directory,
21
23
  # add these directories to sys.path here. If the directory is relative to the
@@ -25,12 +27,13 @@ import re
25
27
  # -- General configuration ------------------------------------------------
26
28
 
27
29
  # If your documentation needs a minimal Sphinx version, state it here.
28
- needs_sphinx = '1.0'
30
+ needs_sphinx = '1.6.7'
29
31
 
30
32
  # Add any Sphinx extension module names here, as strings. They can be
31
33
  # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32
34
  # ones.
33
- extensions = ['sphinxcontrib.rubydomain']
35
+
36
+ extensions = ['sphinxcontrib.rubydomain','sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx_rtd_theme']
34
37
 
35
38
  # Add any paths that contain templates here, relative to this directory.
36
39
  templates_path = ['_templates']
@@ -47,9 +50,11 @@ source_suffix = '.rst'
47
50
  master_doc = 'index'
48
51
 
49
52
  # General information about the project.
53
+ year = datetime.now().year
50
54
  project = u'ruby-library'
51
- copyright = u'2015, Urban Airship Ruby Library'
52
- author = u'Urban Airship'
55
+ author = u'Airship'
56
+ copyright = u'%d, %s' % (year, author)
57
+
53
58
 
54
59
  # The version info for the project you're documenting, acts as replacement for
55
60
  # |version| and |release|, also used in various other places throughout the
@@ -116,7 +121,7 @@ pygments_style = 'sphinx'
116
121
 
117
122
  # The theme to use for HTML and HTML Help pages. See the documentation for
118
123
  # a list of builtin themes.
119
- html_theme = 'urbanairship'
124
+ html_theme = 'sphinx_rtd_theme'
120
125
 
121
126
  # Theme options are theme-specific and customize the look and feel of a theme
122
127
  # further. For a list of options available for each theme, see the
@@ -232,7 +237,7 @@ latex_elements = {
232
237
  # author, documentclass [howto, manual, or own class]).
233
238
  latex_documents = [
234
239
  (master_doc, 'ruby-library.tex', u'ruby-library Documentation',
235
- u'Urban Airship', 'manual'),
240
+ u'Airship', 'manual'),
236
241
  ]
237
242
 
238
243
  # The name of an image file (relative to this directory) to place at the top of