name_checker 0.0.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.
Files changed (38) hide show
  1. data/.gitignore +21 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +22 -0
  5. data/README.md +66 -0
  6. data/Rakefile +2 -0
  7. data/lib/name_checker.rb +27 -0
  8. data/lib/name_checker/availability.rb +39 -0
  9. data/lib/name_checker/configuration.rb +30 -0
  10. data/lib/name_checker/facebook_checker.rb +37 -0
  11. data/lib/name_checker/logging.rb +26 -0
  12. data/lib/name_checker/net_checker.rb +15 -0
  13. data/lib/name_checker/railties.rb +7 -0
  14. data/lib/name_checker/robo_whois_checker.rb +61 -0
  15. data/lib/name_checker/twitter_checker.rb +67 -0
  16. data/lib/name_checker/version.rb +3 -0
  17. data/name_checker.gemspec +25 -0
  18. data/spec/fixtures/vcr_cassettes/facebook/available.yml +44 -0
  19. data/spec/fixtures/vcr_cassettes/facebook/unavailable.yml +42 -0
  20. data/spec/fixtures/vcr_cassettes/facebook/weird_chars.yml +42 -0
  21. data/spec/fixtures/vcr_cassettes/robo_whois/available.yml +48 -0
  22. data/spec/fixtures/vcr_cassettes/robo_whois/credits.yml +48 -0
  23. data/spec/fixtures/vcr_cassettes/robo_whois/unavailable.yml +48 -0
  24. data/spec/fixtures/vcr_cassettes/twitter/available.yml +55 -0
  25. data/spec/fixtures/vcr_cassettes/twitter/rate_limit.yml +61 -0
  26. data/spec/fixtures/vcr_cassettes/twitter/suspended.yml +55 -0
  27. data/spec/fixtures/vcr_cassettes/twitter/unavailable.yml +61 -0
  28. data/spec/name_checker/availability_spec.rb +39 -0
  29. data/spec/name_checker/facebook_checker_spec.rb +54 -0
  30. data/spec/name_checker/net_checker_spec.rb +26 -0
  31. data/spec/name_checker/robo_whois_checker_spec.rb +59 -0
  32. data/spec/name_checker/twitter_checker_spec.rb +72 -0
  33. data/spec/name_checker/whois_checker.rb +10 -0
  34. data/spec/name_checker/whois_checker_spec.rb +33 -0
  35. data/spec/name_checker_spec.rb +24 -0
  36. data/spec/spec_helper.rb +27 -0
  37. data/spec/support/helpers.rb +12 -0
  38. metadata +149 -0
