Class: KonoEppLogin

Inherits:
KonoEppCommand show all
Defined in:
lib/epp/epp_command/login.rb

Instance Method Summary collapse

Constructor Details

#initialize(id = nil, password = nil) ⇒ KonoEppLogin

Returns a new instance of KonoEppLogin.



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/epp/epp_command/login.rb', line 2

def initialize( id = nil, password = nil )
  super( nil, nil )

  @command = root.elements['command']
  @login = @command.add_element( "login" )

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

  @command.add_element( "clTRID" ).text = "ABC-12345"
end

Instance Method Details

#extensionsObject



72
73
74
75
76
77
78
# File 'lib/epp/epp_command/login.rb', line 72

def extensions
  svc_extension = @login.elements['svcs/svcExtension']

  svc_extension.elements.each( "extURI" ) { |obj| res << obj.text } if svcs_extension

  return res
end

#extensions=(extensions) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/epp/epp_command/login.rb', line 59

def extensions=( extensions )
  svcs = @login.elements['svcs']

  svcs = @login.add_element( "svcs" ) unless svcs

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

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

#langObject



34
35
36
37
38
# File 'lib/epp/epp_command/login.rb', line 34

def lang
  lang = @options.elements['lang']

  lang.text if version
end

#lang=(value) ⇒ Object



27
28
29
30
31
32
# File 'lib/epp/epp_command/login.rb', line 27

def lang=( value )
  @options = @login.add_element( "options" ) unless @options
  @options.add_element( "lang") unless @options.elements['lang']

  @options.elements['lang'].text = value
end

#new_password=(value) ⇒ Object



40
41
42
43
# File 'lib/epp/epp_command/login.rb', line 40

def new_password=( value )
  newpw = @login.add_element( "newPW" )
  newpw.text = value
end

#servicesObject



50
51
52
53
54
55
56
57
# File 'lib/epp/epp_command/login.rb', line 50

def services
  svcs = @login.elements['svcs']

  res = []
  svcs.elements.each( "objURI" ) { |obj| res << obj.text } if svcs

  return res
end

#services=(services) ⇒ Object



45
46
47
48
# File 'lib/epp/epp_command/login.rb', line 45

def services=( services )
  svcs = @login.add_element( "svcs" ) unless @login.elements['svcs']
  services.each {|service| svcs.add_element("objURI").text = service }
end

#versionObject



21
22
23
24
25
# File 'lib/epp/epp_command/login.rb', line 21

def version
  version = @options.elements['version']

  version.text if version
end

#version=(value) ⇒ Object



14
15
16
17
18
19
# File 'lib/epp/epp_command/login.rb', line 14

def version=( value )
  @options = @login.add_element( "options" ) unless @options
  @options.add_element( "version") unless @options.elements['version']

  @options.elements['version'].text = value
end