Class: EPPClient::Base

Inherits:
Object
  • Object
show all
Includes:
Connection, Contact, Domain, Poll, SSL, Session, XML
Defined in:
lib/epp-client/base.rb

Constant Summary collapse

SCHEMAS =
%w[
  epp-1.0
  domain-1.0
  host-1.0
  contact-1.0
]
SCHEMAS_EXT_IETF =
%w[
  rgp-1.0
]

Constants included from Poll

Poll::PARSERS

Instance Attribute Summary collapse

Attributes included from SSL

#ssl_cert, #ssl_key

Attributes included from Connection

#recv_frame, #sent_frame, #srv_ext, #srv_lang, #srv_ns, #srv_version

Attributes included from XML

#msgQ_count, #msgQ_id, #recv_xml, #sent_xml, #trID

Instance Method Summary collapse

Methods included from Contact

#contact_check, #contact_check_process, #contact_check_xml, #contact_create, #contact_create_process, #contact_create_xml, #contact_delete, #contact_delete_xml, #contact_info, #contact_info_process, #contact_info_xml, #contact_update, #contact_update_xml

Methods included from Domain

#domain_check, #domain_check_process, #domain_check_xml, #domain_contacts_xml, #domain_create, #domain_create_process, #domain_create_xml, #domain_delete, #domain_delete_xml, #domain_info, #domain_info_process, #domain_info_xml, #domain_nss_xml, #domain_pending_action_process, #domain_transfer_response, #domain_update, #domain_update_xml

Methods included from Poll

#poll_ack, #poll_ack_xml, #poll_req, #poll_req_process, #poll_req_xml

Methods included from SSL

#open_connection

Methods included from Connection

#close_connection, #get_frame, #greeting_process, #open_connection, #send_frame, #send_request

Methods included from Session

#hello, #login, #logout

Methods included from XML

#builder, #command, #extension, #get_result, #get_trid, #insert_extension, #raw_builder, #recv_frame_to_xml, #sent_frame_to_xml

Constructor Details

#initialize(attrs) ⇒ Base

Required Attributes

:server

The EPP server to connect to

:client_id

The tag or username used with <login> requests.

:password

The password used with <login> requests.

Optional Attributes

:port

The EPP standard port is 700. However, you can choose a different port to use.

:clTRID

The client transaction identifier is an element that EPP specifies MAY be used to uniquely identify the command to the server. The string “-<index>” will be added to it, index being incremented at each command. Defaults to “test-<pid>-<random>”

:lang

Set custom language attribute. Default is ‘en’.

:services

Use custom EPP services in the <login> frame. The defaults use the EPP standard domain, contact and host 1.0 services.

:extensions

URLs to custom extensions to standard EPP. Use these to extend the standard EPP (e.g., AFNIC, smallregistry uses extensions). Defaults to none.

:version

Set the EPP version. Defaults to “1.0”.

:ssl_cert

The file containing the client certificate.

:ssl_key

The file containing the key of the certificate.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/epp-client/base.rb', line 78

def initialize(attrs)
  unless attrs.key?(:server) && attrs.key?(:client_id) && attrs.key?(:password)
	raise ArgumentError, "server, client_id and password are required"
  end

  attrs.each do |k,v|
	begin
	  self.send("#{k}=", v)
	rescue NoMethodError
	  raise ArgumentError, "there is no #{k} argument"
	end
  end

  @port ||= 700
  @lang ||= "en"
  @services ||= EPPClient::SCHEMAS_URL.values_at('domain', 'contact', 'host')
  @extensions ||= []
  @version ||= "1.0"
  @clTRID ||= "test-#{$$}-#{rand(1000)}"
  @clTRID_index = 0

  @context ||= OpenSSL::SSL::SSLContext.new

  @logged_in = false
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def client_id
  @client_id
end

#clTRIDObject

:nodoc:



104
105
106
107
# File 'lib/epp-client/base.rb', line 104

def clTRID # :nodoc:
  @clTRID_index += 1
  @clTRID + "-#{@clTRID_index}"
end

#contextObject

Returns the value of attribute context.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def context
  @context
end

#extensionsObject

Returns the value of attribute extensions.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def extensions
  @extensions
end

#langObject

Returns the value of attribute lang.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def lang
  @lang
end

#passwordObject

Returns the value of attribute password.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def password
  @password
end

#portObject

Returns the value of attribute port.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def port
  @port
end

#serverObject

Returns the value of attribute server.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def server
  @server
end

#servicesObject

Returns the value of attribute services.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def services
  @services
end

#versionObject

Returns the value of attribute version.



47
48
49
# File 'lib/epp-client/base.rb', line 47

def version
  @version
end

Instance Method Details

#debugObject



109
110
111
# File 'lib/epp-client/base.rb', line 109

def debug
  $DEBUG || ENV['EPP_CLIENT_DEBUG']
end