nic_ar 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The NicAr::Client gem allows to programatically extract information about any ".ar" (Argentina) domain name.
4
4
 
5
- It uses the public information as is made available at the [Dirección Nacional del Registro de Dominios de Internet](http://www.nic.ar) via the third-party [nic!alert API](http://api.nicalert.com.ar) webservice.
5
+ It uses the public information as is made available at the [Dirección Nacional del Registro de Dominios de Internet](http://www.nic.ar) website using the third-party [nic!alert API](http://api.nicalert.com.ar) webservice.
6
6
 
7
7
  ## Installation
8
8
 
@@ -25,30 +25,122 @@ The NicAr::Client class supports lookups for domain names, domain transactions,
25
25
  All the following lookups will raise a NicAr::NotFound exception if the requested resource could not be found.
26
26
 
27
27
  NicAr::Client.domains("vivaserver.com.ar")
28
- => {"available"=>false, "delegated"=>true, "expiring"=>false, "pending"=>false, "registered"=>true, "name"=>"vivaserver", "domain"=>".com.ar", "created_on"=>"2004-11-18", "expires_on"=>"2012-11-18", "contacts"=>{"registrant"=>{"name"=>"Cristian Renato Arroyo", "occupation"=>"Diseno de Paginas Web", "address"=>"Pje. Vucetich 676. Ciudad De Nieva", "city"=>"S. S. de Jujuy", "province"=>"Jujuy", "zip_code"=>"4600", "country"=>"Argentina", "phone"=>"(0388)155827713", "fax"=>"(0388)155827713"}, "responsible"=>{"name"=>"Cristian Renato Arroyo", "address"=>"Pje. Vucetich 676. Ciudad De Nieva.", "city"=>"S. S. de jujuy", "province"=>"Jujuy", "zip_code"=>"4600", "country"=>"Argentina", "phone"=>"(0388)155827713", "fax"=>"(0388)155827713", "work_hours"=>"8am-1pm"}, "administrative"=>{"name"=>"Dynamic DNS Network Services", "address"=>"210 Park Ave. #267", "city"=>"Worcester", "province"=>"", "zip_code"=>"MA 01609", "country"=>"USA", "phone"=>"1-508-798-2145", "fax"=>"1-508-798-5748", "activity"=>"Network Services"}, "technical"=>{"name"=>"Andre Dure", "address"=>"Humahuaca 1303", "city"=>"Capital Federal", "province"=>"Ciudad de Buenos Aires", "zip_code"=>"C1405BIA", "country"=>"Argentina", "phone"=>"49588864", "fax"=>"43335885", "work_hours"=>"10 a 22"}}, "dns_servers"=>{"primary"=>{"host"=>"ns1.mydyndns.org", "ip"=>nil}, "secondary"=>{"host"=>"ns2.mydyndns.org", "ip"=>nil}, "alternate1"=>{"host"=>"ns3.mydyndns.org", "ip"=>nil}, "alternate2"=>{"host"=>"ns4.mydyndns.org", "ip"=>nil}, "alternate3"=>{"host"=>"ns5.mydyndns.org", "ip"=>nil}}}
28
+ => {
29
+ "available"=>false,
30
+ "delegated"=>true,
31
+ "expiring"=>false,
32
+ "pending"=>false,
33
+ "registered"=>true,
34
+ "name"=>"vivaserver",
35
+ "domain"=>".com.ar",
36
+ "created_on"=>"2004-11-18",
37
+ "expires_on"=>"2012-11-18",
38
+ "contacts"=> {
39
+ "registrant"=>{
40
+ "name"=>"Cristian Renato Arroyo",
41
+ "occupation"=>"Diseno de Paginas Web",
42
+ "address"=>"Pje. Vucetich 676. Ciudad De Nieva",
43
+ "city"=>"S. S. de Jujuy",
44
+ "province"=>"Jujuy",
45
+ "zip_code"=>"4600",
46
+ "country"=>"Argentina",
47
+ "phone"=>"(0388)155827713",
48
+ "fax"=>"(0388)155827713"},
49
+ "responsible"=>{
50
+ "name"=>"Cristian Renato Arroyo",
51
+ "address"=>"Pje. Vucetich 676. Ciudad De Nieva.",
52
+ "city"=>"S. S. de jujuy",
53
+ "province"=>"Jujuy",
54
+ "zip_code"=>"4600",
55
+ "country"=>"Argentina",
56
+ "phone"=>"(0388)155827713",
57
+ "fax"=>"(0388)155827713",
58
+ "work_hours"=>"8am-1pm"},
59
+ "administrative"=>{
60
+ "name"=>"Dynamic DNS Network Services",
61
+ "address"=>"210 Park Ave. #267",
62
+ "city"=>"Worcester",
63
+ "province"=>"",
64
+ "zip_code"=>"MA 01609",
65
+ "country"=>"USA",
66
+ "phone"=>"1-508-798-2145",
67
+ "fax"=>"1-508-798-5748",
68
+ "activity"=>"Network Services"},
69
+ "technical"=>{
70
+ "name"=>"Andre Dure",
71
+ "address"=>"Humahuaca 1303",
72
+ "city"=>"Capital Federal",
73
+ "province"=>"Ciudad de Buenos Aires",
74
+ "zip_code"=>"C1405BIA",
75
+ "country"=>"Argentina",
76
+ "phone"=>"49588864",
77
+ "fax"=>"43335885",
78
+ "work_hours"=>"10 a 22"}
79
+ },
80
+ "dns_servers"=>{
81
+ "primary"=>{"host"=>"ns1.mydyndns.org", "ip"=>nil},
82
+ "secondary"=>{"host"=>"ns2.mydyndns.org", "ip"=>nil},
83
+ "alternate1"=>{"host"=>"ns3.mydyndns.org", "ip"=>nil},
84
+ "alternate2"=>{"host"=>"ns4.mydyndns.org", "ip"=>nil},
85
+ "alternate3"=>{"host"=>"ns5.mydyndns.org", "ip"=>nil}
86
+ }
87
+ }
88
+
89
+ All registered domains have a related entities (registrant/administrative contacts) and persons (responsible/technical contacts).
29
90
 
30
91
  NicAr::Client.entities("Dynamic DNS Network Services")
31
- => {"name"=>"Dynamic DNS Network Services", "type"=>"ADMINISTRADORA", "address"=>"210 Park Ave. #267", "city"=>"Worcester", "province"=>nil, "country"=>"USA", "activity"=>"Network Services", "handle"=>"NICAR-E607791"}
92
+ => {
93
+ "name"=>"Dynamic DNS Network Services",
94
+ "type"=>"ADMINISTRADORA",
95
+ "address"=>"210 Park Ave. #267",
96
+ "city"=>"Worcester",
97
+ "province"=>nil,
98
+ "country"=>"USA",
99
+ "activity"=>"Network Services",
100
+ "handle"=>"NICAR-E607791"
101
+ }
32
102
 
33
103
  NicAr::Client.people("Andre Dure")
34
104
  => {"name"=>"Andre Dure", "handle"=>"NICAR-P425476"}
35
105
 
106
+ DNS Servers can also be queried by hostname or IP.
107
+
36
108
  NicAr::Client.dns_servers("ns1.mydyndns.org")
37
- => {"host"=>"ns1.mydyndns.org", "ip"=>nil, "owner"=>"Andre Dure", "operator"=>"Andre Dure", "handle"=>"NICAR-H12587"}
109
+ => {
110
+ "host"=>"ns1.mydyndns.org",
111
+ "ip"=>nil,
112
+ "owner"=>"Andre Dure",
113
+ "operator"=>"Andre Dure",
114
+ "handle"=>"NICAR-H12587"
115
+ }
38
116
 
39
- If a domain name has no recent transactions, a NicAr::NoContent exception will be raised.
117
+ If a domain name has no recent transactions, a NicAr::NoContent exception will be raised. Otherwise an array of recent transactions will be returned.
40
118
 
41
119
  NicAr::Client.transactions("nazarenorock.com.ar")
42
- => [{"id"=>"REG18127727", "created_at"=>"2012-10-03T15:11:01-03:00", "description"=>"Registro de Nombre", "status"=>"PENDIENTE", "notes"=>"Se envio acuse de recibo al solicitante"}]
120
+ => [{
121
+ "id"=>"REG18127727",
122
+ "created_at"=>"2012-10-03T15:11:01-03:00",
123
+ "description"=>"Registro de Nombre",
124
+ "status"=>"PENDIENTE",
125
+ "notes"=>"Se envio acuse de recibo al solicitante"
126
+ }]
43
127
 
44
128
  Transactions can also be queried by it's unique identifier:
45
129
 
46
130
  NicAr::Client.transactions("REG18127727")
47
- => {"domain"=>"nazarenorock.com.ar", "created_at"=>"2012-10-03T15:11:01-03:00", "description"=>"Registro de Nombre", "status"=>"PENDIENTE", "notes"=>"Se envio acuse de recibo al solicitante"}
131
+ => {
132
+ "domain"=>"nazarenorock.com.ar",
133
+ "created_at"=>"2012-10-03T15:11:01-03:00",
134
+ "description"=>"Registro de Nombre",
135
+ "status"=>"PENDIENTE",
136
+ "notes"=>"Se envio acuse de recibo al solicitante"
137
+ }
138
+
139
+ ## Hacking
48
140
 
49
- The full documentation of the nic!alert API is available at [api.nicalert.com.ar](http://api.nicalert.com.ar) if you want to write your own client, use any other language, or just use CURL in a RESTful way.
141
+ The full documentation of the **nic!alert API** is available at [api.nicalert.com.ar](http://api.nicalert.com.ar) if you want to write your own client, use any other language, or just use CURL in a RESTful way.
50
142
 
51
- ## Live sample
143
+ ## Live examples
52
144
 
53
145
  A live test application is set up at the [nic!alert](http://www.nicalert.com.ar) website that allows for the automatic renewal of ".ar" domain names within their 30-day expiring period. The application also has the added feature of resolving the CAPTCHA challenge for the submission of the renewal request.
54
146
 
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'lib' << 'spec'
6
+ t.verbose = false
7
+ t.pattern = 'spec/*_spec.rb'
8
+ end
@@ -1,3 +1,3 @@
1
1
  module NicAr
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/nic_ar.gemspec CHANGED
@@ -8,11 +8,12 @@ Gem::Specification.new do |gem|
8
8
  gem.version = NicAr::VERSION
9
9
  gem.authors = ["Cristian R. Arroyo"]
10
10
  gem.email = ["cristian.arroyo@vivaserver.com"]
11
- gem.description = %q{A simple client for the nic!alert API}
11
+ gem.description = %q{A simple client for ".ar" (Argentina) domain names lookup}
12
12
  gem.summary = %q{A simple client for ".ar" (Argentina) domain names lookup using the nic!alert API}
13
13
  gem.homepage = "https://github.com/vivaserver/nic_ar"
14
14
 
15
- gem.add_runtime_dependency 'rest-client', "~> 1.6"
15
+ gem.add_runtime_dependency 'rest-client', '~> 1.6'
16
+ gem.add_development_dependency 'minitest', '~> 3.3.0'
16
17
 
17
18
  gem.files = `git ls-files`.split($/)
18
19
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -0,0 +1,105 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe 'nic!alert API client' do
4
+ it 'raises ArgumentError if no parameter to resource given' do
5
+ proc { NicAr::Client.people }.must_raise ArgumentError
6
+ end
7
+
8
+ describe 'using stubbed API responses' do
9
+ it 'has flexible support for multiple arguments' do
10
+ RestClient.stub :get, response('transactions/macusadas.com.ar.REN') do
11
+ result = NicAr::Client.domains 'macusadas.com.ar', 'transactions'
12
+ result.must_be_instance_of Array
13
+ transaction = result.first
14
+ transaction.must_be_instance_of Hash
15
+ transaction['id'].must_equal 'REN17330833'
16
+ transaction['status'].must_equal 'FINALIZADO'
17
+ transaction['description'].must_equal 'Renovacion de Nombre'
18
+ end
19
+ end
20
+
21
+ describe 'DNS lookups' do
22
+ it 'returns a hash for primary DNS lookups' do
23
+ RestClient.stub :get, response('dns_servers/ns1.sedoparking.com') do
24
+ result = NicAr::Client.dns_servers 'ns1.sedoparking.com'
25
+ result.must_be_instance_of Hash
26
+ result['host'].must_equal 'ns1.sedoparking.com'
27
+ result['handle'].must_equal 'NICAR-H24966'
28
+ end
29
+ end
30
+
31
+ it 'returns a hash for secondary DNS lookups' do
32
+ RestClient.stub :get, response('dns_servers/ns2.sedoparking.com') do
33
+ result = NicAr::Client.dns_servers 'ns2.sedoparking.com'
34
+ result.must_be_instance_of Hash
35
+ result['host'].must_equal 'ns2.sedoparking.com'
36
+ result['handle'].must_equal 'NICAR-H24965'
37
+ end
38
+ end
39
+ end
40
+
41
+ describe 'Domains lookups' do
42
+ it 'returns Nil for Domain 404s' do
43
+ skip
44
+ RestClient.stub :get, proc { raise RestClient::ResourceNotFound } do
45
+ proc { NicAr::Client.domains 'hispafuentes.com.ar' }.must_raise NicAr::NotFound
46
+ end
47
+ end
48
+
49
+ it 'returns a Hash for Domain lookups' do
50
+ RestClient.stub :get, response('domains/dww.com.ar') do
51
+ result = NicAr::Client.domains 'dww.com.ar'
52
+ result.must_be_instance_of Hash
53
+ result['name'].must_equal 'dww'
54
+ result['domain'].must_equal '.com.ar'
55
+ end
56
+ end
57
+ end
58
+
59
+ describe 'Entities lookups' do
60
+ it 'returns an Entity hash for lookups' do
61
+ RestClient.stub :get, response('entities/Sedo.com LLC') do
62
+ result = NicAr::Client.entities 'Sedo.com LLC'
63
+ result.must_be_instance_of Hash
64
+ result['name'].must_equal 'Sedo.com LLC'
65
+ result['handle'].must_equal 'NICAR-E779784'
66
+ end
67
+ end
68
+ end
69
+
70
+ describe 'Persons lookups' do
71
+ it 'returns a Person hash for lookups' do
72
+ RestClient.stub :get, response('persons/Sedo.com LLC - Technical Contact') do
73
+ result = NicAr::Client.persons 'Sedo.com LLC - Technical Contact'
74
+ result.must_be_instance_of Hash
75
+ result['name'].must_equal 'Sedo.com LLC - Technical Contact'
76
+ result['handle'].must_equal 'NICAR-P1280916'
77
+ end
78
+ end
79
+ end
80
+
81
+ describe 'Transactions lookups' do
82
+ it 'returns a Transactions array for domains lookups' do
83
+ RestClient.stub :get, response('transactions/macusadas.com.ar.REN') do
84
+ result = NicAr::Client.transactions 'macusadas.com.ar'
85
+ result.must_be_instance_of Array
86
+ result.count.must_equal 1
87
+ transaction = result.first
88
+ transaction.must_be_instance_of Hash
89
+ transaction['id'].must_equal 'REN17330833'
90
+ transaction['status'].must_equal 'FINALIZADO'
91
+ transaction['description'].must_equal 'Renovacion de Nombre'
92
+ end
93
+ end
94
+
95
+ it 'returns a Transaction hash for single transaction lookups' do
96
+ RestClient.stub :get, response('transactions/REN17330833') do
97
+ result = NicAr::Client.transactions 'REN17330833'
98
+ result['domain'].must_equal 'macusadas.com.ar'
99
+ result['status'].must_equal 'FINALIZADO'
100
+ result['description'].must_equal 'Renovacion de Nombre'
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,6 @@
1
+ require_relative '../lib/nic_ar'
2
+ require 'minitest/autorun'
3
+
4
+ def response(request)
5
+ JSON.parse(File.read(File.join(File.dirname(__FILE__),'stubs',"#{request}.json")))
6
+ end
@@ -0,0 +1 @@
1
+ {"host":"ns1.sedoparking.com","ip":null,"owner":"Sedo.com LLC","operator":"Sedo.com LLC - Technical Contact","handle":"NICAR-H24966"}
@@ -0,0 +1 @@
1
+ {"host":"ns2.sedoparking.com","ip":null,"owner":"Sedo.com LLC","operator":"Sedo.com LLC - Technical Contact","handle":"NICAR-H24965"}
@@ -0,0 +1 @@
1
+ {"available":false,"delegated":true,"expiring":false,"pending":false,"registered":true,"name":"dww","domain":".com.ar","created_on":"2010-05-18","expires_on":"2013-05-18","days_to_expire":389,"contacts":{"registrant":{"name":"Werlen Analia Guadalupe","occupation":"Diseno de Paginas Web","address":"Soler 138","city":"Cordoba","province":"Cordoba","zip_code":"5000","country":"Argentina","phone":"0351473506","fax":"no"},"responsible":{"name":"Chavarini Leonardo Ariel","address":"Guemes 153","city":"Rafaela","province":"Santa Fe","zip_code":"S2300FNC","country":"Argentina","phone":"3492-15-585634","fax":"no","work_hours":"17-21 leochavarini@gmail.com"},"administrative":{"name":"Sedo.com LLC","address":"One Broadway 1 14","city":"Cambridge, MA","province":"","zip_code":"02142","country":"Argentina","phone":"1.6177584266","fax":"1.6175773983","activity":"Proveedor de Servicios de Internet"},"technical":{"name":"Sedo.com LLC - Technical Contact","address":"One Broadway 1 14","city":"Cambridge, MA","province":"","zip_code":"02142","country":"Estados Unidos","phone":"1.6177584266","fax":"1.6175773983","work_hours":"24x7x365"}},"dns_servers":{"primary":{"host":"ns1.sedoparking.com","ip":null},"secondary":{"host":"ns2.sedoparking.com","ip":null},"alternate1":{"host":null,"ip":null},"alternate2":{"host":null,"ip":null},"alternate3":{"host":null,"ip":null}}}
@@ -0,0 +1 @@
1
+ {"name":"Sedo.com LLC","type":"ADMINISTRADORA","address":"One Broadway 1 14","city":"Cambridge, MA","province":null,"country":"Argentina","activity":"Proveedor de Servicios de Internet","handle":"NICAR-E779784"}
@@ -0,0 +1 @@
1
+ {"name":"Sedo.com LLC - Technical Contact","handle":"NICAR-P1280916"}
@@ -0,0 +1 @@
1
+ {"domain":"macusadas.com.ar","created_at":"2012-06-20T22:15:50-03:00","description":"Renovacion de Nombre","status":"FINALIZADO","notes":"Tramite finalizado el 20/06/12."}
@@ -0,0 +1 @@
1
+ [{"id":"REN17330833","created_at":"2012-06-20T22:15:50-03:00","description":"Renovacion de Nombre","status":"FINALIZADO","notes":"Tramite finalizado el 20/06/12."}]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nic_ar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-31 00:00:00.000000000Z
12
+ date: 2012-11-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
- requirement: &85718140 !ruby/object:Gem::Requirement
16
+ requirement: &72038150 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,8 +21,19 @@ dependencies:
21
21
  version: '1.6'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *85718140
25
- description: A simple client for the nic!alert API
24
+ version_requirements: *72038150
25
+ - !ruby/object:Gem::Dependency
26
+ name: minitest
27
+ requirement: &72037900 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 3.3.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *72037900
36
+ description: A simple client for ".ar" (Argentina) domain names lookup
26
37
  email:
27
38
  - cristian.arroyo@vivaserver.com
28
39
  executables: []
@@ -38,6 +49,15 @@ files:
38
49
  - lib/nic_ar/client.rb
39
50
  - lib/nic_ar/version.rb
40
51
  - nic_ar.gemspec
52
+ - spec/client_spec.rb
53
+ - spec/spec_helper.rb
54
+ - spec/stubs/dns_servers/ns1.sedoparking.com.json
55
+ - spec/stubs/dns_servers/ns2.sedoparking.com.json
56
+ - spec/stubs/domains/dww.com.ar.json
57
+ - spec/stubs/entities/Sedo.com LLC.json
58
+ - spec/stubs/persons/Sedo.com LLC - Technical Contact.json
59
+ - spec/stubs/transactions/REN17330833.json
60
+ - spec/stubs/transactions/macusadas.com.ar.REN.json
41
61
  homepage: https://github.com/vivaserver/nic_ar
42
62
  licenses: []
43
63
  post_install_message:
@@ -63,4 +83,13 @@ signing_key:
63
83
  specification_version: 3
64
84
  summary: A simple client for ".ar" (Argentina) domain names lookup using the nic!alert
65
85
  API
66
- test_files: []
86
+ test_files:
87
+ - spec/client_spec.rb
88
+ - spec/spec_helper.rb
89
+ - spec/stubs/dns_servers/ns1.sedoparking.com.json
90
+ - spec/stubs/dns_servers/ns2.sedoparking.com.json
91
+ - spec/stubs/domains/dww.com.ar.json
92
+ - spec/stubs/entities/Sedo.com LLC.json
93
+ - spec/stubs/persons/Sedo.com LLC - Technical Contact.json
94
+ - spec/stubs/transactions/REN17330833.json
95
+ - spec/stubs/transactions/macusadas.com.ar.REN.json