amazon_auth 0.6.0 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a45eff39c70d3750f6bb7edd67f68ae06f9e8b8290601aa4fe30f4ac89f3ec9c
4
- data.tar.gz: d22f3c9195a3120b5f900824357093003b3c2760c8d3ff9d1a17d323ce5cc8ed
3
+ metadata.gz: be42ef6936b600922637d6ff82740c6cb355b8574336ba18142729fbcd5ab394
4
+ data.tar.gz: ec6d91bf0e702c892ae26e2d4edd5db2095bc6b322c78bc4b2dc3dd54f4a9beb
5
5
  SHA512:
6
- metadata.gz: 4fc2ef8f1b551796f6b3efb359987db8a48d05ce51d75d055275c639dd950e51d8f99a90fe5afc4b646940b9bb142b49adc984ee2a922d1b0d2c7cbbc988e022
7
- data.tar.gz: 2571de906fdc1470088cb9e71db7d6ac87748e649f6be73beceede17447865e5f597ad9f1cf44edd5748db747e7b15bf45daaf9eb5887d9306472766bdb25b89
6
+ metadata.gz: ac1946c5930553fdee2febf9abd735eba70c033247edb679f2a06a4c16d8d309c7e97d03a0fbef6c69df7ccb05e9c06328e1985e7180e8636006a2374ef75a24
7
+ data.tar.gz: ceb6c2bbb0d5f8cf37129ab9d906eadecfaf6b3db0efa5d15476901f2487d55ef25b195ddff73581590877e80030e328468056744ae310252b2256512a3362b7
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # AmazonAuth
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/amazon_auth.svg)](https://badge.fury.io/rb/amazon_auth)
4
- [![Build Status](https://travis-ci.org/kyamaguchi/amazon_auth.svg?branch=master)](https://travis-ci.org/kyamaguchi/amazon_auth)
4
+ [![CircleCI](https://circleci.com/gh/kyamaguchi/amazon_auth.svg?style=svg)](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 http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
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.
data/amazon_auth.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/kyamaguchi/amazon_auth"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) || f.start_with?('.') }
17
17
  spec.bindir = "exe"
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
@@ -7,7 +7,7 @@ module AmazonAuth
7
7
 
8
8
  def encode(str)
9
9
  raise "Empty string" if str.to_s.size == 0
10
- Base64.strict_encode64("#{salt}#{str}")
10
+ ::Base64.strict_encode64("#{salt}#{str}")
11
11
  end
12
12
 
13
13
  def salt
@@ -16,7 +16,7 @@ module AmazonAuth
16
16
 
17
17
  def self.decode(code)
18
18
  raise "Empty string" if code.to_s.size == 0
19
- Base64.strict_decode64(code).gsub(/\A#{salt}/, '')
19
+ ::Base64.strict_decode64(code).gsub(/\A#{salt}/, '')
20
20
  end
21
21
 
22
22
  def self.salt
@@ -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 (link = find_sign_in_link)
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
@@ -1,3 +1,3 @@
1
1
  module AmazonAuth
2
- VERSION = "0.6.0"
2
+ VERSION = "0.8.0"
3
3
  end
data/lib/amazon_auth.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'dotenv'
2
2
  Dotenv.load
3
+ require 'base64'
3
4
  require "active_support/all"
4
5
  require "capybara"
5
6
  require "capybara/sessionkeeper"
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.6.0
4
+ version: 0.8.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: 2021-01-13 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -158,9 +158,6 @@ executables:
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
- - ".gitignore"
162
- - ".rspec"
163
- - ".travis.yml"
164
161
  - Gemfile
165
162
  - LICENSE.txt
166
163
  - README.md
@@ -181,7 +178,7 @@ homepage: https://github.com/kyamaguchi/amazon_auth
181
178
  licenses:
182
179
  - MIT
183
180
  metadata: {}
184
- post_install_message:
181
+ post_install_message:
185
182
  rdoc_options: []
186
183
  require_paths:
187
184
  - lib
@@ -196,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
193
  - !ruby/object:Gem::Version
197
194
  version: '0'
198
195
  requirements: []
199
- rubygems_version: 3.0.3
200
- signing_key:
196
+ rubygems_version: 3.1.6
197
+ signing_key:
201
198
  specification_version: 4
202
199
  summary: Login amazon.
203
200
  test_files: []
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /.env
11
- /.env.development
12
- /.byebug_history
13
- /.ruby-version
14
- /.rspec_status
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.8
5
- - 2.6.6
6
- - 2.7.1
7
- before_install: gem install bundler