domainr 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f837cb39f336b94daf302a85a5bd8f4838df4e09
4
+ data.tar.gz: 2af7bfe22407f6ca3460dbcca29c224491863a5b
5
+ SHA512:
6
+ metadata.gz: b5e3d53ffc51e179b2100dbda5ffb7c0b395cfdea796c2f66fd9d5f44ca3372db1b543183d29e983d24878e849420a4b7cc8e08632721e4538746941c3174431
7
+ data.tar.gz: 84b556bba6c9a6f68ff6d3961fbed63045684f083d5c77fac36598601e8b22af5b80e2aa4562da4445ad21adc3eca0bc06ad2f9949cfe15d948db2b6fa13619e
@@ -0,0 +1,3 @@
1
+ --markup markdown
2
+ -
3
+ LICENSE.md
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Steve Agalloco
1
+ Copyright (c) 2014 Steve Agalloco
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,25 @@
1
+ # domainr
2
+
3
+ Ruby wrapper for the [Domainr API](http://domainr.com/api).
4
+
5
+ ## Installation
6
+
7
+ gem install domainr
8
+
9
+ ## Usage
10
+
11
+ You can use Domainr to retrieve information about a domain:
12
+
13
+ Domainr.info('google.com')
14
+
15
+ You can also search Domainr based on a search term:
16
+
17
+ Domainr.search('twitter')
18
+
19
+ ## Contributing
20
+
21
+ Pull requests welcome: fork, make a topic branch, commit (squash when possible) *with tests* and I'll happily consider.
22
+
23
+ ## Copyright
24
+
25
+ Copyright (c) 2014 Steve Agalloco. See [LICENSE](LICENSE.md) for detail
data/Rakefile CHANGED
@@ -1,62 +1,19 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ #!/usr/bin/env rake
3
2
 
4
- $:.unshift('lib')
3
+ require 'bundler/gem_tasks'
5
4
 
6
- begin
7
- require 'jeweler'
8
- require 'domainr/version'
9
- Jeweler::Tasks.new do |gem|
10
- gem.name = "domainr"
11
- gem.summary = %Q{Ruby wrapper for the Domainr API}
12
- gem.description = %Q{Ruby wrapper for the Domainr API}
13
- gem.email = "steve.agalloco@gmail.com"
14
- gem.homepage = "http://github.com/spagalloco/domainr"
15
- gem.authors = ["Steve Agalloco"]
16
-
17
- gem.add_dependency(%q<httparty>, [">= 0.5.2"])
18
- gem.add_dependency(%q<hashie>, [">= 0.2.0"])
19
-
20
- gem.add_development_dependency "shoulda", ">= 0"
21
- gem.add_development_dependency "fakeweb", ">= 0"
22
- gem.add_development_dependency 'redgreen', ">= 0"
23
-
24
- gem.version = Domainr::VERSION
25
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
26
- end
27
- Jeweler::GemcutterTasks.new
28
- rescue LoadError
29
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new(:spec) do |t|
7
+ t.ruby_opts = '-w'
30
8
  end
31
9
 
32
- require 'rake/testtask'
33
- Rake::TestTask.new(:test) do |test|
34
- test.libs << 'lib' << 'test'
35
- test.pattern = 'test/**/test_*.rb'
36
- test.verbose = true
37
- end
10
+ task :default => :spec
11
+ task :test => :spec
38
12
 
39
- begin
40
- require 'rcov/rcovtask'
41
- Rcov::RcovTask.new do |test|
42
- test.libs << 'test'
43
- test.pattern = 'test/**/test_*.rb'
44
- test.verbose = true
13
+ require 'yard'
14
+ namespace :doc do
15
+ YARD::Rake::YardocTask.new do |task|
16
+ task.files = ['LICENSE.md', 'lib/**/*.rb']
17
+ task.options = ['--markup', 'markdown']
45
18
  end
46
- rescue LoadError
47
- task :rcov do
48
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
49
- end
50
- end
51
-
52
- task :test => :check_dependencies
53
-
54
- task :default => :test
55
-
56
- require 'rake/rdoctask'
57
- Rake::RDocTask.new do |rdoc|
58
- rdoc.rdoc_dir = 'rdoc'
59
- rdoc.title = "domainr #{Domainr::VERSION}"
60
- rdoc.rdoc_files.include('README*')
61
- rdoc.rdoc_files.include('lib/**/*.rb')
62
19
  end
@@ -1,70 +1,28 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'domainr/version'
5
5
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{domainr}
8
- s.version = "0.1.0"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'domainr'
8
+ spec.version = Domainr::VERSION
9
+ spec.homepage = 'https://github.com/stve/domainr'
9
10
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Steve Agalloco"]
12
- s.date = %q{2010-07-07}
13
- s.description = %q{Ruby wrapper for the Domainr API}
14
- s.email = %q{steve.agalloco@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.textile"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.textile",
24
- "Rakefile",
25
- "domainr.gemspec",
26
- "lib/domainr.rb",
27
- "lib/domainr/version.rb",
28
- "test/fixtures/empty_info.json",
29
- "test/fixtures/empty_search.json",
30
- "test/fixtures/info.json",
31
- "test/fixtures/search.json",
32
- "test/helper.rb",
33
- "test/test_domainr.rb"
34
- ]
35
- s.homepage = %q{http://github.com/spagalloco/domainr}
36
- s.rdoc_options = ["--charset=UTF-8"]
37
- s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.3.7}
39
- s.summary = %q{Ruby wrapper for the Domainr API}
40
- s.test_files = [
41
- "test/helper.rb",
42
- "test/test_domainr.rb"
43
- ]
11
+ spec.author = "Steve Agalloco"
12
+ spec.email = 'steve.agalloco@gmail.com'
13
+ spec.description = 'Ruby wrapper for the Domainr API'
14
+ spec.summary = 'Ruby wrapper for the Domainr API'
44
15
 
45
- if s.respond_to? :specification_version then
46
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
- s.specification_version = 3
16
+ spec.licenses = ['MIT']
48
17
 
49
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
- s.add_runtime_dependency(%q<httparty>, [">= 0.5.2"])
51
- s.add_runtime_dependency(%q<hashie>, [">= 0.2.0"])
52
- s.add_development_dependency(%q<shoulda>, [">= 0"])
53
- s.add_development_dependency(%q<fakeweb>, [">= 0"])
54
- s.add_development_dependency(%q<redgreen>, [">= 0"])
55
- else
56
- s.add_dependency(%q<httparty>, [">= 0.5.2"])
57
- s.add_dependency(%q<hashie>, [">= 0.2.0"])
58
- s.add_dependency(%q<shoulda>, [">= 0"])
59
- s.add_dependency(%q<fakeweb>, [">= 0"])
60
- s.add_dependency(%q<redgreen>, [">= 0"])
61
- end
62
- else
63
- s.add_dependency(%q<httparty>, [">= 0.5.2"])
64
- s.add_dependency(%q<hashie>, [">= 0.2.0"])
65
- s.add_dependency(%q<shoulda>, [">= 0"])
66
- s.add_dependency(%q<fakeweb>, [">= 0"])
67
- s.add_dependency(%q<redgreen>, [">= 0"])
68
- end
69
- end
18
+ spec.executables = Dir.glob("bin/**/*")
19
+ spec.files = %w(.yardopts LICENSE.md README.md Rakefile domainr.gemspec)
20
+ spec.files += Dir.glob("lib/**/*.rb")
21
+ spec.files += Dir.glob("spec/**/*")
22
+ spec.test_files = Dir.glob("spec/**/*")
23
+
24
+ spec.add_dependency(%q<httparty>, [">= 0.5.2"])
25
+ spec.add_dependency(%q<hashie>, [">= 0.2.0"])
70
26
 
27
+ spec.require_paths = ['lib']
28
+ end
@@ -1,22 +1,28 @@
1
1
  require 'hashie'
2
2
  require 'httparty'
3
3
 
4
- require 'domainr/version'
5
-
6
4
  module Domainr
7
5
  extend self
8
6
 
9
7
  include HTTParty
10
8
  format :json
11
- base_uri 'domai.nr'
9
+ base_uri 'domainr.com'
10
+
11
+ def self.client_id=(id)
12
+ @client_id = id
13
+ end
14
+
15
+ def self.client_id
16
+ @client_id || 'domainr_rubygem'
17
+ end
12
18
 
13
19
  def search(term)
14
- options = { :q => term }
20
+ options = { :q => term, :client_id => client_id }
15
21
  Hashie::Mash.new(get('/api/json/search', { :query => options }))
16
22
  end
17
23
 
18
24
  def info(domain)
19
- options = { :q => domain }
25
+ options = { :q => domain, :client_id => client_id }
20
26
  Hashie::Mash.new(get('/api/json/info', { :query => options }))
21
27
  end
22
28
 
@@ -1,3 +1,3 @@
1
1
  module Domainr
2
- VERSION = '0.1.0'
3
- end
2
+ VERSION = '0.2.0'
3
+ end
@@ -0,0 +1,73 @@
1
+ RSpec.describe Domainr do
2
+
3
+ describe '#client_id=' do
4
+ after do
5
+ Domainr.client_id = nil
6
+ end
7
+
8
+ it 'returns "domainr_rubygem" by default' do
9
+ expect(Domainr.client_id).to eq('domainr_rubygem')
10
+ end
11
+
12
+ it 'allows a client_id to be defined' do
13
+ Domainr.client_id = 'domainr_test_suite'
14
+ expect(Domainr.client_id).to eq('domainr_test_suite')
15
+ end
16
+ end
17
+
18
+ describe '#search' do
19
+ context "with a search term" do
20
+ subject { Domainr.search('domainr') }
21
+
22
+ it "includes the query term" do
23
+ expect(subject.query).to eq('domainr')
24
+ end
25
+
26
+ it "returns results" do
27
+ expect(subject.results.size).to eq(16)
28
+
29
+ first_result = subject.results.first
30
+ expect(first_result.domain).to eq('domainr.com')
31
+ expect(first_result.availability).to eq('maybe')
32
+
33
+ second_result = subject.results[1]
34
+ expect(second_result.domain).to eq('domainr.net')
35
+ expect(second_result.availability).to eq('maybe')
36
+ end
37
+ end
38
+
39
+ context "without a search term" do
40
+ subject { Domainr.search(nil) }
41
+
42
+ it "returns an error" do
43
+ expect(subject.results.size).to eq(0)
44
+ expect(subject.error).to be
45
+ expect(subject.error.status).to eq(404)
46
+ expect(subject.error.message).to eq('No results found.')
47
+ end
48
+ end
49
+ end
50
+
51
+ context "Retrieving info from Domainr" do
52
+ context "with a valid search term"do
53
+ subject { Domainr.info('domai.nr') }
54
+
55
+ it "return results" do
56
+ expect(subject.registrars)
57
+ expect(subject.domain).to eq('domai.nr')
58
+ expect(subject.availability).to eq('taken')
59
+ expect(subject.tld.domain).to eq('nr')
60
+ end
61
+ end
62
+
63
+ context "with an invalid search term" do
64
+ subject { Domainr.info('d') }
65
+
66
+ it "returns an error" do
67
+ expect(subject.error).to be
68
+ expect(subject.error.status).to eq(404)
69
+ expect(subject.error.message).to eq('No results found.')
70
+ end
71
+ end
72
+ end
73
+ end
File without changes
@@ -0,0 +1,10 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: text/javascript+json
3
+ Date: Wed, 07 Jul 2010 02:48:41 GMT
4
+ Server: Google Frontend
5
+ Cache-Control: private, x-gzip-ok=""
6
+ X-Xss-Protection: 0
7
+ Transfer-Encoding: Identity
8
+ Connection: close
9
+
10
+ {"domain": "domai.nr", "whois_url": "http://domainr.com/domai.nr/whois", "register_url": "http://domainr.com/domai.nr/register", "tld": {"domain": "nr", "domain_idna": "nr", "wikipedia_url": "http://wikipedia.org/wiki/.nr", "iana_url": "http://www.iana.org/domains/root/db/nr.html"}, "registrars": [{"registrar": "cenpac.net.nr", "name": "CenpacNET", "register_url": "http://domainr.com/domai.nr/register/cenpac.net.nr"}], "host": "", "path": "", "www_url": "http://domainr.com/domai.nr/www", "query": "domai.nr", "subdomain": "domai.nr", "domain_idna": "domai.nr", "availability": "taken"}
@@ -0,0 +1,10 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: text/javascript+json
3
+ Date: Wed, 07 Jul 2010 02:49:22 GMT
4
+ Server: Google Frontend
5
+ Cache-Control: private, x-gzip-ok=""
6
+ X-Xss-Protection: 0
7
+ Transfer-Encoding: Identity
8
+ Connection: close
9
+
10
+ {"query": "domainr", "results": [{"domain": "domainr.com", "register_url": "http://domainr.com/domainr.com/register", "host": "", "path": "", "subdomain": "domainr.com", "availability": "maybe"}, {"domain": "domainr.net", "register_url": "http://domainr.com/domainr.net/register", "host": "", "path": "", "subdomain": "domainr.net", "availability": "maybe"}, {"domain": "domainr.org", "register_url": "http://domainr.com/domainr.org/register", "host": "", "path": "", "subdomain": "domainr.org", "availability": "maybe"}, {"domain": "domai.nr", "register_url": "http://domainr.com/domai.nr/register", "host": "", "path": "", "subdomain": "domai.nr", "availability": "taken"}, {"domain": "doma.in", "register_url": "http://domainr.com/doma.in/register", "host": "", "path": "/r", "subdomain": "doma.in", "availability": "maybe"}, {"domain": "dom.ai", "register_url": "http://domainr.com/dom.ai/register", "host": "", "path": "/nr", "subdomain": "dom.ai", "availability": "maybe"}, {"domain": "do.ma", "register_url": "http://domainr.com/do.ma/register", "host": "", "path": "/inr", "subdomain": "do.ma", "availability": "maybe"}, {"domain": "d.om", "register_url": "http://domainr.com/d.om/register", "host": "", "path": "/ainr", "subdomain": "d.om", "availability": "unavailable"}, {"domain": "dm.nr", "register_url": "http://domainr.com/dm.nr/register", "host": "", "path": "", "subdomain": "dm.nr", "availability": "maybe"}, {"domain": "d.mai.nr", "register_url": "http://domainr.com/d.mai.nr/register", "host": "d.", "path": "", "subdomain": "mai.nr", "availability": "available"}, {"domain": "d.mn", "register_url": "http://domainr.com/d.mn/register", "host": "", "path": "/r", "subdomain": "d.mn", "availability": "unavailable"}, {"domain": "d.ma.in", "register_url": "http://domainr.com/d.ma.in/register", "host": "d.", "path": "/r", "subdomain": "ma.in", "availability": "unavailable"}, {"domain": "d.m.ai", "register_url": "http://domainr.com/d.m.ai/register", "host": "d.", "path": "/nr", "subdomain": "m.ai", "availability": "taken"}, {"domain": "d.ma", "register_url": "http://domainr.com/d.ma/register", "host": "", "path": "/inr", "subdomain": "d.ma", "availability": "available"}, {"domain": "dm", "register_url": "http://domainr.com/dm/register", "host": "", "path": "/nr", "subdomain": "dm", "availability": "tld"}, {"domain": "do", "register_url": "http://domainr.com/do/register", "host": "", "path": "/mainr", "subdomain": "do", "availability": "tld"}]}
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ unless ENV['CI']
3
+ require 'simplecov'
4
+ SimpleCov.start do
5
+ add_group 'Domainr', 'lib/domainr'
6
+ add_group 'Specs', 'spec'
7
+ end
8
+ end
9
+
10
+ require 'fakeweb'
11
+ require 'domainr'
12
+
13
+ FakeWeb.allow_net_connect = false
14
+
15
+ FakeWeb.register_uri(:get, "http://domainr.com/api/json/info?q=domai.nr&client_id=domainr_rubygem", :response => File.join(File.dirname(__FILE__), 'fixtures', 'info.json'), :content_type => "text/javascript+json; charset=utf-8", :status => ["200", "OK"])
16
+ FakeWeb.register_uri(:get, "http://domainr.com/api/json/info?q=d&client_id=domainr_rubygem", :response => File.join(File.dirname(__FILE__), 'fixtures', 'empty_info.json'), :content_type => "text/javascript+json; charset=utf-8", :status => ["200", "OK"])
17
+ FakeWeb.register_uri(:get, "http://domainr.com/api/json/search?q=domainr&client_id=domainr_rubygem", :response => File.join(File.dirname(__FILE__), 'fixtures', 'search.json'), :content_type => "text/javascript+json; charset=utf-8", :status => ["200", "OK"])
18
+ FakeWeb.register_uri(:get, "http://domainr.com/api/json/search?q=&client_id=domainr_rubygem", :response => File.join(File.dirname(__FILE__), 'fixtures', 'empty_search.json'), :content_type => "text/javascript+json; charset=utf-8", :status => ["200", "OK"])
19
+
20
+ RSpec.configure do |config|
21
+ config.order = :random
22
+ config.expect_with :rspec do |expectations|
23
+ expectations.syntax = :expect
24
+ end
25
+ end
metadata CHANGED
@@ -1,155 +1,91 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: domainr
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Steve Agalloco
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2010-07-07 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: httparty
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
27
17
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 15
30
- segments:
31
- - 0
32
- - 5
33
- - 2
18
+ - !ruby/object:Gem::Version
34
19
  version: 0.5.2
35
20
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: hashie
39
21
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashie
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
43
31
  - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 23
46
- segments:
47
- - 0
48
- - 2
49
- - 0
32
+ - !ruby/object:Gem::Version
50
33
  version: 0.2.0
51
34
  type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: shoulda
55
35
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
59
38
  - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
- version: "0"
65
- type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: fakeweb
69
- prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
79
- type: :development
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: redgreen
83
- prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
85
- none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
93
- type: :development
94
- version_requirements: *id005
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.0
95
41
  description: Ruby wrapper for the Domainr API
96
42
  email: steve.agalloco@gmail.com
97
43
  executables: []
98
-
99
44
  extensions: []
100
-
101
- extra_rdoc_files:
102
- - LICENSE
103
- - README.textile
104
- files:
105
- - .document
106
- - .gitignore
107
- - LICENSE
108
- - README.textile
45
+ extra_rdoc_files: []
46
+ files:
47
+ - ".yardopts"
48
+ - LICENSE.md
49
+ - README.md
109
50
  - Rakefile
110
51
  - domainr.gemspec
111
52
  - lib/domainr.rb
112
53
  - lib/domainr/version.rb
113
- - test/fixtures/empty_info.json
114
- - test/fixtures/empty_search.json
115
- - test/fixtures/info.json
116
- - test/fixtures/search.json
117
- - test/helper.rb
118
- - test/test_domainr.rb
119
- has_rdoc: true
120
- homepage: http://github.com/spagalloco/domainr
121
- licenses: []
122
-
54
+ - spec/domainr_spec.rb
55
+ - spec/fixtures/empty_info.json
56
+ - spec/fixtures/empty_search.json
57
+ - spec/fixtures/info.json
58
+ - spec/fixtures/search.json
59
+ - spec/spec_helper.rb
60
+ homepage: https://github.com/stve/domainr
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
123
64
  post_install_message:
124
- rdoc_options:
125
- - --charset=UTF-8
126
- require_paths:
65
+ rdoc_options: []
66
+ require_paths:
127
67
  - lib
128
- required_ruby_version: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
131
70
  - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 3
134
- segments:
135
- - 0
136
- version: "0"
137
- required_rubygems_version: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
140
75
  - - ">="
141
- - !ruby/object:Gem::Version
142
- hash: 3
143
- segments:
144
- - 0
145
- version: "0"
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
146
78
  requirements: []
147
-
148
79
  rubyforge_project:
149
- rubygems_version: 1.3.7
80
+ rubygems_version: 2.2.2
150
81
  signing_key:
151
- specification_version: 3
82
+ specification_version: 4
152
83
  summary: Ruby wrapper for the Domainr API
153
- test_files:
154
- - test/helper.rb
155
- - test/test_domainr.rb
84
+ test_files:
85
+ - spec/domainr_spec.rb
86
+ - spec/fixtures/empty_info.json
87
+ - spec/fixtures/empty_search.json
88
+ - spec/fixtures/info.json
89
+ - spec/fixtures/search.json
90
+ - spec/spec_helper.rb
91
+ has_rdoc:
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
@@ -1,31 +0,0 @@
1
- h1. domainr
2
-
3
- Ruby wrapper for the "Domainr API":http://domai.nr/api.
4
-
5
- h2. Installation
6
-
7
- <pre><code>gem install domainr</code></pre>
8
-
9
- h2. Usage
10
-
11
- You can use Domainr to retrieve information about a domain:
12
-
13
- <pre><code>Domainr.info('google.com')</code></pre>
14
-
15
- You can also search Domainr based on a search term:
16
-
17
- <pre><code>Domainr.search('twitter')</code></pre>
18
-
19
- h2. Note on Patches/Pull Requests
20
-
21
- * Fork the project.
22
- * Make your feature addition or bug fix.
23
- * Add tests for it. This is important so I don't break it in a
24
- future version unintentionally.
25
- * Commit, do not mess with rakefile, version, or history.
26
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
27
- * Send me a pull request. Bonus points for topic branches.
28
-
29
- h2. Copyright
30
-
31
- Copyright (c) 2010 Steve Agalloco. See LICENSE for details.
@@ -1,10 +0,0 @@
1
- HTTP/1.1 200 OK
2
- Content-Type: text/javascript+json
3
- Date: Wed, 07 Jul 2010 02:48:41 GMT
4
- Server: Google Frontend
5
- Cache-Control: private, x-gzip-ok=""
6
- X-Xss-Protection: 0
7
- Transfer-Encoding: Identity
8
- Connection: close
9
-
10
- {"domain": "domai.nr", "whois_url": "http://domai.nr/domai.nr/whois", "register_url": "http://domai.nr/domai.nr/register", "tld": {"domain": "nr", "domain_idna": "nr", "wikipedia_url": "http://wikipedia.org/wiki/.nr", "iana_url": "http://www.iana.org/domains/root/db/nr.html"}, "registrars": [{"registrar": "cenpac.net.nr", "name": "CenpacNET", "register_url": "http://domai.nr/domai.nr/register/cenpac.net.nr"}], "host": "", "path": "", "www_url": "http://domai.nr/domai.nr/www", "query": "domai.nr", "subdomain": "domai.nr", "domain_idna": "domai.nr", "availability": "taken"}
@@ -1,10 +0,0 @@
1
- HTTP/1.1 200 OK
2
- Content-Type: text/javascript+json
3
- Date: Wed, 07 Jul 2010 02:49:22 GMT
4
- Server: Google Frontend
5
- Cache-Control: private, x-gzip-ok=""
6
- X-Xss-Protection: 0
7
- Transfer-Encoding: Identity
8
- Connection: close
9
-
10
- {"query": "domainr", "results": [{"domain": "domainr.com", "register_url": "http://domai.nr/domainr.com/register", "host": "", "path": "", "subdomain": "domainr.com", "availability": "maybe"}, {"domain": "domainr.net", "register_url": "http://domai.nr/domainr.net/register", "host": "", "path": "", "subdomain": "domainr.net", "availability": "maybe"}, {"domain": "domainr.org", "register_url": "http://domai.nr/domainr.org/register", "host": "", "path": "", "subdomain": "domainr.org", "availability": "maybe"}, {"domain": "domai.nr", "register_url": "http://domai.nr/domai.nr/register", "host": "", "path": "", "subdomain": "domai.nr", "availability": "taken"}, {"domain": "doma.in", "register_url": "http://domai.nr/doma.in/register", "host": "", "path": "/r", "subdomain": "doma.in", "availability": "maybe"}, {"domain": "dom.ai", "register_url": "http://domai.nr/dom.ai/register", "host": "", "path": "/nr", "subdomain": "dom.ai", "availability": "maybe"}, {"domain": "do.ma", "register_url": "http://domai.nr/do.ma/register", "host": "", "path": "/inr", "subdomain": "do.ma", "availability": "maybe"}, {"domain": "d.om", "register_url": "http://domai.nr/d.om/register", "host": "", "path": "/ainr", "subdomain": "d.om", "availability": "unavailable"}, {"domain": "dm.nr", "register_url": "http://domai.nr/dm.nr/register", "host": "", "path": "", "subdomain": "dm.nr", "availability": "maybe"}, {"domain": "d.mai.nr", "register_url": "http://domai.nr/d.mai.nr/register", "host": "d.", "path": "", "subdomain": "mai.nr", "availability": "available"}, {"domain": "d.mn", "register_url": "http://domai.nr/d.mn/register", "host": "", "path": "/r", "subdomain": "d.mn", "availability": "unavailable"}, {"domain": "d.ma.in", "register_url": "http://domai.nr/d.ma.in/register", "host": "d.", "path": "/r", "subdomain": "ma.in", "availability": "unavailable"}, {"domain": "d.m.ai", "register_url": "http://domai.nr/d.m.ai/register", "host": "d.", "path": "/nr", "subdomain": "m.ai", "availability": "taken"}, {"domain": "d.ma", "register_url": "http://domai.nr/d.ma/register", "host": "", "path": "/inr", "subdomain": "d.ma", "availability": "available"}, {"domain": "dm", "register_url": "http://domai.nr/dm/register", "host": "", "path": "/nr", "subdomain": "dm", "availability": "tld"}, {"domain": "do", "register_url": "http://domai.nr/do/register", "host": "", "path": "/mainr", "subdomain": "do", "availability": "tld"}]}
@@ -1,16 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
- require 'fakeweb'
5
- require 'redgreen'
6
-
7
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
- $LOAD_PATH.unshift(File.dirname(__FILE__))
9
- require 'domainr'
10
-
11
- FakeWeb.allow_net_connect = false
12
-
13
- FakeWeb.register_uri(:get, "http://domai.nr/api/json/info?q=domai.nr", :response => File.join(File.dirname(__FILE__), 'fixtures', 'info.json'), :content_type => "text/javascript+json; charset=utf-8", :status => ["200", "OK"])
14
- FakeWeb.register_uri(:get, "http://domai.nr/api/json/info?q=d", :response => File.join(File.dirname(__FILE__), 'fixtures', 'empty_info.json'), :content_type => "text/javascript+json; charset=utf-8", :status => ["200", "OK"])
15
- FakeWeb.register_uri(:get, "http://domai.nr/api/json/search?q=domainr", :response => File.join(File.dirname(__FILE__), 'fixtures', 'search.json'), :content_type => "text/javascript+json; charset=utf-8", :status => ["200", "OK"])
16
- FakeWeb.register_uri(:get, "http://domai.nr/api/json/search?q=", :response => File.join(File.dirname(__FILE__), 'fixtures', 'empty_search.json'), :content_type => "text/javascript+json; charset=utf-8", :status => ["200", "OK"])
@@ -1,59 +0,0 @@
1
- require 'helper'
2
-
3
- class TestDomainr < Test::Unit::TestCase
4
-
5
- context "Searching Domainr" do
6
- context "with a search term" do
7
- setup do
8
- @domains = Domainr.search('domainr')
9
- end
10
-
11
- should "include the query term" do
12
- assert_equal 'domainr', @domains.query
13
- end
14
-
15
- should "return results" do
16
- assert_equal @domains.results.size, 16
17
-
18
- first_result = @domains.results.first
19
- assert_equal first_result.domain, 'domainr.com'
20
- assert_equal first_result.availability, 'maybe'
21
-
22
- second_result = @domains.results[1]
23
- assert_equal second_result.domain, 'domainr.net'
24
- assert_equal second_result.availability, 'maybe'
25
- end
26
- end
27
-
28
- context "without a search term" do
29
- should "return an error" do
30
- @domains = Domainr.search(nil)
31
- assert_equal @domains.results.size, 0
32
- assert @domains.error
33
- assert_equal @domains.error.status, 404
34
- assert_equal @domains.error.message, 'No results found.'
35
- end
36
- end
37
- end
38
-
39
- context "Retrieving info from Domainr" do
40
- context "with a valid search term"do
41
- should "return results" do
42
- @domain = Domainr.info('domai.nr')
43
- assert @domain.registrars
44
- assert_equal @domain.domain, 'domai.nr'
45
- assert_equal @domain.availability, 'taken'
46
- assert_equal @domain.tld.domain, 'nr'
47
- end
48
- end
49
-
50
- context "with an invalid search term" do
51
- should "return an error" do
52
- @domain = Domainr.info('d')
53
- assert @domain.error
54
- assert_equal @domain.error.status, 404
55
- assert_equal @domain.error.message, 'No results found.'
56
- end
57
- end
58
- end
59
- end