amazon_auth 0.4.6 → 0.7.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/.circleci/config.yml +21 -0
- data/README.md +2 -21
- data/lib/amazon_auth/extensions/session_extension.rb +21 -1
- data/lib/amazon_auth/version.rb +1 -1
- metadata +7 -7
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2616112a7c77ce7a370145836360fc55df643716450e6222d95affa6c1b942ec
|
4
|
+
data.tar.gz: e96f0dad4d371aeaf0c6bd7dc325cd252fea806e992c322aceef88e01e5c7cc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a18f9d6ce597e2c12a96bdf6748bc8eda365533f8d5daebd968282a58dfb330cf12adfc7c057b529b1b5e20a05a9c61e9a41ba5cf8c0922b27db921f656f0f4a
|
7
|
+
data.tar.gz: 99b3832589d28b9e4eebf5bf4fc3fe590ecc5b57ec6031a5b5e4854d472add8d700b1abf118d10d9dfb441454d1ce2152c6d95220726b474e446f200b7d8b1db
|
@@ -0,0 +1,21 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
parameters:
|
6
|
+
ruby-version:
|
7
|
+
type: string
|
8
|
+
docker:
|
9
|
+
- image: cimg/ruby:<< parameters.ruby-version >>-browsers
|
10
|
+
steps:
|
11
|
+
- checkout
|
12
|
+
- run: bundle install
|
13
|
+
- run: bundle exec rspec
|
14
|
+
|
15
|
+
workflows:
|
16
|
+
all-tests:
|
17
|
+
jobs:
|
18
|
+
- test:
|
19
|
+
matrix:
|
20
|
+
parameters:
|
21
|
+
ruby-version: ["2.7.5", "3.0.3"]
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# AmazonAuth
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/amazon_auth)
|
4
|
-
[](https://circleci.com/gh/kyamaguchi/amazon_auth)
|
5
5
|
|
6
6
|
Sign In Amazon using Capybara and Selenium
|
7
7
|
|
@@ -31,7 +31,7 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
Before running, you need to **download chromedriver**.
|
33
33
|
And you may need to **update chromedriver regularly**.
|
34
|
-
Please download latest chromedriver_xxx.zip from
|
34
|
+
Please download latest chromedriver_xxx.zip from https://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
|
35
35
|
|
36
36
|
```
|
37
37
|
mv ~/Downloads/chromedriver /usr/local/bin/
|
@@ -120,31 +120,12 @@ client = AmazonAuth::Client.new(debug: true)
|
|
120
120
|
|
121
121
|
### Use Firefox
|
122
122
|
|
123
|
-
This gem may not work with newer versions of Firefox.
|
124
|
-
Check README of [capybara](https://github.com/teamcapybara/capybara).
|
125
|
-
|
126
|
-
Firefox (<= 47.0.2) may work better.
|
127
|
-
|
128
|
-
[Download Firefox](https://ftp.mozilla.org/pub/firefox/releases/)
|
129
|
-
Don't forget to disable automatic updates of Firefox.
|
130
|
-
|
131
|
-
You may also need geckodriver.
|
132
|
-
This may need to be older depending on the version of selenium-webdriver.
|
133
|
-
|
134
|
-
[Download geckodriver](https://github.com/mozilla/geckodriver/releases)
|
135
|
-
|
136
|
-
If the browser doesn't work, try selenium-webdriver version '~> 2.0' or different version of geckodriver/Firefox.
|
137
|
-
|
138
123
|
In console,
|
139
124
|
|
140
125
|
```
|
141
126
|
client = AmazonAuth::Client.new(driver: :firefox)
|
142
127
|
```
|
143
128
|
|
144
|
-
## TODO
|
145
|
-
|
146
|
-
- [Idea] Hook `submit_signin_form` after every `visit` and `click` action
|
147
|
-
|
148
129
|
## Development
|
149
130
|
|
150
131
|
Use _.env.development_ instead of _.env_ in development.
|
@@ -29,7 +29,9 @@ module AmazonAuth
|
|
29
29
|
session.visit url
|
30
30
|
debug "Visiting #{url}"
|
31
31
|
restore_cookies if keep_cookie?
|
32
|
-
if (
|
32
|
+
if session.current_url.include?('/ap/signin')
|
33
|
+
debug "current_url: [#{session.current_url}]"
|
34
|
+
elsif (link = find_sign_in_link)
|
33
35
|
debug "link: [#{link}]"
|
34
36
|
session.visit(link)
|
35
37
|
end
|
@@ -105,6 +107,24 @@ module AmazonAuth
|
|
105
107
|
session.has_selector?('#auth-captcha-image-container')
|
106
108
|
end
|
107
109
|
|
110
|
+
def find_sign_in_link
|
111
|
+
m1 = session.html.match(%r{(/ap/signin[^'"]+)['"]})
|
112
|
+
return CGI.unescapeHTML(m1[1]) if m1
|
113
|
+
|
114
|
+
# Maybe the following patterns are deprecated
|
115
|
+
link = links_for('a').find{|l| l =~ %r{\A/gp/navigation/redirector.html} }
|
116
|
+
if link
|
117
|
+
debug "Found a link [#{link}]"
|
118
|
+
return link
|
119
|
+
end
|
120
|
+
m2 = session.html.match(%r{'(/gp/navigation/redirector.html[^']+)'})
|
121
|
+
if m2
|
122
|
+
debug "Found a link (.html.match) [#{m2[1]}]"
|
123
|
+
return m2[1]
|
124
|
+
end
|
125
|
+
nil
|
126
|
+
end
|
127
|
+
|
108
128
|
private
|
109
129
|
|
110
130
|
def login
|
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuho Yamaguchi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -158,9 +158,9 @@ executables:
|
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
|
+
- ".circleci/config.yml"
|
161
162
|
- ".gitignore"
|
162
163
|
- ".rspec"
|
163
|
-
- ".travis.yml"
|
164
164
|
- Gemfile
|
165
165
|
- LICENSE.txt
|
166
166
|
- README.md
|
@@ -181,7 +181,7 @@ homepage: https://github.com/kyamaguchi/amazon_auth
|
|
181
181
|
licenses:
|
182
182
|
- MIT
|
183
183
|
metadata: {}
|
184
|
-
post_install_message:
|
184
|
+
post_install_message:
|
185
185
|
rdoc_options: []
|
186
186
|
require_paths:
|
187
187
|
- lib
|
@@ -196,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
- !ruby/object:Gem::Version
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
|
-
rubygems_version: 3.
|
200
|
-
signing_key:
|
199
|
+
rubygems_version: 3.1.6
|
200
|
+
signing_key:
|
201
201
|
specification_version: 4
|
202
202
|
summary: Login amazon.
|
203
203
|
test_files: []
|