ultraspeed-epp 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +79 -7
- data/Rakefile +8 -1
- data/lib/epp/server.rb +4 -14
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -1,14 +1,86 @@
|
|
1
|
-
= EPP Version 1.0
|
1
|
+
= EPP Version 1.0.1
|
2
2
|
|
3
|
-
|
3
|
+
The EPP gem provides basic functionality for connecting and making requests on EPP (Extensible Provisioning Protocol) servers. Currently, major providers Centralnic and Nominet have been tested.
|
4
4
|
|
5
|
-
|
5
|
+
* {Nominet Standard EPP Documentation}[http://www.nominet.org.uk/registrars/systems/standardepp/]
|
6
|
+
* {Centralnic Labs EPP Documentation}[http://labs.centralnic.com/epp/]
|
6
7
|
|
7
|
-
|
8
|
+
== Installation
|
8
9
|
|
9
|
-
|
10
|
+
You can install this gem with:
|
10
11
|
|
11
|
-
|
12
|
+
$ sudo gem sources -a http://gems.github.com
|
13
|
+
$ sudo gem install ultraspeed-epp
|
14
|
+
|
15
|
+
Then, you can require it in your Ruby app:
|
16
|
+
|
17
|
+
require "epp"
|
18
|
+
|
19
|
+
If you're using Rails, add the following line to your Rails <tt>config/environment.rb</tt>:
|
20
|
+
|
21
|
+
config.gem "ultraspeed-epp", :lib => "epp", :source => "http://gems.github.com"
|
22
|
+
|
23
|
+
Once you do that, you can install the gem by typing <tt>sudo rake gems:install</tt>.
|
24
|
+
|
25
|
+
== Example Usage
|
26
|
+
|
27
|
+
First, you must initialize an Epp::Server object to use. This requires the server address and port:
|
28
|
+
|
29
|
+
server = Epp::Server.new(
|
30
|
+
:server => "testbed-epp.nominet.org.uk",
|
31
|
+
:port => 700
|
32
|
+
)
|
33
|
+
|
34
|
+
If no port is specified, it will be assumed that you will be using port 700.
|
35
|
+
|
36
|
+
You would then make an XML request to the server. You can build this however you'd like. For simplicity purposes, here is a string <tt><login></tt> request:
|
37
|
+
|
38
|
+
xml = %{
|
39
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
40
|
+
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
|
41
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
42
|
+
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
43
|
+
<command>
|
44
|
+
<login>
|
45
|
+
<clID>EXAMPLE-TAG</clID>
|
46
|
+
<pw>foo-123</pw>
|
47
|
+
<options>
|
48
|
+
<version>1.0</version>
|
49
|
+
<lang>en</lang>
|
50
|
+
</options>
|
51
|
+
<svcs>
|
52
|
+
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
|
53
|
+
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
|
54
|
+
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
|
55
|
+
</svcs>
|
56
|
+
</login>
|
57
|
+
<clTRID>ABC-12345</clTRID>
|
58
|
+
</command>
|
59
|
+
</epp>
|
60
|
+
}
|
61
|
+
|
62
|
+
response = server.request(xml)
|
63
|
+
|
64
|
+
The EPP server would then return the XML response as a string, and set it equal to <tt>response</tt> for your usage.
|
65
|
+
|
66
|
+
You can close the connection to the server completely by using the following:
|
67
|
+
|
68
|
+
server.close_connection
|
69
|
+
|
70
|
+
== Bugs/Issues
|
71
|
+
|
72
|
+
Please report all issues using the GitHub issue tracker at:
|
73
|
+
|
74
|
+
http://github.com/ultraspeed/epp/issues
|
75
|
+
|
76
|
+
== Credit
|
77
|
+
|
78
|
+
Author:: Josh Delsman at Ultraspeed (http://twitter.com/voxxit)
|
79
|
+
Inspired from:: http://labs.centralnic.com/Net_EPP_Client.php
|
80
|
+
|
81
|
+
== License
|
82
|
+
|
83
|
+
The MIT License
|
12
84
|
|
13
85
|
Copyright (c) 2009 Josh Delsman (Ultraspeed)
|
14
86
|
|
@@ -29,4 +101,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
29
101
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
30
102
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
31
103
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
32
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
104
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
require 'rake/clean'
|
4
|
+
require 'hanna/rdoctask'
|
4
5
|
require 'fileutils'
|
5
6
|
|
6
7
|
require File.dirname(__FILE__) + '/lib/epp'
|
7
8
|
|
8
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
9
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
10
|
+
|
11
|
+
# Rdoc
|
12
|
+
Rake::RDocTask.new do |rd|
|
13
|
+
rd.main = "README.rdoc"
|
14
|
+
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
15
|
+
end
|
data/lib/epp/server.rb
CHANGED
@@ -5,8 +5,8 @@ module Epp #:nodoc:
|
|
5
5
|
def initialize(attributes = {})
|
6
6
|
requires!(attributes, :server, :port)
|
7
7
|
|
8
|
-
@connection =
|
9
|
-
@socket =
|
8
|
+
@connection = TCPSocket.new(attributes[:server], attributes[:port])
|
9
|
+
@socket = OpenSSL::SSL::SSLSocket.new(@connection)
|
10
10
|
|
11
11
|
# Initiate the connection to the server through the SSL socket
|
12
12
|
@socket.connect
|
@@ -21,18 +21,6 @@ module Epp #:nodoc:
|
|
21
21
|
send_frame(xml)
|
22
22
|
get_frame
|
23
23
|
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
# Opens a connection to the EPP server.
|
28
|
-
def open_connection(server, port)
|
29
|
-
TCPSocket.new(server, port)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Opens an SSL socket with the EPP server.
|
33
|
-
def open_socket(connection)
|
34
|
-
OpenSSL::SSL::SSLSocket.new(connection)
|
35
|
-
end
|
36
24
|
|
37
25
|
# Closes the connection to the EPP server. It should be noted
|
38
26
|
# that the EPP specification indicates that clients should send
|
@@ -43,6 +31,8 @@ module Epp #:nodoc:
|
|
43
31
|
@connection.close if defined?(@connection) && !@connection.closed?
|
44
32
|
end
|
45
33
|
|
34
|
+
private
|
35
|
+
|
46
36
|
# Receive an EPP frame from the server. Since the connection is blocking,
|
47
37
|
# this method will wait until the connection becomes available for use. If
|
48
38
|
# the connection is broken, a SocketError will be raised. Otherwise,
|