amazon_auth 0.2.1 → 0.3.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/README.md +21 -19
- data/lib/amazon_auth/capybara.rb +6 -0
- data/lib/amazon_auth/client.rb +3 -0
- data/lib/amazon_auth/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04a18c43fe199086bfa94cb3c6eeb96d6c418f16
|
|
4
|
+
data.tar.gz: d6a43c21ebfb9e81cc18c917ec3351958af4a04a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce2c1e9a62fce22901ac94c3e48bdcf740cf261df96ba10456ead755152fca65037f3a91b9acb4f7d98513438d1e250fd2ce047bb78cc96dd719c71cf09ff523
|
|
7
|
+
data.tar.gz: 742268eb916028b5927723ecd0ec4911a9feab20aadcaa1fec52960f6657da974600ad3badf960866e03c1f7bd16b29d9eeb3905ab4fed5e6f89ffa4b4b44f2c
|
data/README.md
CHANGED
|
@@ -26,19 +26,15 @@ Or install it yourself as:
|
|
|
26
26
|
|
|
27
27
|
## Requirements
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
- chromedriver
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Don't forget to disable automatic updates of Firefox.
|
|
35
|
-
|
|
36
|
-
You may also need geckodriver.
|
|
37
|
-
This may need to be older depending on the version of selenium-webdriver.
|
|
38
|
-
|
|
39
|
-
[Download geckodriver](https://github.com/mozilla/geckodriver/releases)
|
|
31
|
+
Before running, you need to **download chromedriver**.
|
|
32
|
+
And you may need to **update chromedriver regularly**.
|
|
33
|
+
Please download latest chromedriver_xxx.zip from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
```
|
|
36
|
+
mv ~/Downloads/chromedriver /usr/local/bin/
|
|
37
|
+
```
|
|
42
38
|
|
|
43
39
|
## Usage
|
|
44
40
|
|
|
@@ -77,21 +73,27 @@ Set `AMAZON_DOMAIN` in _.env_.
|
|
|
77
73
|
|
|
78
74
|
e.g. `AMAZON_DOMAIN=amazon.co.jp` for Japanese site
|
|
79
75
|
|
|
80
|
-
### Use
|
|
76
|
+
### Use Firefox
|
|
81
77
|
|
|
82
|
-
|
|
78
|
+
This gem may not work with newer versions of Firefox.
|
|
79
|
+
Check README of [capybara](https://github.com/teamcapybara/capybara).
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
Please download latest chromedriver_xxx.zip from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
|
|
81
|
+
Firefox (<= 47.0.2) may work better.
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
[Download Firefox](https://ftp.mozilla.org/pub/firefox/releases/)
|
|
84
|
+
Don't forget to disable automatic updates of Firefox.
|
|
85
|
+
|
|
86
|
+
You may also need geckodriver.
|
|
87
|
+
This may need to be older depending on the version of selenium-webdriver.
|
|
88
|
+
|
|
89
|
+
[Download geckodriver](https://github.com/mozilla/geckodriver/releases)
|
|
90
|
+
|
|
91
|
+
If the browser doesn't work, try selenium-webdriver version '~> 2.0' or different version of geckodriver/Firefox.
|
|
90
92
|
|
|
91
93
|
In console,
|
|
92
94
|
|
|
93
95
|
```
|
|
94
|
-
client = AmazonAuth::Client.new(driver: :
|
|
96
|
+
client = AmazonAuth::Client.new(driver: :firefox)
|
|
95
97
|
```
|
|
96
98
|
|
|
97
99
|
## Development
|
data/lib/amazon_auth/capybara.rb
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
Capybara.register_driver :selenium do |app|
|
|
2
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
|
3
|
+
end
|
|
1
4
|
Capybara.register_driver :chrome do |app|
|
|
2
5
|
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
|
3
6
|
end
|
|
7
|
+
Capybara.register_driver :firefox do |app|
|
|
8
|
+
Capybara::Selenium::Driver.new(app, browser: :firefox)
|
|
9
|
+
end
|
data/lib/amazon_auth/client.rb
CHANGED
|
@@ -21,6 +21,8 @@ module AmazonAuth
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
@driver = options.fetch(:driver, :selenium)
|
|
24
|
+
|
|
25
|
+
Capybara.app_host = @initial_url
|
|
24
26
|
rescue => e
|
|
25
27
|
puts "Please setup credentials of amazon_auth gem with folloing its instruction."
|
|
26
28
|
raise e
|
|
@@ -51,6 +53,7 @@ module AmazonAuth
|
|
|
51
53
|
session.fill_in 'ap_password', with: @password
|
|
52
54
|
if image_recognition_displayed?
|
|
53
55
|
input = ask "Got the prompt. Read characters from the image: "
|
|
56
|
+
return true if input.blank? || !session.first('#auth-captcha-guess') # Skip when form is submitted manually
|
|
54
57
|
session.fill_in 'auth-captcha-guess', with: input
|
|
55
58
|
end
|
|
56
59
|
sleep 1
|
data/lib/amazon_auth/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: amazon_auth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kazuho Yamaguchi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: capybara
|
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
182
182
|
version: '0'
|
|
183
183
|
requirements: []
|
|
184
184
|
rubyforge_project:
|
|
185
|
-
rubygems_version: 2.6.
|
|
185
|
+
rubygems_version: 2.6.8
|
|
186
186
|
signing_key:
|
|
187
187
|
specification_version: 4
|
|
188
188
|
summary: Login amazon.
|