amazon-drs 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/amazon-drs/client.rb +8 -7
- data/lib/amazon-drs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd05c5984943ffa279e99ad7505294c457a08d40
|
4
|
+
data.tar.gz: 9956785a162a929d1762c5ce944fe4a54e3c6281
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e33ea67ba8b0d9f1798870e02839eb764d9f95fbdd5bf4ef5242073884561b0ddca501ca8470a1edde1ec6eaa9a46c28a4501cb77901fd1f4ed125dd063c08b0
|
7
|
+
data.tar.gz: cd8c1a39f3f9ffabe438bad67c047291c1aa2c5dffde97d377d1d3998cca813c9273b983d6d6e56bd5560a92fed95bc29179ce41a58e98a428a97635cb2a3cd2
|
data/lib/amazon-drs/client.rb
CHANGED
@@ -4,7 +4,6 @@ require 'json'
|
|
4
4
|
require 'yaml'
|
5
5
|
require 'time'
|
6
6
|
require 'date'
|
7
|
-
require 'amazon-drs/config'
|
8
7
|
|
9
8
|
class Net::HTTPResponse
|
10
9
|
attr_accessor :json
|
@@ -12,7 +11,7 @@ end
|
|
12
11
|
|
13
12
|
module AmazonDrs
|
14
13
|
class Client
|
15
|
-
attr_accessor :device_model, :serial, :authorization_code, :redirect_uri, :access_token, :refresh_token
|
14
|
+
attr_accessor :device_model, :serial, :authorization_code, :redirect_uri, :access_token, :refresh_token, :client_id, :client_secret
|
16
15
|
attr_accessor :on_new_token
|
17
16
|
attr_writer :user_agent
|
18
17
|
|
@@ -26,6 +25,8 @@ module AmazonDrs
|
|
26
25
|
@access_token = nil
|
27
26
|
@refresh_token = nil
|
28
27
|
@on_new_token = nil
|
28
|
+
@client_id = nil
|
29
|
+
@client_secret = nil
|
29
30
|
yield(self) if block_given?
|
30
31
|
end
|
31
32
|
|
@@ -151,8 +152,8 @@ module AmazonDrs
|
|
151
152
|
params = {
|
152
153
|
grant_type: 'refresh_token',
|
153
154
|
refresh_token: @refresh_token,
|
154
|
-
client_id:
|
155
|
-
client_secret:
|
155
|
+
client_id: @client_id,
|
156
|
+
client_secret: @client_secret
|
156
157
|
}
|
157
158
|
@access_token = nil
|
158
159
|
request(:post, "https://#{@amazon_host}/auth/o2/token", params: params)
|
@@ -162,9 +163,9 @@ module AmazonDrs
|
|
162
163
|
params = {
|
163
164
|
grant_type: 'authorization_code',
|
164
165
|
code: @authorization_code,
|
165
|
-
client_id:
|
166
|
-
client_secret:
|
167
|
-
redirect_uri:
|
166
|
+
client_id: @client_id,
|
167
|
+
client_secret: @client_secret,
|
168
|
+
redirect_uri: @redirect_uri
|
168
169
|
}
|
169
170
|
request(:post, "https://#{@amazon_host}/auth/o2/token", params: params)
|
170
171
|
end
|
data/lib/amazon-drs/version.rb
CHANGED