urbanairship 3.0.2 → 3.1.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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG +13 -0
- data/README.rst +111 -0
- data/docs/Makefile +192 -0
- data/docs/channel_uninstall.rst +21 -0
- data/docs/conf.py +293 -0
- data/docs/devices.rst +54 -0
- data/docs/examples.rst +118 -0
- data/docs/exceptions.rst +17 -0
- data/docs/index.rst +83 -0
- data/docs/named_user.rst +101 -0
- data/docs/push.rst +416 -0
- data/docs/reports.rst +303 -0
- data/docs/segment.rst +97 -0
- data/docs/tags.rst +49 -0
- data/lib/urbanairship/client.rb +20 -17
- data/lib/urbanairship/common.rb +47 -3
- data/lib/urbanairship/devices/channel_tags.rb +73 -0
- data/lib/urbanairship/devices/channel_uninstall.rb +35 -0
- data/lib/urbanairship/devices/devicelist.rb +61 -0
- data/lib/urbanairship/devices/named_user.rb +87 -0
- data/lib/urbanairship/devices/segment.rb +109 -0
- data/lib/urbanairship/loggable.rb +1 -0
- data/lib/urbanairship/push/audience.rb +1 -0
- data/lib/urbanairship/push/push.rb +12 -18
- data/lib/urbanairship/push/schedule.rb +1 -0
- data/lib/urbanairship/reports/per_push.rb +97 -0
- data/lib/urbanairship/reports/response_statistics.rb +157 -0
- data/lib/urbanairship/version.rb +1 -1
- data/lib/urbanairship.rb +9 -4
- data/urbanairship.gemspec +2 -2
- metadata +44 -25
- data/README.md +0 -96
data/docs/reports.rst
ADDED
@@ -0,0 +1,303 @@
|
|
1
|
+
*******
|
2
|
+
Reports
|
3
|
+
*******
|
4
|
+
|
5
|
+
Individual Push Response Stats
|
6
|
+
==============================
|
7
|
+
|
8
|
+
Returns detailed report information about a specific push notification.
|
9
|
+
Use the push_id, which is the identifier returned by the API that represents a
|
10
|
+
specific push message delivery.
|
11
|
+
For more information, see `the API documentation
|
12
|
+
<http://docs.urbanairship.com/api/ua.html#individual-push-response-statistics>`_
|
13
|
+
|
14
|
+
.. code-block:: ruby
|
15
|
+
|
16
|
+
require 'urbanairship'
|
17
|
+
UA = Urbanairship
|
18
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
19
|
+
d = UA::IndividualResponseStats.new(client: airship)
|
20
|
+
statistics = d.get(push_id: 'push_id')
|
21
|
+
|
22
|
+
|
23
|
+
Devices Report
|
24
|
+
==============
|
25
|
+
|
26
|
+
Returns an app’s opted-in and installed device counts broken out by device
|
27
|
+
type. This endpoint returns the same data that populates the Devices Report.
|
28
|
+
For more information, see `the API documentation
|
29
|
+
<http://docs.urbanairship.com/api/ua.html#devices-report-api>`_
|
30
|
+
|
31
|
+
.. code-block:: ruby
|
32
|
+
|
33
|
+
require 'urbanairship'
|
34
|
+
UA = Urbanairship
|
35
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
36
|
+
d = UA::DevicesReport.new(client: airship)
|
37
|
+
devices = d.get(date: '2015/08/01')
|
38
|
+
|
39
|
+
|
40
|
+
Push Report
|
41
|
+
===========
|
42
|
+
|
43
|
+
Get the number of pushes you have sent within a specified time period.
|
44
|
+
For more information, see `the API documentation
|
45
|
+
<http://docs.urbanairship.com/api/ua.html#push-report>`_
|
46
|
+
|
47
|
+
.. code-block:: ruby
|
48
|
+
|
49
|
+
require 'urbanairship'
|
50
|
+
UA = Urbanairship
|
51
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
52
|
+
listing = UA::PushList.new(
|
53
|
+
client: airship,
|
54
|
+
start_date: '2015/06/01',
|
55
|
+
end_date: '2015/08/01',
|
56
|
+
precision: 'HOURLY'
|
57
|
+
)
|
58
|
+
listing.each do |resp|
|
59
|
+
puts(resp)
|
60
|
+
end
|
61
|
+
|
62
|
+
.. note::
|
63
|
+
precision needs to be a member of ['HOURLY', 'DAILY', 'MONTHLY']
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
Per Push Reporting
|
68
|
+
==================
|
69
|
+
|
70
|
+
Retrieve data specific to the performance of an individual push.
|
71
|
+
For more information, see `the API documentation
|
72
|
+
<http://docs.urbanairship.com/api/ua.html#per-push-reporting>`_
|
73
|
+
|
74
|
+
---------------
|
75
|
+
Per Push Detail
|
76
|
+
---------------
|
77
|
+
|
78
|
+
|
79
|
+
Single Request
|
80
|
+
--------------
|
81
|
+
|
82
|
+
Get the analytics detail for a specific Push ID. For more information, see `the
|
83
|
+
API documentation
|
84
|
+
<http://docs.urbanairship.com/api/ua.html#single-request>`_
|
85
|
+
|
86
|
+
.. code-block:: ruby
|
87
|
+
|
88
|
+
require 'urbanairship'
|
89
|
+
UA = Urbanairship
|
90
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
91
|
+
d = UA::PerPushDetail.new(client: airship)
|
92
|
+
details = d.get_single(push_id:'push_id')
|
93
|
+
|
94
|
+
|
95
|
+
Batch Request
|
96
|
+
-------------
|
97
|
+
|
98
|
+
Get the analytics details for an array of Push IDs. For more information,
|
99
|
+
see `the API documentation <http://docs.urbanairship.com/api/ua.html#batch-request>`_
|
100
|
+
|
101
|
+
.. code-block:: ruby
|
102
|
+
|
103
|
+
require 'urbanairship'
|
104
|
+
UA = Urbanairship
|
105
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
106
|
+
d = UA::PerPushDetail.new(client: airship)
|
107
|
+
details = d.get_batch(push_ids: ['push_id', 'push_id2', 'push_id3'])
|
108
|
+
|
109
|
+
.. note::
|
110
|
+
|
111
|
+
There is a maximum of 100 Push IDs per request
|
112
|
+
|
113
|
+
---------------
|
114
|
+
Per Push Series
|
115
|
+
---------------
|
116
|
+
|
117
|
+
Get the default time series data. For more information,
|
118
|
+
see `the API documentation
|
119
|
+
<http://docs.urbanairship.com/api/ua.html#per-push-series>`_
|
120
|
+
|
121
|
+
.. code-block:: ruby
|
122
|
+
|
123
|
+
require 'urbanairship'
|
124
|
+
UA = Urbanairship
|
125
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
126
|
+
s = UA::PerPushSeries.new(client: airship)
|
127
|
+
series = s.get(
|
128
|
+
push_id: 'push_id',
|
129
|
+
precision: 'HOURLY',
|
130
|
+
start_date: '2015-06-01',
|
131
|
+
end_date: '2015-08-01'
|
132
|
+
)
|
133
|
+
|
134
|
+
.. note::
|
135
|
+
|
136
|
+
precision, start_date, and end_date are optional parameters. However, if specifying
|
137
|
+
a date range, precision, start_date and end_date must all be specified. Precision
|
138
|
+
can be specified without start_date and end_date but must be a member of
|
139
|
+
['HOURLY', 'DAILY', 'MONTHLY'].
|
140
|
+
|
141
|
+
Response Report
|
142
|
+
===============
|
143
|
+
|
144
|
+
Get the number of direct and influenced opens of your app. For more
|
145
|
+
information, see `the API documentation
|
146
|
+
<http://docs.urbanairship.com/api/ua.html#response-report>`_
|
147
|
+
|
148
|
+
.. code-block:: ruby
|
149
|
+
|
150
|
+
require 'urbanairship'
|
151
|
+
UA = Urbanairship
|
152
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
153
|
+
listing = UA::ResponseReportList.new(
|
154
|
+
client: airship,
|
155
|
+
start_date: '2015-06-01',
|
156
|
+
end_date: '2015-08-01',
|
157
|
+
precision: 'MONTHLY'
|
158
|
+
)
|
159
|
+
listing.each do |resp|
|
160
|
+
puts(resp)
|
161
|
+
end
|
162
|
+
|
163
|
+
.. note::
|
164
|
+
|
165
|
+
precision needs to be a member of ['HOURLY', 'DAILY', 'MONTHLY']
|
166
|
+
|
167
|
+
|
168
|
+
Response Listing
|
169
|
+
================
|
170
|
+
|
171
|
+
Get a listing of all pushes and basic response information in a given
|
172
|
+
timeframe by instantiating an iterator object using ResponseList.
|
173
|
+
Start and end date times are required parameters.
|
174
|
+
For more information, see `the API documentation
|
175
|
+
<http://docs.urbanairship.com/api/ua.html#response-listing>`_
|
176
|
+
|
177
|
+
.. code-block:: ruby
|
178
|
+
|
179
|
+
require 'urbanairship'
|
180
|
+
UA = Urbanairship
|
181
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
182
|
+
response_list = UA::ResponseList.new(
|
183
|
+
client: airship,
|
184
|
+
start_date: '2015-06-01',
|
185
|
+
end_date: '2015-08-01,
|
186
|
+
limit: 20,
|
187
|
+
push_id_start: 'start_id'
|
188
|
+
)
|
189
|
+
response_list.each do |resp|
|
190
|
+
puts(resp)
|
191
|
+
end
|
192
|
+
|
193
|
+
.. note::
|
194
|
+
|
195
|
+
limit (optional) is the number of results desired per page.
|
196
|
+
push_id_start (optional) specifies the id of the first response to return.
|
197
|
+
|
198
|
+
|
199
|
+
App Opens Report
|
200
|
+
================
|
201
|
+
|
202
|
+
Get the number of users who have opened your app within the specified time
|
203
|
+
period. For more information, see `the API documentation
|
204
|
+
<http://docs.urbanairship.com/api/ua.html#app-opens-report>`_
|
205
|
+
|
206
|
+
.. code-block:: ruby
|
207
|
+
|
208
|
+
require 'urbanairship'
|
209
|
+
UA = Urbanairship
|
210
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
211
|
+
listing = UA::AppOpensList.new(
|
212
|
+
client: airship,
|
213
|
+
start_date: '2015-06-01',
|
214
|
+
end_date: '2015-08-01',
|
215
|
+
precision: 'HOURLY')
|
216
|
+
listing.each do |app_opens|
|
217
|
+
puts(app_opens)
|
218
|
+
end
|
219
|
+
|
220
|
+
.. note::
|
221
|
+
|
222
|
+
precision needs to be a member of ['HOURLY', 'DAILY', 'MONTHLY']
|
223
|
+
|
224
|
+
|
225
|
+
Time In App Report
|
226
|
+
==================
|
227
|
+
|
228
|
+
Get the average amount of time users have spent in your app within the
|
229
|
+
specified time period. For more information, see `the API documentation
|
230
|
+
<http://docs.urbanairship.com/api/ua.html#time-in-app-report>`_
|
231
|
+
|
232
|
+
.. code-block:: ruby
|
233
|
+
|
234
|
+
require 'urbanairship'
|
235
|
+
UA = Urbanairship
|
236
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
237
|
+
listing = UA::TimeInAppList.new(
|
238
|
+
client: airship,
|
239
|
+
start_date: '2015-06-01',
|
240
|
+
end_date: '2015-08-01',
|
241
|
+
precision: 'HOURLY')
|
242
|
+
listing.each do |time_in_app|
|
243
|
+
puts(time_in_app)
|
244
|
+
end
|
245
|
+
|
246
|
+
.. note::
|
247
|
+
|
248
|
+
precision needs to be a member of ['HOURLY', 'DAILY', 'MONTHLY']
|
249
|
+
|
250
|
+
|
251
|
+
Opt-In Report
|
252
|
+
=============
|
253
|
+
|
254
|
+
Get the number of opted-in push users who access the app within the specified
|
255
|
+
time period.
|
256
|
+
For more information, see `the API documentation
|
257
|
+
<http://docs.urbanairship.com/api/ua.html#opt-in-report>`_
|
258
|
+
|
259
|
+
.. code-block:: ruby
|
260
|
+
|
261
|
+
require 'urbanairship'
|
262
|
+
UA = Urbanairship
|
263
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
264
|
+
listing = UA::OptInList.new(
|
265
|
+
client: airship,
|
266
|
+
start_date: '2015-06-01',
|
267
|
+
end_date: '2015-08-01',
|
268
|
+
precision: 'HOURLY')
|
269
|
+
listing.each do |opt_ins|
|
270
|
+
puts(opt_ins)
|
271
|
+
end
|
272
|
+
|
273
|
+
.. note::
|
274
|
+
|
275
|
+
precision needs to be a member of ['HOURLY', 'DAILY', 'MONTHLY']
|
276
|
+
|
277
|
+
|
278
|
+
Opt-Out Report
|
279
|
+
==============
|
280
|
+
|
281
|
+
Get the number of opted-out push users who access the app within the specified
|
282
|
+
time period.
|
283
|
+
For more information, see `the API documentation
|
284
|
+
<http://docs.urbanairship.com/api/ua.html#opt-out-report>`_
|
285
|
+
|
286
|
+
.. code-block:: ruby
|
287
|
+
|
288
|
+
require 'urbanairship'
|
289
|
+
UA = Urbanairship
|
290
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
291
|
+
listing = UA::OptOutList.new(
|
292
|
+
client: airship,
|
293
|
+
start_date: '2015-06-01',
|
294
|
+
end_date: '2015-08-01',
|
295
|
+
precision: 'HOURLY')
|
296
|
+
listing.each do |opt_outs|
|
297
|
+
puts(opt_outs)
|
298
|
+
end
|
299
|
+
|
300
|
+
.. note::
|
301
|
+
|
302
|
+
precision needs to be a member of ['HOURLY', 'DAILY', 'MONTHLY']
|
303
|
+
|
data/docs/segment.rst
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
########
|
2
|
+
Segments
|
3
|
+
########
|
4
|
+
|
5
|
+
|
6
|
+
***************
|
7
|
+
Segment Listing
|
8
|
+
***************
|
9
|
+
|
10
|
+
Segment lists are fetched by instantiating an iterator object using ``SegmentList``. For more
|
11
|
+
information, see `the API documentation <http://docs.urbanairship.com/api/ua.html#segments>`__
|
12
|
+
|
13
|
+
.. sourcecode:: ruby
|
14
|
+
|
15
|
+
require 'urbanairship'
|
16
|
+
UA = Urbanairship
|
17
|
+
airship = UA::Client.new(key: 'application_key', secret: 'master_secret')
|
18
|
+
segment_list = UA::SegmentList.new(client: airship)
|
19
|
+
|
20
|
+
segment_list.each do |segment|
|
21
|
+
puts(segment['display_name'])
|
22
|
+
end
|
23
|
+
|
24
|
+
******************
|
25
|
+
Creating a Segment
|
26
|
+
******************
|
27
|
+
|
28
|
+
Create a segment for the application. See the segment creation `API documentation
|
29
|
+
<http://docs.urbanairship.com/api/ua.html#segment-creation>`__ for more information.
|
30
|
+
|
31
|
+
.. sourcecode:: ruby
|
32
|
+
|
33
|
+
require 'urbanairship'
|
34
|
+
UA = Urbanairship
|
35
|
+
airship = UA::Client.new(key: 'application_key', secret: 'master_secret')
|
36
|
+
segment = UA::Segment.new(client: airship)
|
37
|
+
segment.display_name = 'Display Name'
|
38
|
+
segment.criteria = { 'tag' => 'existing_tag' }
|
39
|
+
segment.create
|
40
|
+
|
41
|
+
|
42
|
+
*******************
|
43
|
+
Modifying a Segment
|
44
|
+
*******************
|
45
|
+
|
46
|
+
Change the display name and/or criteria of a segment. For more information, see the segment
|
47
|
+
update `API documentation <http://docs.urbanairship.com/api/ua.html#update-segment>`__.
|
48
|
+
|
49
|
+
.. sourcecode:: ruby
|
50
|
+
|
51
|
+
require 'urbanairship'
|
52
|
+
UA = Urbanairship
|
53
|
+
airship = UA::Client.new(key: 'application_key', secret: 'master_secret')
|
54
|
+
segment = UA::Segment.new(client: airship)
|
55
|
+
segment.from_id(id: 'segment_id')
|
56
|
+
segment.display_name = 'Updated Display Name'
|
57
|
+
segment.criteria = { 'tag' => 'updated_tag' }
|
58
|
+
segment.update
|
59
|
+
|
60
|
+
|
61
|
+
******************
|
62
|
+
Deleting a Segment
|
63
|
+
******************
|
64
|
+
|
65
|
+
Delete a segment. For more information, see the segment deletion `API documentation
|
66
|
+
<http://docs.urbanairship.com/api/ua.html#delete-segment>`__.
|
67
|
+
|
68
|
+
.. sourcecode:: ruby
|
69
|
+
|
70
|
+
require 'urbanairship'
|
71
|
+
UA = Urbanairship
|
72
|
+
airship = UA::Client.new(key: 'application_key', secret: 'master_secret')
|
73
|
+
segment = UA::Segment.new(client: airship)
|
74
|
+
segment.from_id(id: 'segment_id')
|
75
|
+
segment.delete
|
76
|
+
|
77
|
+
|
78
|
+
**************
|
79
|
+
Segment Lookup
|
80
|
+
**************
|
81
|
+
|
82
|
+
Fetch a particular segment's display name and criteria. See the individual segment lookup
|
83
|
+
`API documentation <http://docs.urbanairship.com/api/ua.html#individual-segment-lookup>`__ for
|
84
|
+
more information.
|
85
|
+
|
86
|
+
.. sourcecode:: ruby
|
87
|
+
|
88
|
+
require 'urbanairship'
|
89
|
+
UA = Urbanairship
|
90
|
+
airship = UA::Client.new(key: 'application_key', secret: 'master_secret')
|
91
|
+
segment = UA::Segment.new(client: airship)
|
92
|
+
segment.from_id(id: 'segment_id')
|
93
|
+
|
94
|
+
.. note::
|
95
|
+
|
96
|
+
Calling ``segment.from_id(id: 'segment_id')`` automatically sets the ``display_name`` and
|
97
|
+
``criteria`` attributes of segment.
|
data/docs/tags.rst
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
Tags
|
2
|
+
====
|
3
|
+
|
4
|
+
This reference covers tag operations on channels.
|
5
|
+
|
6
|
+
For more information, see: http://docs.urbanairship.com/api/ua.html#tags.
|
7
|
+
|
8
|
+
|
9
|
+
ChannelTags
|
10
|
+
-----------
|
11
|
+
|
12
|
+
Allows the addition, removal, and setting of tags on a channel specified by
|
13
|
+
the required audience field.
|
14
|
+
|
15
|
+
A single request body may contain an add or remove
|
16
|
+
field, or both, or a single set field. If both add and remove are fields are
|
17
|
+
present and the intersection of the tags in these fields is not empty, then
|
18
|
+
a 400 will be returned.
|
19
|
+
|
20
|
+
Tag set operations only update tag groups that are present in the request.
|
21
|
+
Tags for a given Tag Group can be cleared by sending a set field with an empty
|
22
|
+
list.
|
23
|
+
|
24
|
+
If a tag update request contains tags in multiple Tag Groups, the request
|
25
|
+
will be accepted if at least one of the Tag Groups is active. If inactive or
|
26
|
+
missing Tag Groups are specified, a warning will be included in the response.
|
27
|
+
|
28
|
+
.. code-block:: ruby
|
29
|
+
|
30
|
+
require 'urbanairship'
|
31
|
+
UA = Urbanairship
|
32
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
33
|
+
channel_tags = UA::ChannelTags.new(client: airship)
|
34
|
+
ios_audience = ['channel1', 'channel2', 'channel3']
|
35
|
+
android_audience = 'channel4'
|
36
|
+
amazon_audience = nil
|
37
|
+
channel_tags.set_audience(
|
38
|
+
ios: ios_audience,
|
39
|
+
android: android_audience,
|
40
|
+
amazon: amazon_audience
|
41
|
+
)
|
42
|
+
channel_tags.add(group_name: 'group_name', tags: ['tag1', 'tag2', 'tag3'])
|
43
|
+
channel_tags.remove(group_name: 'group_name', tags: 'tag4')
|
44
|
+
channel_tags.send_request
|
45
|
+
|
46
|
+
.. note::
|
47
|
+
|
48
|
+
The audience can be either a single channel or a list of channels. Similarly,
|
49
|
+
the tags can either be set as a single tag or a list of tags.
|