Skip to content

Commit

Permalink
Version bump to 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Delsman committed Feb 4, 2010
1 parent d7df2d5 commit ed8ed75
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ begin

# Dependencies
gem.add_development_dependency "shoulda"
gem.add_dependency "activesupport"
gem.add_dependency "active_support"
gem.add_dependency "hpricot"
end
rescue LoadError
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.1
1.2.0
2 changes: 1 addition & 1 deletion lib/epp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rubygems'
require 'openssl'
require 'socket'
require 'activesupport'
require 'active_support'
require 'rexml/document'
require 'hpricot'

Expand Down
29 changes: 15 additions & 14 deletions lib/epp/server.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module Epp #:nodoc:
class Server
include REXML
include RequiresParameters

attr_accessor :tag, :password, :server, :port, :old_server, :lang, :extensions, :version
attr_accessor :tag, :password, :server, :port, :old_server, :services, :lang, :extensions, :version

# ==== Required Attrbiutes
#
Expand All @@ -27,7 +28,7 @@ def initialize(attributes = {})
@server = attributes[:server]
@port = attributes[:port] || 700
@old_server = attributes[:old_server] || false
@lang = attributes[:lang] || 'en'
@lang = attributes[:lang] || "en"
@services = attributes[:services] || ["urn:ietf:params:xml:ns:domain-1.0", "urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:host-1.0"]
@extensions = attributes[:extensions] || []
@version = attributes[:verison] || "1.0"
Expand All @@ -47,7 +48,7 @@ def request(xml)
begin
@response = send_request(xml)
ensure
if @logged_in && !@old_server
if @logged_in && !old_server
@logged_in = false if logout
end

Expand All @@ -66,22 +67,22 @@ def login
command = xml.root.add_element("command")
login = command.add_element("login")

login.add_element("clID").text = @tag
login.add_element("pw").text = @password
login.add_element("clID").text = tag
login.add_element("pw").text = password

options = login.add_element("options")
options.add_element("version").text = @version
options.add_element("lang").text = @lang
options.add_element("version").text = version
options.add_element("lang").text = lang

services = login.add_element("svcs")
services.add_element("objURI").text = "urn:ietf:params:xml:ns:domain-1.0"
services.add_element("objURI").text = "urn:ietf:params:xml:ns:contact-1.0"
services.add_element("objURI").text = "urn:ietf:params:xml:ns:host-1.0"

# Include schema extensions for registrars which require it
extensions_container = services.add_element("svcExtension") unless @extensions.empty?
extensions_container = services.add_element("svcExtension") unless extensions.empty?

for uri in @extensions
for uri in extensions
extensions_container.add_element("extURI").text = uri
end

Expand Down Expand Up @@ -121,8 +122,8 @@ def logout
end

def new_epp_request
xml = REXML::Document.new
xml << REXML::XMLDecl.new("1.0", "UTF-8", "no")
xml = Document.new
xml << XMLDecl.new("1.0", "UTF-8", "no")

xml.add_element("epp", {
"xmlns" => "urn:ietf:params:xml:ns:epp-1.0",
Expand All @@ -145,7 +146,7 @@ def send_request(xml)
# the EPP <tt><greeting></tt> frame which is sent by the
# server upon connection.
def open_connection
@connection = TCPSocket.new(@server, @port)
@connection = TCPSocket.new(server, port)
@socket = OpenSSL::SSL::SSLSocket.new(@connection)

# Synchronously close the connection & socket
Expand Down Expand Up @@ -178,7 +179,7 @@ def close_connection
# the connection is broken, a SocketError will be raised. Otherwise,
# it will return a string containing the XML from the server.
def get_frame
if @old_server
if old_server
data = ""
first_char = @socket.read(1)

Expand Down Expand Up @@ -219,7 +220,7 @@ def get_frame
# size of the frame sent to the server. If the socket returns EOF,
# the connection has closed and a SocketError is raised.
def send_frame(xml)
@socket.write(@old_server ? (xml + "\r\n") : ([xml.size + 4].pack("N") + xml))
@socket.write(old_server ? (xml + "\r\n") : ([xml.size + 4].pack("N") + xml))
end
end
end

0 comments on commit ed8ed75

Please sign in to comment.