graybook 1.1.0 → 1.1.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 1
4
- :patch: 0
4
+ :patch: 1
data/VERSION_NAME CHANGED
@@ -1 +1 @@
1
- Gray Grouper
1
+ Gray Groundhog
@@ -29,17 +29,18 @@ class Graybook::Importer::Aol < Graybook::Importer::PageScraper
29
29
 
30
30
  case page.body
31
31
  when /Invalid Screen Name or Password. Please try again./
32
- return Problem.new("Username and password were not accepted. Please check them and try again.")
32
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
33
33
  when /Terms of Service/
34
- return Problem.new("Your AOL account is not setup for WebMail. Please signup: http://webmail.aol.com")
34
+ return Graybook::Problem.new("Your AOL account is not setup for WebMail. Please signup: http://webmail.aol.com")
35
35
  end
36
36
 
37
37
  # aol bumps to a wait page while logging in. if we can't scrape out the js then its a bad login
38
38
  extractor = proc { |var_name| page.body.scan(/var\s*#{var_name}\s*=\s*\"(.*?)\"\s*;/).first.first }
39
39
 
40
40
  base_uri = extractor.call( 'gSuccessPath' )
41
- return Problem.new("An error occurred. Please try again.") unless base_uri
41
+ return Graybook::Problem.new("An error occurred. Please try again.") unless base_uri
42
42
  page = agent.get base_uri
43
+ true
43
44
  end
44
45
 
45
46
  ##
@@ -56,7 +57,7 @@ class Graybook::Importer::Aol < Graybook::Importer::PageScraper
56
57
 
57
58
  def scrape_contacts
58
59
  unless auth_cookie = agent.cookies.find{|c| c.name =~ /^Auth/}
59
- return Problem.new("An error occurred. Please try again.")
60
+ return Graybook::Problem.new("An error occurred. Please try again.")
60
61
  end
61
62
 
62
63
  # jump through the hoops of formulating a request to get printable contacts
@@ -33,11 +33,12 @@ class Graybook::Importer::Gmail < Graybook::Importer::PageScraper
33
33
  form.Passwd = options[:password]
34
34
  page = agent.submit(form,form.buttons.first)
35
35
 
36
- return Problem.new("Username and password were not accepted. Please check them and try again.") if page.body =~ /Username and password do not match/
36
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.") if page.body =~ /Username and password do not match/
37
37
 
38
38
  if page.search('//meta').first.attributes['content'] =~ /url='?(http.+?)'?$/i
39
39
  page = agent.get $1
40
40
  end
41
+ true
41
42
  end
42
43
 
43
44
  ##
@@ -54,7 +55,7 @@ class Graybook::Importer::Gmail < Graybook::Importer::PageScraper
54
55
  unless agent.cookies.find { |c|
55
56
  c.name == 'GAUSR' && c.value.match(/mail(.*?):#{options[:username]}/)
56
57
  }
57
- return Problem.new("Username and password were not accepted. Please check them and try again.")
58
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
58
59
  end
59
60
 
60
61
  page = agent.get('http://mail.google.com/mail/h/?v=cl&pnl=a')
@@ -51,10 +51,11 @@ class Graybook::Importer::Hotmail < Graybook::Importer::PageScraper
51
51
  # Check for login success
52
52
  if page.body =~ /The e-mail address or password is incorrect/ ||
53
53
  page.body =~ /Sign in failed\./
54
- return Problem.new("Username and password were not accepted. Please check them and try again.")
54
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
55
55
  end
56
56
 
57
57
  @first_page = agent.get( page.body.scan(/http\:\/\/[^"]+/).first )
58
+ true
58
59
  end
59
60
 
60
61
  ##
@@ -71,7 +72,7 @@ class Graybook::Importer::Hotmail < Graybook::Importer::PageScraper
71
72
 
72
73
  def scrape_contacts
73
74
  unless agent.cookies.find{|c| c.name == 'MSPPre' && c.value == options[:username]}
74
- return Problem.new("Username and password were not accepted. Please check them and try again.")
75
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
75
76
  end
76
77
 
77
78
  page = agent.get('http://mail.live.com/')
@@ -62,8 +62,7 @@ class Graybook::Importer::PageScraper < Graybook::Importer::Base
62
62
  create_agent
63
63
  prep = prepare
64
64
  return prep if prep.nil?
65
- cont = scrape_contacts
66
- return cont if cont.nil?
65
+ scrape_contacts
67
66
  end
68
67
 
69
68
  ##
@@ -24,7 +24,7 @@ class Graybook::Importer::Yahoo < Graybook::Importer::PageScraper
24
24
  page = agent.submit(form, form.buttons.first)
25
25
 
26
26
  if page.body =~ /Invalid ID or password./ || page.body =~ /This ID is not yet taken./
27
- return Problem.new("Username and password were not accepted. Please check them and try again.")
27
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
28
28
  end
29
29
 
30
30
  true
@@ -43,7 +43,7 @@ class Graybook::Importer::Yahoo < Graybook::Importer::PageScraper
43
43
  def scrape_contacts
44
44
  page = agent.get("http://address.yahoo.com/?1=&VPC=import_export")
45
45
  if page.body =~ /To access Yahoo! Address Book\.\.\..*Sign in./m
46
- return Problem.new("Username and password were not accepted. Please check them and try again.")
46
+ return Graybook::Problem.new("Username and password were not accepted. Please check them and try again.")
47
47
  end
48
48
  form = page.forms.last
49
49
  csv = agent.submit(form, form.buttons[2]) # third button is Yahoo-format CSV
data/lib/graybook.rb CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
 
5
5
  class Graybook
6
6
  include ::Singleton
7
- VERSION = '1.1.0'
7
+ VERSION = '1.1.1'
8
8
 
9
9
  class Problem < Exception
10
10
  def nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graybook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojul