epp-client-smallregistry 0.11.0

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/ChangeLog ADDED
@@ -0,0 +1,5 @@
1
+ 2010-05-14 mat
2
+ * first release
3
+
4
+ 2010-05-04 mat
5
+ * Initial commit
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pp'
4
+ require 'rubygems'
5
+ require 'epp-client/smallregistry'
6
+
7
+ c = EPPClient::SmallRegistry.new(
8
+ :client_id => 'test',
9
+ :password => 'test',
10
+ :ssl_cert => 'test.crt',
11
+ :ssl_key => 'test.key',
12
+ :test => true
13
+ )
14
+
15
+ begin
16
+
17
+ c.open_connection
18
+ c.login
19
+ pp c.domain_check('mat.cc', 'bidule-truc.aeroport.fr', 'truc-chose.aeroport.fr')
20
+ pp c.domain_info('truc-chose.aeroport.fr')
21
+ pp c.contact_check('PP1-SMALL', 'PP2-SMALL', 'foobar')
22
+ pp c.contact_info('PP1-SMALL')
23
+ pp contact = c.contact_create( {
24
+ :email=>"foo@example.org",
25
+ :authInfo => "foobar",
26
+ :voice=>"+33.821801821",
27
+ :postalInfo=> { "loc"=> { :addr=> { :city=>"Paris", :cc=>"FR", :pc=>"75001", :street=>["BP 18", "1, rue Royale"] }, :name=>"Dupond, Jean", :org => "FooBar Inc." }, },
28
+ # l'un ou l'autre
29
+ #:person => { :birthDate => '1978-01-01', :birthPlace => 'Paris', },
30
+ :org => { :companySerial => '505404125', },
31
+ })
32
+ pp c.contact_info(contact[:id])
33
+ pp c.contact_update({
34
+ :id => contact[:id],
35
+ :chg => {
36
+ :email => 'bazar@example.com',
37
+ :org => { :companySerial => '505404126', },
38
+ }})
39
+ pp c.contact_delete(contact[:id])
40
+ pp c.contact_info(contact[:id])
41
+ pp c.domain_create({
42
+ :registrant => "PP1-SMALL",
43
+ :contacts => {:billing => ["PP1-SMALL"], :tech => ["PP1-SMALL"], :admin => ["PP1-SMALL"]},
44
+ :ns => ["ns1.absolight.net", "ns2.absolight.net", "ns3.absolight.net", "ns4.absolight.net"],
45
+ #:ns => [{:hostAddrv4 => ["1.2.3.4", "1.4.2.3"], :hostName => "ns1.truc-#{$$}.aeroport.fr"}, {:hostAddrv4 => ["1.2.3.5"], :hostAddrv6 => ["2a01:678::1", "2a01:678::2"], :hostName => "ns2.truc-#{$$}.aeroport.fr"}],
46
+ :name => "truc-#{$$}.aeroport.fr",
47
+ :authInfo => "PN16IZ0V-XLYDZC-AT70X58L"
48
+ })
49
+ pp c.domain_info("truc-#{$$}.aeroport.fr")
50
+ pp c.domain_update({
51
+ :name => "truc-#{$$}.aeroport.fr",
52
+ :chg => { :authInfo => 'Bazar' },
53
+ :rem => {
54
+ :ns => ["ns4.absolight.net"],
55
+ }
56
+ })
57
+ pp c.domain_info("truc-#{$$}.aeroport.fr")
58
+ pp c.domain_delete('truc-70487.aeroport.fr')
59
+ ensure
60
+ c.logout
61
+ end
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in epp-client.gemspec
4
+ Dir['*.gemspec'].each do |i|
5
+ gemspec :name => i.sub(/\.gemspec$/, '')
6
+ end
data/MIT-LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2010 Mathieu Arnold, Absolight
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README ADDED
@@ -0,0 +1,5 @@
1
+ An extensible EPP client library
2
+
3
+ When possible, the objects that are received via EPP are translated to their
4
+ equivalent in ruby, that is, dates in Date object, timestamps in DateTime
5
+ objects.
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env rake
2
+ require 'rake'
3
+ require 'rdoc/task'
4
+ require 'rubygems/package_task'
5
+ require "bundler/gem_helper"
6
+
7
+ MY_GEMS = Dir['*.gemspec'].map {|g| g.sub(/.*-(.*)\.gemspec/, '\1')}
8
+
9
+ MY_GEMS.each do |g|
10
+ namespace g do
11
+ Bundler::GemHelper.new(Dir.pwd, "epp-client-#{g}").install
12
+ end
13
+ end
14
+
15
+ namespace :all do
16
+ task :build => MY_GEMS.map { |f| "#{f}:build" }
17
+ task :install => MY_GEMS.map { |f| "#{f}:install" }
18
+ task :release => MY_GEMS.map { |f| "#{f}:release" }
19
+ end
20
+
21
+ task :build => 'all:build'
22
+ task :install => 'all:install'
23
+ task :release => 'all:release'
24
+
25
+ desc "Generate documentation for the Rails framework"
26
+ Rake::RDocTask.new do |rdoc|
27
+ rdoc.rdoc_dir = 'doc/rdoc'
28
+ rdoc.title = "Documentation"
29
+
30
+ rdoc.options << '--line-numbers' << '--inline-source'
31
+ rdoc.options << '--charset' << 'utf-8'
32
+
33
+ rdoc.rdoc_files.include('README')
34
+ rdoc.rdoc_files.include('ChangeLog')
35
+ rdoc.rdoc_files.include('lib/**/*.rb')
36
+ end
37
+
@@ -0,0 +1,36 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/epp-client/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'epp-client-smallregistry'
6
+ gem.version = EPPClient::VERSION
7
+ gem.date = '2010-05-14'
8
+ gem.authors = ['Mathieu Arnold']
9
+ gem.email = ['m@absolight.fr']
10
+ gem.description = 'Smallregistry EPP client library.'
11
+ gem.summary = 'Smallregistry EPP client library'
12
+ gem.homepage = "https://github.com/Absolight/epp-client"
13
+
14
+ gem.required_ruby_version = '>= 1.8.7'
15
+ gem.required_rubygems_version = ">= 1.3.6"
16
+
17
+ gem.files = [
18
+ 'ChangeLog',
19
+ 'EXAMPLE.SMALLREGISTRY',
20
+ 'Gemfile',
21
+ 'MIT-LICENSE',
22
+ 'README',
23
+ 'Rakefile',
24
+ 'epp-client-smallregistry.gemspec',
25
+ 'lib/epp-client/smallregistry.rb',
26
+ 'vendor/smallregistry/sr-1.0.xsd',
27
+ ]
28
+
29
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
30
+ gem.require_paths = ['lib']
31
+
32
+ gem.add_development_dependency "bundler", ">= 1.0.0"
33
+ gem.add_dependency('nokogiri', '~> 1.4')
34
+ gem.add_dependency('builder', '>= 2.1.2')
35
+ gem.add_dependency('epp-client-base', "~> #{EPPClient::VERSION}")
36
+ end
@@ -0,0 +1,174 @@
1
+ require 'epp-client/base'
2
+
3
+ module EPPClient
4
+ class SmallRegistry < Base
5
+
6
+ SCHEMAS_SR = %w[
7
+ sr-1.0
8
+ ]
9
+
10
+ EPPClient::SCHEMAS_URL.merge!(SCHEMAS_SR.inject({}) do |a,s|
11
+ a[s.sub(/-1\.0$/, '')] = "https://www.smallregistry.net/schemas/#{s}.xsd" if s =~ /-1\.0$/
12
+ a[s] = "https://www.smallregistry.net/schemas/#{s}.xsd"
13
+ a
14
+ end)
15
+
16
+ #
17
+ # Sets the default for Smallregistry, that is, server and port, according
18
+ # to Smallregistry's documentation.
19
+ # https://www.smallregistry.net/faqs/quelles-sont-les-specificites-du-serveur-epp
20
+ #
21
+ # ==== Required Attributes
22
+ #
23
+ # [<tt>:client_id</tt>] the tag or username used with <tt><login></tt> requests.
24
+ # [<tt>:password</tt>] the password used with <tt><login></tt> requests.
25
+ # [<tt>:ssl_cert</tt>] the file containing the client certificate.
26
+ # [<tt>:ssl_key</tt>] the file containing the key of the certificate.
27
+ #
28
+ # ==== Optional Attributes
29
+ # [<tt>:test</tt>] sets the server to be the test server.
30
+ #
31
+ # See EPPClient for other attributes.
32
+ def initialize(attrs)
33
+ unless attrs.key?(:client_id) && attrs.key?(:password) && attrs.key?(:ssl_cert) && attrs.key?(:ssl_key)
34
+ raise ArgumentError, "client_id, password, ssl_cert and ssl_key are required"
35
+ end
36
+ if attrs.delete(:test) == true
37
+ attrs[:server] ||= 'epp.test.smallregistry.net'
38
+ attrs[:port] ||= 2700
39
+ else
40
+ attrs[:server] ||= 'epp.smallregistry.net'
41
+ attrs[:port] ||= 700
42
+ end
43
+ @services = EPPClient::SCHEMAS_URL.values_at('domain', 'contact')
44
+ super(attrs)
45
+ @extensions << EPPClient::SCHEMAS_URL['sr']
46
+ end
47
+
48
+ # Extends the base contact info so that the specific smallregistry's
49
+ # informations are processed, the additionnal informations are :
50
+ #
51
+ # one of :
52
+ # [<tt>:org</tt>]
53
+ # indicating that the contact is an organisation with the following
54
+ # informations :
55
+ # [<tt>:companySerial</tt>]
56
+ # the company's SIREN / RPPS / whatever serial number is required.
57
+ # [<tt>:person</tt>]
58
+ # indicating that the contact is a human person with the following
59
+ # informations :
60
+ # [<tt>:birthDate</tt>] the person's birth date.
61
+ # [<tt>:birthPlace</tt>] the person's birth place.
62
+ def contact_info(xml)
63
+ super # placeholder so that I can add some doc
64
+ end
65
+
66
+ def contact_info_process(xml) #:nodoc:
67
+ ret = super
68
+ if (contact = xml.xpath('epp:extension/sr:ext/sr:infData/sr:contact', EPPClient::SCHEMAS_URL)).size > 0
69
+ if (person = contact.xpath('sr:person', EPPClient::SCHEMAS_URL)).size > 0
70
+ ret[:person] = {
71
+ :birthDate => Date.parse(person.xpath('sr:birthDate', EPPClient::SCHEMAS_URL).text),
72
+ :birthPlace => person.xpath('sr:birthPlace', EPPClient::SCHEMAS_URL).text,
73
+ }
74
+ end
75
+ if (org = contact.xpath('sr:org', EPPClient::SCHEMAS_URL)).size > 0
76
+ ret[:org] = { :companySerial => org.xpath('sr:companySerial', EPPClient::SCHEMAS_URL).text }
77
+ end
78
+ end
79
+ ret
80
+ end
81
+
82
+ # Extends the base contact create so that the specific smallregistry's
83
+ # information are sent, the additionnal informations are :
84
+ #
85
+ # one of :
86
+ # [<tt>:org</tt>]
87
+ # indicating that the contact is an organisation with the following
88
+ # informations :
89
+ # [<tt>:companySerial</tt>]
90
+ # the company's SIREN / RPPS / whatever serial number is required.
91
+ # [<tt>:person</tt>]
92
+ # indicating that the contact is a human person with the following
93
+ # informations :
94
+ # [<tt>:birthDate</tt>] the person's birth date.
95
+ # [<tt>:birthPlace</tt>] the person's birth place.
96
+ def contact_create(contact)
97
+ super # placeholder so that I can add some doc
98
+ end
99
+
100
+ def contact_create_xml(contact) #:nodoc:
101
+ ret = super
102
+
103
+ ext = extension do |xml|
104
+ xml.ext( :xmlns => EPPClient::SCHEMAS_URL['sr']) do
105
+ xml.create do
106
+ xml.contact do
107
+ if contact.key?(:org)
108
+ xml.org do
109
+ xml.companySerial(contact[:org][:companySerial])
110
+ end
111
+ elsif contact.key?(:person)
112
+ xml.person do
113
+ xml.birthDate(contact[:person][:birthDate])
114
+ xml.birthPlace(contact[:person][:birthPlace])
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+
122
+ insert_extension(ret, ext)
123
+ end
124
+
125
+ def contact_update_xml(args) #:nodoc:
126
+ ret = super
127
+
128
+ if args.key?(:chg) && (args[:chg].key?(:org) || args[:chg].key?(:person))
129
+ ext = extension do |xml|
130
+ xml.ext( :xmlns => EPPClient::SCHEMAS_URL['sr']) do
131
+ xml.update do
132
+ xml.contact do
133
+ if args[:chg].key?(:org)
134
+ xml.org do
135
+ xml.companySerial(args[:chg][:org][:companySerial])
136
+ end
137
+ elsif args[:chg].key?(:person)
138
+ xml.person do
139
+ xml.birthDate(args[:chg][:person][:birthDate])
140
+ xml.birthPlace(args[:chg][:person][:birthPlace])
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+ end
147
+
148
+ return insert_extension(ret, ext)
149
+ else
150
+ return ret
151
+ end
152
+ end
153
+
154
+ # Extends the base contact update so that the specific afnic update
155
+ # informations can be sent, the additionnal informations are :
156
+ #
157
+ # [<tt>:chg</tt>]
158
+ # changes one of :
159
+ # [<tt>:org</tt>]
160
+ # indicating that the contact is an organisation with the following
161
+ # informations :
162
+ # [<tt>:companySerial</tt>]
163
+ # the company's SIREN / RPPS / whatever serial number is required.
164
+ # [<tt>:person</tt>]
165
+ # indicating that the contact is a human person with the following
166
+ # informations :
167
+ # [<tt>:birthDate</tt>] the person's birth date.
168
+ # [<tt>:birthPlace</tt>] the person's birth place.
169
+ #
170
+ def contact_update(args)
171
+ super # placeholder so that I can add some doc
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,76 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <schema targetNamespace="https://www.smallregistry.net/schemas/sr-1.0.xsd"
4
+ xmlns:sr="https://www.smallregistry.net/schemas/sr-1.0.xsd"
5
+ xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
6
+ xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
7
+ xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
8
+ xmlns="http://www.w3.org/2001/XMLSchema"
9
+ elementFormDefault="qualified">
10
+
11
+ <!--
12
+ Import common element types.
13
+ -->
14
+ <import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="vendor/ietf/eppcom-1.0.xsd"/>
15
+ <import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="vendor/ietf/epp-1.0.xsd"/>
16
+ <import namespace="urn:ietf:params:xml:ns:contact-1.0" schemaLocation="vendor/ietf/contact-1.0.xsd"/>
17
+
18
+ <annotation>
19
+ <documentation>
20
+ Extensible Provisioning Protocol v1.0
21
+ SmallRegistry extensions.
22
+ </documentation>
23
+ </annotation>
24
+
25
+ <element name="ext" type="sr:extType"/>
26
+
27
+ <complexType name="extType">
28
+ <choice>
29
+ <element name="infData" type="sr:infDataType"/>
30
+ <element name="create" type="sr:createType"/>
31
+ <element name="update" type="sr:updateType"/>
32
+ </choice>
33
+ </complexType>
34
+
35
+ <complexType name="infDataType">
36
+ <choice>
37
+ <element name="contact" type="sr:contactType"/>
38
+ </choice>
39
+ </complexType>
40
+
41
+ <complexType name="createType">
42
+ <choice>
43
+ <element name="contact" type="sr:contactType"/>
44
+ </choice>
45
+ </complexType>
46
+
47
+ <complexType name="updateType">
48
+ <choice>
49
+ <element name="contact" type="sr:contactType"/>
50
+ </choice>
51
+ </complexType>
52
+
53
+ <complexType name="contactType">
54
+ <choice>
55
+ <element name="org" type="sr:legalEntity"/>
56
+ <element name="person" type="sr:physicalPerson"/>
57
+ </choice>
58
+ </complexType>
59
+
60
+ <complexType name="legalEntity">
61
+ <sequence>
62
+ <element name="companySerial" type="eppcom:minTokenType"/>
63
+ </sequence>
64
+ </complexType>
65
+
66
+ <complexType name="physicalPerson">
67
+ <sequence>
68
+ <element name="birthDate" type="date"/>
69
+ <element name="birthPlace" type="eppcom:minTokenType"/>
70
+ </sequence>
71
+ </complexType>
72
+
73
+ <!--
74
+ End of schema.
75
+ -->
76
+ </schema>
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: epp-client-smallregistry
3
+ version: !ruby/object:Gem::Version
4
+ hash: 51
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 11
9
+ - 0
10
+ version: 0.11.0
11
+ platform: ruby
12
+ authors:
13
+ - Mathieu Arnold
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-05-14 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: bundler
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 23
29
+ segments:
30
+ - 1
31
+ - 0
32
+ - 0
33
+ version: 1.0.0
34
+ type: :development
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: nokogiri
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 7
45
+ segments:
46
+ - 1
47
+ - 4
48
+ version: "1.4"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: builder
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 15
60
+ segments:
61
+ - 2
62
+ - 1
63
+ - 2
64
+ version: 2.1.2
65
+ type: :runtime
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: epp-client-base
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ hash: 51
76
+ segments:
77
+ - 0
78
+ - 11
79
+ - 0
80
+ version: 0.11.0
81
+ type: :runtime
82
+ version_requirements: *id004
83
+ description: Smallregistry EPP client library.
84
+ email:
85
+ - m@absolight.fr
86
+ executables: []
87
+
88
+ extensions: []
89
+
90
+ extra_rdoc_files: []
91
+
92
+ files:
93
+ - ChangeLog
94
+ - EXAMPLE.SMALLREGISTRY
95
+ - Gemfile
96
+ - MIT-LICENSE
97
+ - README
98
+ - Rakefile
99
+ - epp-client-smallregistry.gemspec
100
+ - lib/epp-client/smallregistry.rb
101
+ - vendor/smallregistry/sr-1.0.xsd
102
+ homepage: https://github.com/Absolight/epp-client
103
+ licenses: []
104
+
105
+ post_install_message:
106
+ rdoc_options: []
107
+
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 57
116
+ segments:
117
+ - 1
118
+ - 8
119
+ - 7
120
+ version: 1.8.7
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ hash: 23
127
+ segments:
128
+ - 1
129
+ - 3
130
+ - 6
131
+ version: 1.3.6
132
+ requirements: []
133
+
134
+ rubyforge_project:
135
+ rubygems_version: 1.8.16
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: Smallregistry EPP client library
139
+ test_files: []
140
+