kindle-highlights 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7c203ab1e9aad56bd379b3e6b5cc664136f2c18
4
- data.tar.gz: 8182d4dfbfce7296a66785a2b595929cc6c18a3a
3
+ metadata.gz: dca078732a0f8c044fd58e477e04cca81e3c7ce4
4
+ data.tar.gz: 4b3f307f66e416299a2b9a7bcea222e23c2ca1aa
5
5
  SHA512:
6
- metadata.gz: 7414e1b4930c3aaaec740d37815749aa1e4f6ce87852d9051059688d1e7b978586cb5ee2694ed212ee0fb4f0c3a27741d07968e5a3c807cce53dd752c165a505
7
- data.tar.gz: aef2a7e0ea42a2c40c02abc42d4af20329645e1c5f9ca137dc2a57818205762f18226826a2bb8cb86f128fd767f12eb55230fc24d00a3360c6ecca71a43be1aa
6
+ metadata.gz: 374c237750768c482a465071098bd9dec30d894cfd242013fb94e3fc02d105bac4fdbaf410e0b95aa02093e312e1a2af2fe7a23569968f08c19b8acf332b07cb
7
+ data.tar.gz: bcf457268d3992b8984c9acdbe555bafb0ce9057d5093cf0d7db0e99d7ebf8d52b745efa59768327d0bbb1a469b986855fcc904abac99a4568d1d751ceae1fdb
@@ -1,6 +1,7 @@
1
1
  module KindleHighlights
2
2
  class Client
3
3
  class CaptchaError < StandardError; end
4
+ class AuthenticationError < StandardError; end
4
5
 
5
6
  attr_writer :mechanize_agent
6
7
  attr_accessor :kindle_logged_in_page
@@ -49,6 +50,9 @@ module KindleHighlights
49
50
  if post_signin_page.search("#ap_captcha_img").any?
50
51
  resolution_url = post_signin_page.link_with(text: /See a new challenge/).resolved_uri.to_s
51
52
  raise CaptchaError, "Received a CAPTCHA while attempting to sign in to your Amazon account. You will need to resolve this manually at #{resolution_url}"
53
+ elsif post_signin_page.search("#message_error > p").any?
54
+ amazon_error = post_signin_page.search("#message_error > p").children.first.to_s.strip
55
+ raise AuthenticationError, "Unable to sign in, received error: '#{amazon_error}'"
52
56
  else
53
57
  @kindle_logged_in_page = post_signin_page
54
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindle-highlights
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Farkas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize