urbanairship 9.0.0 → 9.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +12 -0
- data/README.rst +16 -0
- data/docs/index.rst +11 -14
- data/lib/urbanairship/client.rb +7 -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: 4271dd0c7f5cc4da7c6438cfec017d10be9ddb8c28145f541cf026ec1c179258
|
4
|
+
data.tar.gz: 609aa096ad24c679a32ab69fca8487ebe7e939150505d9f91c506937ce8e8ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d743974f8312e3d42f890873a3bd78f44483be14a4593c169f6587be560358771667127b1dabc30286cf3577161f573f9f73a13a9b6eb25840a686bf7d917e4f
|
7
|
+
data.tar.gz: 1abaa92b5fa0fea9afd3274ffac2bcc44a91280c514e05e11aab3612d0b886bfa11d4a9c1fa42ea887dd3638cdf6d336c187f6e8518f2618175e6b59f46fd3c2
|
data/CHANGELOG
CHANGED
@@ -1,8 +1,20 @@
|
|
1
|
+
--------------------
|
2
|
+
9.1.0
|
3
|
+
--------------------
|
4
|
+
- All requests will now automatically attempt to authenticate with bearer token auth if a
|
5
|
+
token is included in the instantiation of the client. Previously, only custom events requests
|
6
|
+
could use bearer token auth in this library. You can find more information about how to use
|
7
|
+
bearer token auth in the README.
|
8
|
+
- Also fixes an issue where a secret was required even when bearer token auth was being used
|
9
|
+
(it is no longer required).
|
10
|
+
|
11
|
+
--------------------
|
1
12
|
9.0.0
|
2
13
|
--------------------
|
3
14
|
- Adds Tag List API Support
|
4
15
|
- Removes location lookup endpoints
|
5
16
|
- Removes location-based audience selectors
|
17
|
+
|
6
18
|
--------------------
|
7
19
|
8.0.1
|
8
20
|
--------------------
|
data/README.rst
CHANGED
@@ -175,6 +175,22 @@ Finally, you can change the targeted server on a request basis:
|
|
175
175
|
# The Urbanairship configuration is overridden by the client and the
|
176
176
|
# request will be sent to the 'go.urbanairship.com' server
|
177
177
|
|
178
|
+
Using Bearer Token Auth
|
179
|
+
-----------------------
|
180
|
+
|
181
|
+
.. code-block:: ruby
|
182
|
+
|
183
|
+
require 'urbanairship'
|
184
|
+
|
185
|
+
UA = Urbanairship
|
186
|
+
airship = UA::Client.new(key:'application_key', token:'token')
|
187
|
+
# Then continue as you would otherwise
|
188
|
+
|
189
|
+
**Note**: If you include a token in your instantiation, the request
|
190
|
+
will use bearer token auth. Bearer token auth is required for some
|
191
|
+
endpoints, but not supported by others. Please check `the Airship
|
192
|
+
docs site <https://docs.airship.com/>`_ to see where it is supported.
|
193
|
+
|
178
194
|
Contributing
|
179
195
|
============
|
180
196
|
|
data/docs/index.rst
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
Airship Ruby Library
|
2
|
-
|
2
|
+
====================
|
3
3
|
|
4
4
|
``urbanairship`` is a Ruby library for using the `Airship
|
5
|
-
<http://airship.com/>`_ web service API for
|
6
|
-
rich app pages.
|
5
|
+
<http://airship.com/>`_ web service API for messaging.
|
7
6
|
|
8
7
|
|
9
8
|
Installation
|
@@ -29,8 +28,7 @@ The library is intended to be used with the small footprint of a single
|
|
29
28
|
import. To get started, import the package, and create an
|
30
29
|
:rb:class:`Airship` object representing a single Airship project.
|
31
30
|
|
32
|
-
|
33
|
-
`documentation on channels <channels>`_.
|
31
|
+
The library uses `rest-client <https://github.com/rest-client/rest-client>`_ for communication with the Airship API.
|
34
32
|
|
35
33
|
.. code-block:: ruby
|
36
34
|
|
@@ -43,15 +41,20 @@ Note that channels are preferred over ``device_token`` and ``apid``. See:
|
|
43
41
|
p.device_types = UA.device_types(['ios','android'])
|
44
42
|
p.send_push
|
45
43
|
|
46
|
-
|
44
|
+
We in the process of migrating code examples away from these docs and into the
|
45
|
+
regular `Airship API reference <https://docs.airship.com/api/ua/>`_
|
46
|
+
(select "Ruby Library"), so please check there for more examples.
|
47
|
+
|
48
|
+
Please also see `the README <https://github.com/urbanairship/ruby-library/blob/main/README.rst>`_
|
49
|
+
for detailed instructions on how to use bearer token auth and alternative servers.
|
47
50
|
|
48
51
|
|
49
52
|
Development
|
50
53
|
-----------
|
51
54
|
|
52
|
-
The library source code is `available on GitHub <github>`_.
|
55
|
+
The library source code is `available on GitHub <https://github.com/urbanairship/ruby-library>`_.
|
53
56
|
|
54
|
-
Tests can be run with
|
57
|
+
Tests can be run with `rspec <https://rspec.info/>`_.
|
55
58
|
|
56
59
|
Contents:
|
57
60
|
|
@@ -84,9 +87,3 @@ Indices and tables
|
|
84
87
|
* :ref:`genindex`
|
85
88
|
* :ref:`modindex`
|
86
89
|
* :ref:`search`
|
87
|
-
|
88
|
-
|
89
|
-
.. _channels: http://docs.airship.com/topic-guides/channels.html
|
90
|
-
.. _unirest: http://unirest.io/ruby.html
|
91
|
-
.. _github: https://github.com/urbanairship/ruby-library
|
92
|
-
.. _rspec: https://nose.readthedocs.org/en/latest/
|
data/lib/urbanairship/client.rb
CHANGED
@@ -15,10 +15,9 @@ module Urbanairship
|
|
15
15
|
# @param [Object] secret Application Secret
|
16
16
|
# @param [String] server Airship server to use ("go.airship.eu" or "go.urbanairship.com").
|
17
17
|
# Used only when the request is sent with a "path", not an "url".
|
18
|
-
# @param [String] token Application Auth Token
|
18
|
+
# @param [String] token Application Auth Token
|
19
19
|
# @return [Object] Client
|
20
|
-
def initialize(key: required('key'), secret:
|
21
|
-
server: Urbanairship.configuration.server, token: nil)
|
20
|
+
def initialize(key: required('key'), secret: nil, server: Urbanairship.configuration.server, token: nil)
|
22
21
|
@key = key
|
23
22
|
@secret = secret
|
24
23
|
@server = server
|
@@ -57,6 +56,10 @@ module Urbanairship
|
|
57
56
|
headers['Content-Type'] = content_type unless content_type.nil?
|
58
57
|
headers['Content-Encoding'] = encoding unless encoding.nil?
|
59
58
|
|
59
|
+
if @token != nil
|
60
|
+
auth_type = :bearer
|
61
|
+
end
|
62
|
+
|
60
63
|
if auth_type == :bearer
|
61
64
|
raise ArgumentError.new('token must be provided as argument if auth_type=bearer') if @token.nil?
|
62
65
|
headers['X-UA-Appkey'] = @key
|
@@ -82,6 +85,7 @@ module Urbanairship
|
|
82
85
|
}
|
83
86
|
|
84
87
|
if auth_type == :basic
|
88
|
+
raise ArgumentError.new('secret must be provided as argument if auth_type=basic') if @secret.nil?
|
85
89
|
params[:user] = @key
|
86
90
|
params[:password] = @secret
|
87
91
|
end
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airship
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|