adops_report_scrapper 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/lib/adops_report_scrapper/spotxchange_client.rb +18 -3
- data/lib/adops_report_scrapper/version.rb +1 -1
- data/secret.sample.yml +2 -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: 2062161736aa199788f24a787649cc654fce4f67
|
4
|
+
data.tar.gz: dd424d62acb31fc097d8a4dd6951aa9b75e37d5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8e3e4d325b51ff318ab3a944d2c2fbcdc29bd7583a0e5287000417fec93377fc7bc1f5ebdf5edd07894337c059bc6307efac91ec5edc88a5c3189bd203d065f
|
7
|
+
data.tar.gz: 9090366aabcb84f92dc3c86127059e5d29d70cac949a0a98c88b6dcca2759ad65dd29baa4042da5b555df047e13f159e329150bc05ac6e86ccb0acc4c2baba2d
|
data/CHANGELOG
CHANGED
@@ -12,8 +12,11 @@ class AdopsReportScrapper::SpotxchangeClient < AdopsReportScrapper::BaseClient
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def init_client
|
15
|
-
fail 'please specify spotxchange oauth
|
16
|
-
@
|
15
|
+
fail 'please specify spotxchange oauth client_id' unless @options['client_id']
|
16
|
+
@client_id = @options['client_id']
|
17
|
+
fail 'please specify spotxchange oauth client_secret' unless @options['client_secret']
|
18
|
+
@client_secret = @options['client_secret']
|
19
|
+
super
|
17
20
|
end
|
18
21
|
|
19
22
|
def before_quit_with_error
|
@@ -22,7 +25,19 @@ class AdopsReportScrapper::SpotxchangeClient < AdopsReportScrapper::BaseClient
|
|
22
25
|
def scrap
|
23
26
|
date_str = @date.strftime('%Y-%m-%d')
|
24
27
|
|
25
|
-
|
28
|
+
@client.visit "https://publisher-api.spotxchange.com/oauth2/publisher/approval.html?client_id=#{@client_id}&response_type=code&state=xyz"
|
29
|
+
@client.click_button 'Accept'
|
30
|
+
|
31
|
+
@client.fill_in 'Username', :with => @login
|
32
|
+
@client.fill_in 'Password', :with => @secret
|
33
|
+
@client.click_button 'Login'
|
34
|
+
|
35
|
+
@client.click_button 'Accept'
|
36
|
+
sleep 1
|
37
|
+
|
38
|
+
code = URI::decode_www_form(URI.parse(@client.driver.network_traffic.last.url).query).to_h['code']
|
39
|
+
|
40
|
+
body = { 'client_id' => @client_id, 'client_secret' => @client_secret, 'grant_type' => 'authorization_code', 'code' => code }
|
26
41
|
response = HTTPClient.post 'https://publisher-api.spotxchange.com/1.0/token', body
|
27
42
|
token = JSON.parse(response.body)['value']['data']['access_token']
|
28
43
|
|
data/secret.sample.yml
CHANGED