@@ -0,0 +1,3 @@
1
+ module NameChecker
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/name_checker/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["David Tuite"]
6
+ gem.email = ["dtuite@gmail.com"]
7
+ gem.summary = %q{Check the availability of a name on various services.}
8
+ gem.description = <<-EOF
9
+ NameChecker is a Ruby library for checking the availability of a word across various TLDs and social networks. It was created to power http://domiy.com.
10
+ EOF
11
+ gem.homepage = ""
12
+
13
+ gem.files = `git ls-files`.split($\)
14
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.name = "name_checker"
17
+ gem.require_paths = ["lib"]
18
+ gem.version = NameChecker::VERSION
19
+
20
+ gem.add_development_dependency "rspec"
21
+ gem.add_development_dependency "vcr"
22
+
23
+ gem.add_dependency "httparty"
24
+ gem.add_dependency "whois"
25
+ end
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://graph.facebook.com/sdfjksdh
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 404
13
+ message: Not Found
14
+ headers:
15
+ Access-Control-Allow-Origin:
16
+ - ! '*'
17
+ Cache-Control:
18
+ - no-store
19
+ Content-Type:
20
+ - text/javascript; charset=UTF-8
21
+ Expires:
22
+ - Sat, 01 Jan 2000 00:00:00 GMT
23
+ Pragma:
24
+ - no-cache
25
+ Www-Authenticate:
26
+ - ! 'OAuth "Facebook Platform" "not_found" "(#803) Some of the aliases you requested
27
+ do not exist: sdfjksdh"'
28
+ X-Fb-Rev:
29
+ - '557325'
30
+ X-Fb-Debug:
31
+ - T9Tc2QCrwrA2kdzKn80LrtZB9z2T9UDKjfYC0Tm2uDk=
32
+ Date:
33
+ - Tue, 15 May 2012 13:46:59 GMT
34
+ Content-Length:
35
+ - '122'
36
+ Connection:
37
+ - keep-alive
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ! '{"error":{"message":"(#803) Some of the aliases you requested do
41
+ not exist: sdfjksdh","type":"OAuthException","code":803}}'
42
+ http_version:
43
+ recorded_at: Tue, 15 May 2012 13:46:59 GMT
44
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://graph.facebook.com/davidtuite
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Access-Control-Allow-Origin:
16
+ - ! '*'
17
+ Cache-Control:
18
+ - private, no-cache, no-store, must-revalidate
19
+ Content-Type:
20
+ - text/javascript; charset=UTF-8
21
+ Etag:
22
+ - ! '"7aac069a894f488e0ab622bad887af759b1a6a4d"'
23
+ Expires:
24
+ - Sat, 01 Jan 2000 00:00:00 GMT
25
+ Pragma:
26
+ - no-cache
27
+ X-Fb-Rev:
28
+ - '557325'
29
+ X-Fb-Debug:
30
+ - XkOsmXV0sgwfPwI3yYdKP9IN4DpCpqqJuNREBKssYRI=
31
+ Date:
32
+ - Tue, 15 May 2012 13:47:00 GMT
33
+ Content-Length:
34
+ - '185'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '{"id":"37300597","name":"David Tuite","first_name":"David","last_name":"Tuite","link":"http:\/\/www.facebook.com\/david.tuite","username":"david.tuite","gender":"male","locale":"en_GB"}'
40
+ http_version:
41
+ recorded_at: Tue, 15 May 2012 13:47:00 GMT
42
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://graph.facebook.com/rememberly
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Access-Control-Allow-Origin:
16
+ - ! '*'
17
+ Cache-Control:
18
+ - private, no-cache, no-store, must-revalidate
19
+ Content-Type:
20
+ - text/javascript; charset=UTF-8
21
+ Etag:
22
+ - ! '"7256d766c1b445f69e8ba3a69d53f6105556b942"'
23
+ Expires:
24
+ - Sat, 01 Jan 2000 00:00:00 GMT
25
+ Pragma:
26
+ - no-cache
27
+ X-Fb-Rev:
28
+ - '557325'
29
+ X-Fb-Debug:
30
+ - mzIN8RtmmR2+tcbC0vSdfhzkhr5FIaHv1xUdy3PGuhs=
31
+ Date:
32
+ - Tue, 15 May 2012 13:47:01 GMT
33
+ Content-Length:
34
+ - '205'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '{"id":"100000185260051","name":"\u5289\u51a0\u986f","first_name":"\u51a0\u986f","last_name":"\u5289","link":"http:\/\/www.facebook.com\/rememberly","username":"rememberly","gender":"male","locale":"zh_TW"}'
40
+ http_version:
41
+ recorded_at: Tue, 15 May 2012 13:47:01 GMT
42
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ROBO_WHOIS_API_KEY:X@api.robowhois.com/whois/fwekjfkewfhwefhhfjcjksdjklka.com/availability
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json; charset=utf-8
17
+ Transfer-Encoding:
18
+ - chunked
19
+ Connection:
20
+ - keep-alive
21
+ Status:
22
+ - '200'
23
+ X-Powered-By:
24
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
25
+ X-Ua-Compatible:
26
+ - IE=Edge,chrome=1
27
+ Etag:
28
+ - ! '"7a94f7d5ee93f606f2d20803e757d8b8"'
29
+ Cache-Control:
30
+ - must-revalidate, private, max-age=0
31
+ X-Request-Id:
32
+ - 442e590044ab45247f17538c2f95065c
33
+ X-Runtime:
34
+ - '0.369936'
35
+ X-Creditlimit-Remaining:
36
+ - '672'
37
+ Date:
38
+ - Tue, 15 May 2012 13:47:03 GMT
39
+ X-Rack-Cache:
40
+ - miss
41
+ Server:
42
+ - nginx/1.1.14 + Phusion Passenger 3.0.11 (mod_rails/mod_rack)
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ! '{"response":{"daystamp":"2012-05-15T00:00:00Z","available":true,"registered":false}}'
46
+ http_version:
47
+ recorded_at: Tue, 15 May 2012 13:47:03 GMT
48
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ROBO_WHOIS_API_KEY:X@api.robowhois.com/whois/apple.ly/availability
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json; charset=utf-8
17
+ Transfer-Encoding:
18
+ - chunked
19
+ Connection:
20
+ - keep-alive
21
+ Status:
22
+ - '200'
23
+ X-Powered-By:
24
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
25
+ X-Ua-Compatible:
26
+ - IE=Edge,chrome=1
27
+ Etag:
28
+ - ! '"e30cdc1fa304894465be292797230050"'
29
+ Cache-Control:
30
+ - must-revalidate, private, max-age=0
31
+ X-Request-Id:
32
+ - 5eee6e3187e762e21c7c8e87bd7e794a
33
+ X-Runtime:
34
+ - '0.426439'
35
+ X-Creditlimit-Remaining:
36
+ - '49'
37
+ Date:
38
+ - Tue, 15 May 2012 13:47:03 GMT
39
+ X-Rack-Cache:
40
+ - miss
41
+ Server:
42
+ - nginx/1.1.14 + Phusion Passenger 3.0.11 (mod_rails/mod_rack)
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ! '{"response":{"daystamp":"2012-05-15T00:00:00Z","available":false,"registered":true}}'
46
+ http_version:
47
+ recorded_at: Tue, 15 May 2012 13:47:03 GMT
48
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ROBO_WHOIS_API_KEY:X@api.robowhois.com/whois/apple.com/availability
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json; charset=utf-8
17
+ Transfer-Encoding:
18
+ - chunked
19
+ Connection:
20
+ - keep-alive
21
+ Status:
22
+ - '200'
23
+ X-Powered-By:
24
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
25
+ X-Ua-Compatible:
26
+ - IE=Edge,chrome=1
27
+ Etag:
28
+ - ! '"e30cdc1fa304894465be292797230050"'
29
+ Cache-Control:
30
+ - must-revalidate, private, max-age=0
31
+ X-Request-Id:
32
+ - a27ba8dbcd390e69b238a5956ac913f0
33
+ X-Runtime:
34
+ - '0.531093'
35
+ X-Creditlimit-Remaining:
36
+ - '673'
37
+ Date:
38
+ - Tue, 15 May 2012 13:47:02 GMT
39
+ X-Rack-Cache:
40
+ - miss
41
+ Server:
42
+ - nginx/1.1.14 + Phusion Passenger 3.0.11 (mod_rails/mod_rack)
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ! '{"response":{"daystamp":"2012-05-15T00:00:00Z","available":false,"registered":true}}'
46
+ http_version:
47
+ recorded_at: Tue, 15 May 2012 13:47:02 GMT
48
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.twitter.com/1/users/show.json?screen_name=sdfjksdh
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 404
13
+ message: Not Found
14
+ headers:
15
+ X-Ratelimit-Limit:
16
+ - '150'
17
+ X-Ratelimit-Remaining:
18
+ - '136'
19
+ X-Ratelimit-Reset:
20
+ - '1337090175'
21
+ X-Ratelimit-Class:
22
+ - api
23
+ Content-Type:
24
+ - application/json;charset=utf-8
25
+ Last-Modified:
26
+ - Tue, 15 May 2012 13:47:05 GMT
27
+ Expires:
28
+ - Tue, 31 Mar 1981 05:00:00 GMT
29
+ Pragma:
30
+ - no-cache
31
+ Cache-Control:
32
+ - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
33
+ Set-Cookie:
34
+ - guest_id="v1:133708962543023283";Expires=Thu, 15-May-14 13:47:05 GMT;Path=/;Domain=.twitter.com
35
+ - k=46.7.124.72.28b18ebf6ff3bd9e; path=/; expires=Tue, 22-May-2012 13:47:05
36
+ UTC; domain=.api.twitter.com; httponly
37
+ Status:
38
+ - 404 Not Found
39
+ X-Transaction:
40
+ - 010ae87ef75a734f
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Date:
44
+ - Tue, 15 May 2012 13:47:05 GMT
45
+ Content-Length:
46
+ - '76'
47
+ Server:
48
+ - tfe
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ! '{"request":"\/1\/users\/show.json?screen_name=sdfjksdh","error":"Not
52
+ found"}'
53
+ http_version:
54
+ recorded_at: Tue, 15 May 2012 13:47:05 GMT
55
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.twitter.com/1/users/show.json?screen_name=m
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ X-Ratelimit-Limit:
16
+ - '150'
17
+ X-Ratelimit-Remaining:
18
+ - '10'
19
+ X-Ratelimit-Reset:
20
+ - '1337090175'
21
+ X-Ratelimit-Class:
22
+ - api
23
+ Content-Type:
24
+ - application/json;charset=utf-8
25
+ Last-Modified:
26
+ - Tue, 15 May 2012 13:47:06 GMT
27
+ Expires:
28
+ - Tue, 31 Mar 1981 05:00:00 GMT
29
+ Pragma:
30
+ - no-cache
31
+ Cache-Control:
32
+ - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
33
+ Set-Cookie:
34
+ - guest_id="v1:133708962620577572";Expires=Thu, 15-May-14 13:47:06 GMT;Path=/;Domain=.twitter.com
35
+ - k=46.7.124.72.3191fc5e03ee24b8; path=/; expires=Tue, 22-May-2012 13:47:06
36
+ UTC; domain=.api.twitter.com; httponly
37
+ Status:
38
+ - 200 OK
39
+ X-Transaction:
40
+ - 221fe43cb83e7dcf
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Date:
44
+ - Tue, 15 May 2012 13:47:06 GMT
45
+ Content-Length:
46
+ - '2020'
47
+ Server:
48
+ - tfe
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ! '{"id":7998822,"id_str":"7998822","name":"Mark Douglass","screen_name":"m","location":"Bad
52
+ Kreuznach, Germany","description":"Sorry if I don''t reply to @mentions -
53
+ they are 99.9% incorrect and I''ve basically stopped checking them. \r\nPS:
54
+ Not interested in selling @m or @md - sorry!","url":"http:\/\/friendfeed.com\/mdoug","protected":false,"followers_count":17377,"friends_count":1480,"listed_count":195,"created_at":"Mon
55
+ Aug 06 18:15:01 +0000 2007","favourites_count":5149,"utc_offset":3600,"time_zone":"Berlin","geo_enabled":true,"verified":false,"statuses_count":3577,"lang":"en","status":{"created_at":"Sat
56
+ May 12 12:34:07 +0000 2012","id":201289149536419840,"id_str":"201289149536419840","text":"I
57
+ was just awarded the \"TV Elite\" badge at http:\/\/t.co\/zAAbEZ39","source":"\u003ca
58
+ href=\"http:\/\/gomiso.com\" rel=\"nofollow\"\u003eMiso\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorited":false,"retweeted":false,"possibly_sensitive":false},"contributors_enabled":false,"is_translator":false,"profile_background_color":"E4F2F5","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/3055488\/2364_body2.jpg","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/3055488\/2364_body2.jpg","profile_background_tile":false,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1702184506\/m_normal.jpg","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1702184506\/m_normal.jpg","profile_link_color":"2D506C","profile_sidebar_border_color":"6386A3","profile_sidebar_fill_color":"E4F2F5","profile_text_color":"0A2817","profile_use_background_image":true,"show_all_inline_media":false,"default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null}'
59
+ http_version:
60
+ recorded_at: Tue, 15 May 2012 13:47:06 GMT
61
+ recorded_with: VCR 2.1.1
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.twitter.com/1/users/show.json?screen_name=apple
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 403
13
+ message: Forbidden
14
+ headers:
15
+ X-Ratelimit-Limit:
16
+ - '150'
17
+ X-Ratelimit-Remaining:
18
+ - '133'
19
+ X-Ratelimit-Reset:
20
+ - '1337090175'
21
+ X-Ratelimit-Class:
22
+ - api
23
+ Content-Type:
24
+ - application/json;charset=utf-8
25
+ Last-Modified:
26
+ - Tue, 15 May 2012 13:47:06 GMT
27
+ Expires:
28
+ - Tue, 31 Mar 1981 05:00:00 GMT
29
+ Pragma:
30
+ - no-cache
31
+ Cache-Control:
32
+ - no-cache, no-store, must-revalidate, pre-check=0, post-check=0
33
+ Set-Cookie:
34
+ - guest_id="v1:133708962659503145";Expires=Thu, 15-May-14 13:47:06 GMT;Path=/;Domain=.twitter.com
35
+ - k=46.7.124.72.f80967d2a5dc6e80; path=/; expires=Tue, 22-May-2012 13:47:06
36
+ UTC; domain=.api.twitter.com; httponly
37
+ Status:
38
+ - 403 Forbidden
39
+ X-Transaction:
40
+ - bf33bb2e792499a4
41
+ X-Frame-Options:
42
+ - SAMEORIGIN
43
+ Date:
44
+ - Tue, 15 May 2012 13:47:06 GMT
45
+ Content-Length:
46
+ - '87'
47
+ Server:
48
+ - tfe
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ! '{"request":"\/1\/users\/show.json?screen_name=apple","error":"User
52
+ has been suspended"}'
53
+ http_version:
54
+ recorded_at: Tue, 15 May 2012 13:47:06 GMT
55
+ recorded_with: VCR 2.1.1