urbanairship 9.2.0 → 9.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yaml +3 -0
- data/CHANGELOG +14 -0
- data/README.rst +39 -11
- data/docs/email.rst +30 -2
- data/lib/urbanairship/client.rb +20 -3
- data/lib/urbanairship/configuration.rb +3 -2
- data/lib/urbanairship/devices/email.rb +48 -3
- data/lib/urbanairship/oauth.rb +129 -0
- data/lib/urbanairship/version.rb +1 -1
- data/lib/urbanairship.rb +1 -0
- data/urbanairship.gemspec +2 -1
- metadata +30 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 979edbaca3a95cc2b422ae5f1c3fda149f0eccc9b3aada416b26a50dc1e360a6
|
4
|
+
data.tar.gz: 002a4f86ec42e19c23c60f368a3175bd9c789312c43400705989d173b50e8ddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba953bb68f8c20f2c5854447fd95419311ef27c8c898bb9453e35f3d00b6d23cd8febc08e47661f8e1ba50128fcc89d89159a6fefe2c76a7b4ae96a974b78f5
|
7
|
+
data.tar.gz: b59971c8adcd4b59f93b79bc69a1d0adbf35e5c0938729d7f213d8bb7d0f6ae3c000384c3aee604bfadfde94363ecea27942300531b35f4acaed9bd5a082aa5e
|
data/.github/workflows/ci.yaml
CHANGED
@@ -17,6 +17,9 @@ jobs:
|
|
17
17
|
uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
18
18
|
with:
|
19
19
|
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler: none
|
21
|
+
- name: Install bundler 2.4
|
22
|
+
run: gem install bundler -v 2.4.22
|
20
23
|
- name: Install dependencies
|
21
24
|
run: bundle install
|
22
25
|
- name: Run tests
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 9.4.0
|
2
|
+
|
3
|
+
- Adds email replace method
|
4
|
+
- Updates Email class along with register and update methods to accept more parameters
|
5
|
+
|
6
|
+
---
|
7
|
+
|
8
|
+
## 9.3.0
|
9
|
+
|
10
|
+
- Adds Oauth support
|
11
|
+
- Changes default base URL from "go.airship.com" to "api.asnapius.com"
|
12
|
+
|
13
|
+
---
|
14
|
+
|
1
15
|
## 9.2.0
|
2
16
|
|
3
17
|
- Adds support for iOS Live Activity and Android Live Update
|
data/README.rst
CHANGED
@@ -66,7 +66,8 @@ In your app initialization, you can do something like the following:
|
|
66
66
|
require 'urbanairship'
|
67
67
|
|
68
68
|
Urbanairship.configure do |config|
|
69
|
-
config.server = '
|
69
|
+
config.server = 'api.asnapieu.com'
|
70
|
+
config.oauth_server = 'oauth2.asnapieu.com'
|
70
71
|
config.log_path = '/path/to/your/logfile'
|
71
72
|
config.log_level = Logger::WARN
|
72
73
|
config.timeout = 60
|
@@ -87,10 +88,11 @@ If you want to use a custom logger (e.g Rails.logger), you can do:
|
|
87
88
|
Available Configurations
|
88
89
|
------------------------
|
89
90
|
|
90
|
-
- **log_path**: Allows to define the folder where the log file will be created (the default is nil).
|
91
|
-
- **log_level**: Allows to define the log level and only messages at that level or higher will be printed (the default is INFO).
|
92
|
-
- **server**:
|
93
|
-
- **
|
91
|
+
- **log_path**: Allows you to define the folder where the log file will be created (the default is nil).
|
92
|
+
- **log_level**: Allows you to define the log level and only messages at that level or higher will be printed (the default is INFO).
|
93
|
+
- **server**: Allows you to define the Airship server you want to use ("api.asnapieu.com" for EU or "api.asnapius.com" for US)
|
94
|
+
- **oauth_server** Allows you to define the Airship Oauth server you want to use ("oauth2.asnapieu.com" for EU or "oauth2.asnapius.com" for US)
|
95
|
+
- **timeout**: Allows you to define the request timeout in seconds (the default is 5).
|
94
96
|
|
95
97
|
|
96
98
|
Usage
|
@@ -140,7 +142,7 @@ Simple Tag Push
|
|
140
142
|
|
141
143
|
Specify the Airship server used to make your requests
|
142
144
|
-----------------------------------------------------
|
143
|
-
By default, the request will be sent to the '
|
145
|
+
By default, the request will be sent to the 'api.asnapius.com' server:
|
144
146
|
|
145
147
|
.. code-block:: ruby
|
146
148
|
|
@@ -155,11 +157,11 @@ You can change the server globally in the Urbanairship configuration:
|
|
155
157
|
require 'urbanairship'
|
156
158
|
|
157
159
|
Urbanairship.configure do |config|
|
158
|
-
config.server = '
|
160
|
+
config.server = 'api.asnapieu.com'
|
159
161
|
end
|
160
162
|
|
161
163
|
Urbanairship::Client.new(key:'application_key', secret:'master_secret')
|
162
|
-
# request will be sent to the '
|
164
|
+
# request will be sent to the 'api.asnapieu.com' server
|
163
165
|
|
164
166
|
Finally, you can change the targeted server on a request basis:
|
165
167
|
|
@@ -168,12 +170,12 @@ Finally, you can change the targeted server on a request basis:
|
|
168
170
|
require 'urbanairship'
|
169
171
|
|
170
172
|
Urbanairship.configure do |config|
|
171
|
-
config.server = '
|
173
|
+
config.server = 'api.asnapieu.com'
|
172
174
|
end
|
173
175
|
|
174
|
-
Urbanairship::Client.new(key:'application_key', secret:'master_secret', server: '
|
176
|
+
Urbanairship::Client.new(key:'application_key', secret:'master_secret', server: 'api.asnapius.com')
|
175
177
|
# The Urbanairship configuration is overridden by the client and the
|
176
|
-
# request will be sent to the '
|
178
|
+
# request will be sent to the 'api.asnapius.com' server
|
177
179
|
|
178
180
|
Using Bearer Token Auth
|
179
181
|
-----------------------
|
@@ -191,6 +193,32 @@ will use bearer token auth. Bearer token auth is required for some
|
|
191
193
|
endpoints, but not supported by others. Please check `the Airship
|
192
194
|
docs site <https://docs.airship.com/>`_ to see where it is supported.
|
193
195
|
|
196
|
+
Using Oauth
|
197
|
+
-----------
|
198
|
+
.. code-block:: ruby
|
199
|
+
|
200
|
+
require 'urbanairship'
|
201
|
+
|
202
|
+
UA = Urbanairship
|
203
|
+
app_key = 'application_key'
|
204
|
+
|
205
|
+
oauth = UA::Oauth.new(
|
206
|
+
client_id: 'client_id',
|
207
|
+
key: app_key,
|
208
|
+
assertion_private_key: 'your_private_key',
|
209
|
+
scopes: ['psh', 'chn'], # Optional
|
210
|
+
ip_addresses: ['23.74.131.15/22'], # Optional
|
211
|
+
oauth_server: 'api.asnapieu.com' # Optional
|
212
|
+
)
|
213
|
+
airship = UA::Client.new(key: app_key, oauth: oauth)
|
214
|
+
# Then continue as you would otherwise
|
215
|
+
|
216
|
+
**Note**: You can not use both Oauth and bearer token auth
|
217
|
+
at the same time. Oauth also cannot be used with the older
|
218
|
+
'api.urbanairship.com' and 'api.airship.eu' base URLs. Lastly
|
219
|
+
there are some endpoints in which Oauth is not supported.
|
220
|
+
Please check `the Airship docs site <https://docs.airship.com/>`_ to see where it is supported.
|
221
|
+
|
194
222
|
Contributing
|
195
223
|
============
|
196
224
|
|
data/docs/email.rst
CHANGED
@@ -66,7 +66,6 @@ Update Email Channel
|
|
66
66
|
email_channel.channel_id = '01234567-890a-bcde-f012-3456789abc0'
|
67
67
|
email_channel.type = 'email'
|
68
68
|
email_channel.commercial_opted_in = '2018-10-28T10:34:22'
|
69
|
-
email_channel.address = 'new.name@new.domain.com'
|
70
69
|
email_channel.timezone = 'America/Los_Angeles'
|
71
70
|
email_channel.locale_country = 'US'
|
72
71
|
email_channel.locale_language = 'en'
|
@@ -75,7 +74,36 @@ Update Email Channel
|
|
75
74
|
.. note::
|
76
75
|
|
77
76
|
The only thing required to make a request is the channel_id. However, anything
|
78
|
-
that needs to be updated must also be included.
|
77
|
+
that needs to be updated must also be included. Please note that you cannot
|
78
|
+
update an email address with this method. Please use the replace method instead.
|
79
|
+
|
80
|
+
Replace Email Channel
|
81
|
+
--------------------
|
82
|
+
|
83
|
+
.. code-block:: ruby
|
84
|
+
|
85
|
+
require 'urbanairship'
|
86
|
+
UA = Urbanairship
|
87
|
+
airship = UA::Client.new(key:'application_key', secret:'master_secret')
|
88
|
+
email_channel = UA::Email.new(client: airship)
|
89
|
+
email_channel.channel_id = '01234567-890a-bcde-f012-3456789abc0'
|
90
|
+
email_channel.address = 'new.name@new.domain.com'
|
91
|
+
email_channel.type = 'email'
|
92
|
+
email_channel.commercial_opted_in = '2018-10-28T10:34:22'
|
93
|
+
email_channel.timezone = 'America/Los_Angeles'
|
94
|
+
email_channel.locale_country = 'US'
|
95
|
+
email_channel.locale_language = 'en'
|
96
|
+
email_channel.update
|
97
|
+
|
98
|
+
.. note::
|
99
|
+
|
100
|
+
This will replace an existing email channel and will do the following actions:
|
101
|
+
|
102
|
+
- Register a new channel
|
103
|
+
- Associate the new email channel with the same user as the source channel
|
104
|
+
- Uninstall the source channel
|
105
|
+
|
106
|
+
Address, Channel ID and type are all required parameters for this method.
|
79
107
|
|
80
108
|
Email Tags
|
81
109
|
----------
|
data/lib/urbanairship/client.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'rest-client'
|
3
3
|
require 'urbanairship'
|
4
|
+
require 'jwt'
|
4
5
|
|
5
6
|
|
6
7
|
module Urbanairship
|
7
8
|
class Client
|
8
|
-
attr_accessor :key, :secret
|
9
|
+
attr_accessor :key, :secret, :token
|
9
10
|
include Urbanairship::Common
|
10
11
|
include Urbanairship::Loggable
|
11
12
|
|
@@ -13,15 +14,21 @@ module Urbanairship
|
|
13
14
|
#
|
14
15
|
# @param [Object] key Application Key
|
15
16
|
# @param [Object] secret Application Secret
|
16
|
-
# @param [String] server Airship server to use ("
|
17
|
+
# @param [String] server Airship server to use ("api.asnapieu.com" for EU or "api.asnapius.com" for US).
|
17
18
|
# Used only when the request is sent with a "path", not an "url".
|
18
19
|
# @param [String] token Application Auth Token
|
20
|
+
# @param [Object] oauth Oauth object
|
19
21
|
# @return [Object] Client
|
20
|
-
def initialize(key: required('key'), secret: nil, server: Urbanairship.configuration.server, token: nil)
|
22
|
+
def initialize(key: required('key'), secret: nil, server: Urbanairship.configuration.server, token: nil, oauth: nil)
|
21
23
|
@key = key
|
22
24
|
@secret = secret
|
23
25
|
@server = server
|
24
26
|
@token = token
|
27
|
+
@oauth = oauth
|
28
|
+
|
29
|
+
if @oauth != nil && @token != nil
|
30
|
+
raise ArgumentError.new("oauth and token can't both be used at the same time.")
|
31
|
+
end
|
25
32
|
end
|
26
33
|
|
27
34
|
# Send a request to Airship's API
|
@@ -56,6 +63,16 @@ module Urbanairship
|
|
56
63
|
headers['Content-Type'] = content_type unless content_type.nil?
|
57
64
|
headers['Content-Encoding'] = encoding unless encoding.nil?
|
58
65
|
|
66
|
+
unless @oauth.nil?
|
67
|
+
begin
|
68
|
+
@token = @oauth.get_token
|
69
|
+
rescue RestClient::Exception => e
|
70
|
+
new_error = RestClient::Exception.new(e.response, e.response.code)
|
71
|
+
new_error.message = "error while getting oauth token: #{e.message}"
|
72
|
+
raise new_error
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
59
76
|
if @token != nil
|
60
77
|
auth_type = :bearer
|
61
78
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Urbanairship
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :custom_logger, :log_path, :log_level, :server, :timeout
|
3
|
+
attr_accessor :custom_logger, :log_path, :log_level, :server, :oauth_server, :timeout
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
@server = '
|
6
|
+
@server = 'api.asnapius.com'
|
7
|
+
@oauth_server = 'oauth2.asnapius.com'
|
7
8
|
@custom_logger = nil
|
8
9
|
@log_path = nil
|
9
10
|
@log_level = Logger::INFO
|
@@ -7,10 +7,15 @@ module Urbanairship
|
|
7
7
|
include Urbanairship::Common
|
8
8
|
include Urbanairship::Loggable
|
9
9
|
attr_accessor :address,
|
10
|
+
:click_tracking_opted_in,
|
11
|
+
:click_tracking_opted_out,
|
10
12
|
:commercial_opted_in,
|
11
13
|
:commercial_opted_out,
|
12
14
|
:locale_country,
|
13
15
|
:locale_language,
|
16
|
+
:open_tracking_opted_in,
|
17
|
+
:open_tracking_opted_out,
|
18
|
+
:suppression_state,
|
14
19
|
:timezone,
|
15
20
|
:transactional_opted_in,
|
16
21
|
:transactional_opted_out,
|
@@ -27,10 +32,15 @@ module Urbanairship
|
|
27
32
|
payload = {
|
28
33
|
'channel': {
|
29
34
|
'address': address,
|
35
|
+
'click_tracking_opted_in': click_tracking_opted_in,
|
36
|
+
'click_tracking_opted_out': click_tracking_opted_out,
|
30
37
|
'commercial_opted_in': commercial_opted_in,
|
31
38
|
'commercial_opted_out': commercial_opted_out,
|
32
39
|
'locale_country': locale_country,
|
33
40
|
'locale_language': locale_language,
|
41
|
+
'open_tracking_opted_in': open_tracking_opted_in,
|
42
|
+
'open_tracking_opted_out': open_tracking_opted_out,
|
43
|
+
'suppression_state': suppression_state,
|
34
44
|
'timezone': timezone,
|
35
45
|
'transactional_opted_in': transactional_opted_in,
|
36
46
|
'transactional_opted_out': transactional_opted_out,
|
@@ -77,18 +87,19 @@ module Urbanairship
|
|
77
87
|
end
|
78
88
|
|
79
89
|
def update
|
80
|
-
fail ArgumentError, '
|
90
|
+
fail ArgumentError, 'channel_id must be set to update email channel' if channel_id.nil?
|
81
91
|
|
82
92
|
channel_data = {
|
83
93
|
'address': address,
|
84
94
|
'commercial_opted_in': commercial_opted_in,
|
85
95
|
'commercial_opted_out': commercial_opted_out,
|
86
|
-
'
|
96
|
+
'locale_country': locale_country,
|
87
97
|
'locale_language': locale_language,
|
88
98
|
'timezone': timezone,
|
89
99
|
'transactional_opted_in': transactional_opted_in,
|
90
100
|
'transactional_opted_out': transactional_opted_out,
|
91
|
-
'
|
101
|
+
'device_type': type,
|
102
|
+
'suppression_state': suppression_state
|
92
103
|
}.delete_if {|key, value| value.nil?} #this removes the nil key value pairs
|
93
104
|
|
94
105
|
payload = {'channel': channel_data}
|
@@ -102,6 +113,40 @@ module Urbanairship
|
|
102
113
|
logger.info("Updating email channel with address #{@address}")
|
103
114
|
response
|
104
115
|
end
|
116
|
+
|
117
|
+
def replace
|
118
|
+
fail ArgumentError, 'channel_id must be set to update email channel' if channel_id.nil?
|
119
|
+
fail ArgumentError, 'address must be set to update email channel' if address.nil?
|
120
|
+
fail ArgumentError, 'type must be set to update email channel' if type.nil?
|
121
|
+
|
122
|
+
channel_data = {
|
123
|
+
'address': address,
|
124
|
+
'click_tracking_opted_in': click_tracking_opted_in,
|
125
|
+
'click_tracking_opted_out': click_tracking_opted_out,
|
126
|
+
'commercial_opted_in': commercial_opted_in,
|
127
|
+
'commercial_opted_out': commercial_opted_out,
|
128
|
+
'locale_country': locale_country,
|
129
|
+
'locale_language': locale_language,
|
130
|
+
'open_tracking_opted_in': open_tracking_opted_in,
|
131
|
+
'open_tracking_opted_out': open_tracking_opted_out,
|
132
|
+
'suppression_state': suppression_state,
|
133
|
+
'timezone': timezone,
|
134
|
+
'transactional_opted_in': transactional_opted_in,
|
135
|
+
'transactional_opted_out': transactional_opted_out,
|
136
|
+
'type': type
|
137
|
+
}.delete_if {|key, value| value.nil?} #this removes the nil key value pairs
|
138
|
+
|
139
|
+
payload = {'channel': channel_data}
|
140
|
+
|
141
|
+
response = @client.send_request(
|
142
|
+
method: 'POST',
|
143
|
+
path: channel_path('email/replace/' + channel_id),
|
144
|
+
body: JSON.dump(payload),
|
145
|
+
content_type: 'application/json'
|
146
|
+
)
|
147
|
+
logger.info("Replacing email channel with address #{@address}")
|
148
|
+
response
|
149
|
+
end
|
105
150
|
end
|
106
151
|
|
107
152
|
class EmailTags < ChannelTags
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'urbanairship'
|
2
|
+
require 'base64'
|
3
|
+
require 'rest-client'
|
4
|
+
|
5
|
+
module Urbanairship
|
6
|
+
class Oauth
|
7
|
+
attr_accessor :client_id, :sub, :assertion_private_key, :ip_addresses, :scopes, :oauth_server
|
8
|
+
|
9
|
+
# Initialize Oauth class
|
10
|
+
#
|
11
|
+
# @param [String] client_id The Client ID found when creating Oauth credentials in the dashboard.
|
12
|
+
# @param [String] key The app key for the project.
|
13
|
+
# @param [String] assertion_private_key The private key found when creating Oauth credentials in the dashboard. Used for assertion token auth.
|
14
|
+
# @param [Array<String>] ip_addresses A list of CIDR representations of valid IP addresses to which the issued token is restricted. Example: ['24.20.40.0/22', '34.17.3.0/22']
|
15
|
+
# @param [Array<String>] scopes A list of scopes to which the issued token will be entitled. Example: ['psh', 'lst']
|
16
|
+
# @param [String] oauth_server The server to send Oauth token requests to. By default is 'oauth2.asnapius.com', but can be set to 'oauth2.asnapieu.com' if using the EU server.
|
17
|
+
# @return [Object] Oauth object
|
18
|
+
def initialize(client_id:, key:, assertion_private_key:, ip_addresses: [], scopes: [], oauth_server: Urbanairship.configuration.oauth_server)
|
19
|
+
@grant_type = 'client_credentials'
|
20
|
+
@client_id = client_id
|
21
|
+
@assertion_private_key = assertion_private_key
|
22
|
+
@ip_addresses = ip_addresses
|
23
|
+
@scopes = scopes
|
24
|
+
@sub = "app:#{key}"
|
25
|
+
@oauth_server = oauth_server
|
26
|
+
@token = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
# Get an Oauth token from Airship Oauth servers.
|
30
|
+
#
|
31
|
+
# @return [String] JSON web token to be used in further Airship API requests.
|
32
|
+
def get_token
|
33
|
+
unless @token.nil?
|
34
|
+
decoded_jwt = JWT.decode(@token, nil, false)
|
35
|
+
current_time = Time.now.to_i
|
36
|
+
expiry_time = decoded_jwt[0]['exp']
|
37
|
+
|
38
|
+
if current_time < expiry_time
|
39
|
+
return @token
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
assertion_jwt = build_assertion_jwt
|
44
|
+
|
45
|
+
url = "https://#{@oauth_server}/token"
|
46
|
+
headers = {
|
47
|
+
'Host': @oauth_server,
|
48
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
49
|
+
'Accept': 'application/json'
|
50
|
+
}
|
51
|
+
|
52
|
+
params = {
|
53
|
+
method: :post,
|
54
|
+
url: url,
|
55
|
+
headers: headers,
|
56
|
+
payload: {
|
57
|
+
grant_type: @grant_type,
|
58
|
+
assertion: assertion_jwt
|
59
|
+
},
|
60
|
+
timeout: 60
|
61
|
+
}
|
62
|
+
|
63
|
+
retries = 0
|
64
|
+
max_retries = 3
|
65
|
+
begin
|
66
|
+
response = RestClient::Request.execute(params)
|
67
|
+
@token = JSON.parse(response.body)['access_token']
|
68
|
+
return @token
|
69
|
+
rescue RestClient::ExceptionWithResponse => e
|
70
|
+
if [400, 401, 406].include?(e.response.code)
|
71
|
+
raise e
|
72
|
+
else
|
73
|
+
retries += 1
|
74
|
+
if retries <= max_retries
|
75
|
+
sleep(retries ** 2)
|
76
|
+
retry
|
77
|
+
else
|
78
|
+
new_error = RestClient::Exception.new(e.response, e.response.code)
|
79
|
+
new_error.message = "failed after 3 attempts with error: #{e}"
|
80
|
+
raise new_error
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Build an assertion JWT
|
87
|
+
#
|
88
|
+
# @return [String] Assertion JWT to be used when requesting an Oauth token from Airship servers.
|
89
|
+
def build_assertion_jwt
|
90
|
+
assertion_expiration = 61
|
91
|
+
private_key = OpenSSL::PKey::EC.new(@assertion_private_key)
|
92
|
+
|
93
|
+
headers = {
|
94
|
+
alg: 'ES384',
|
95
|
+
kid: @client_id
|
96
|
+
}
|
97
|
+
|
98
|
+
claims = {
|
99
|
+
aud: "https://#{@oauth_server}/token",
|
100
|
+
exp: Time.now.to_i + assertion_expiration,
|
101
|
+
iat: Time.now.to_i,
|
102
|
+
iss: @client_id,
|
103
|
+
nonce: SecureRandom.uuid,
|
104
|
+
sub: @sub
|
105
|
+
}
|
106
|
+
|
107
|
+
claims[:scope] = @scopes.join(' ') if @scopes.any?
|
108
|
+
claims[:ipaddr] = @ip_addresses.join(' ') if @ip_addresses.any?
|
109
|
+
|
110
|
+
JWT.encode(claims, private_key, 'ES384', headers)
|
111
|
+
end
|
112
|
+
|
113
|
+
# Verify a public key
|
114
|
+
#
|
115
|
+
# @param [String] key_id The key ID ('kid') found in the header when decoding an Oauth token granted from Airship's servers.
|
116
|
+
# @return [String] The public key associated with the Key ID.
|
117
|
+
def verify_public_key(key_id)
|
118
|
+
url = "https://#{@oauth_server}/verify/public_key/#{key_id}"
|
119
|
+
|
120
|
+
headers = {
|
121
|
+
'Host': @oauth_server,
|
122
|
+
'Accept': 'text/plain'
|
123
|
+
}
|
124
|
+
|
125
|
+
response = RestClient.get(url, headers)
|
126
|
+
response.body
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
data/lib/urbanairship/version.rb
CHANGED
data/lib/urbanairship.rb
CHANGED
@@ -15,6 +15,7 @@ require 'urbanairship/devices/create_and_send'
|
|
15
15
|
require 'urbanairship/devices/attribute'
|
16
16
|
require 'urbanairship/devices/attributes'
|
17
17
|
require 'urbanairship/client'
|
18
|
+
require 'urbanairship/oauth'
|
18
19
|
require 'urbanairship/common'
|
19
20
|
require 'urbanairship/configuration'
|
20
21
|
require 'urbanairship/loggable'
|
data/urbanairship.gemspec
CHANGED
@@ -28,8 +28,9 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
30
|
spec.add_runtime_dependency 'rest-client', '>= 1.4', '< 4.0'
|
31
|
+
spec.add_runtime_dependency 'jwt', '>= 2.0', '< 3.0'
|
31
32
|
|
32
|
-
spec.add_development_dependency 'bundler', '>= 1'
|
33
|
+
spec.add_development_dependency 'bundler', '>= 1', '< 2.5'
|
33
34
|
spec.add_development_dependency 'guard-rspec'
|
34
35
|
spec.add_development_dependency 'pry', '~> 0'
|
35
36
|
spec.add_development_dependency 'rake', '~> 12.3.3'
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airship
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,6 +30,26 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '4.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: jwt
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.0'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '3.0'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.0'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '3.0'
|
33
53
|
- !ruby/object:Gem::Dependency
|
34
54
|
name: bundler
|
35
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -37,6 +57,9 @@ dependencies:
|
|
37
57
|
- - ">="
|
38
58
|
- !ruby/object:Gem::Version
|
39
59
|
version: '1'
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.5'
|
40
63
|
type: :development
|
41
64
|
prerelease: false
|
42
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,6 +67,9 @@ dependencies:
|
|
44
67
|
- - ">="
|
45
68
|
- !ruby/object:Gem::Version
|
46
69
|
version: '1'
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '2.5'
|
47
73
|
- !ruby/object:Gem::Dependency
|
48
74
|
name: guard-rspec
|
49
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,6 +228,7 @@ files:
|
|
202
228
|
- lib/urbanairship/devices/static_lists.rb
|
203
229
|
- lib/urbanairship/devices/tag_lists.rb
|
204
230
|
- lib/urbanairship/loggable.rb
|
231
|
+
- lib/urbanairship/oauth.rb
|
205
232
|
- lib/urbanairship/push/audience.rb
|
206
233
|
- lib/urbanairship/push/payload.rb
|
207
234
|
- lib/urbanairship/push/push.rb
|
@@ -230,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
257
|
- !ruby/object:Gem::Version
|
231
258
|
version: '0'
|
232
259
|
requirements: []
|
233
|
-
rubygems_version: 3.
|
260
|
+
rubygems_version: 3.1.6
|
234
261
|
signing_key:
|
235
262
|
specification_version: 4
|
236
263
|
summary: Ruby Gem for using the Airship API
|