mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 12:08:27 +02:00
Rubocop autocorrect
This commit is contained in:
parent
f8c48a7456
commit
6c5c0b38c8
59 changed files with 533 additions and 546 deletions
|
@ -1,28 +1,24 @@
|
|||
module Epp
|
||||
def read_body filename
|
||||
def read_body(filename)
|
||||
File.read("spec/epp/requests/#{filename}")
|
||||
end
|
||||
|
||||
# handles connection and login automatically
|
||||
def epp_request(data, type=:filename)
|
||||
begin
|
||||
return parse_response(server.request(read_body(data))) if type == :filename
|
||||
return parse_response(server.request(data))
|
||||
rescue Exception => e
|
||||
e
|
||||
end
|
||||
def epp_request(data, type = :filename)
|
||||
return parse_response(server.request(read_body(data))) if type == :filename
|
||||
return parse_response(server.request(data))
|
||||
rescue => e
|
||||
e
|
||||
end
|
||||
|
||||
def epp_plain_request(data, type=:filename)
|
||||
begin
|
||||
return parse_response(server.send_request(read_body(data))) if type == :filename
|
||||
return parse_response(server.send_request(data))
|
||||
rescue Exception => e
|
||||
e
|
||||
end
|
||||
def epp_plain_request(data, type = :filename)
|
||||
return parse_response(server.send_request(read_body(data))) if type == :filename
|
||||
return parse_response(server.send_request(data))
|
||||
rescue => e
|
||||
e
|
||||
end
|
||||
|
||||
def parse_response raw
|
||||
def parse_response(raw)
|
||||
res = Nokogiri::XML(raw)
|
||||
|
||||
obj = {
|
||||
|
@ -33,7 +29,7 @@ module Epp
|
|||
}
|
||||
|
||||
res.css('epp response result').each do |x|
|
||||
obj[:results] << {result_code: x[:code], msg: x.css('msg').text, value: x.css('value > *').try(:first).try(:text)}
|
||||
obj[:results] << { result_code: x[:code], msg: x.css('msg').text, value: x.css('value > *').try(:first).try(:text) }
|
||||
end
|
||||
|
||||
obj[:result_code] = obj[:results][0][:result_code]
|
||||
|
@ -42,26 +38,26 @@ module Epp
|
|||
obj
|
||||
end
|
||||
|
||||
#print output
|
||||
# print output
|
||||
def po(r)
|
||||
puts r[:parsed].to_s
|
||||
end
|
||||
|
||||
### REQUEST TEMPLATES ###
|
||||
|
||||
def domain_create_xml(xml_params={})
|
||||
xml_params[:nameservers] = xml_params[:nameservers] || [{hostObj: 'ns1.example.net'}, {hostObj: 'ns2.example.net'}]
|
||||
def domain_create_xml(xml_params = {})
|
||||
xml_params[:nameservers] = xml_params[:nameservers] || [{ hostObj: 'ns1.example.net' }, { hostObj: 'ns2.example.net' }]
|
||||
xml_params[:contacts] = xml_params[:contacts] || [
|
||||
{contact_value: 'sh8013', contact_type: 'admin'},
|
||||
{contact_value: 'sh8013', contact_type: 'tech'},
|
||||
{contact_value: 'sh801333', contact_type: 'tech'}
|
||||
{ contact_value: 'sh8013', contact_type: 'admin' },
|
||||
{ contact_value: 'sh8013', contact_type: 'tech' },
|
||||
{ contact_value: 'sh801333', contact_type: 'tech' }
|
||||
]
|
||||
|
||||
# {hostAttr: {hostName: 'ns1.example.net', hostAddr_value: '192.0.2.2', hostAddr_ip}}
|
||||
|
||||
xml = Builder::XmlMarkup.new
|
||||
|
||||
xml.instruct!(:xml, :standalone => 'no')
|
||||
xml.instruct!(:xml, standalone: 'no')
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
|
||||
xml.command do
|
||||
xml.create do
|
||||
|
@ -93,10 +89,10 @@ module Epp
|
|||
end
|
||||
end
|
||||
|
||||
def domain_renew_xml(xml_params={})
|
||||
def domain_renew_xml(xml_params = {})
|
||||
xml = Builder::XmlMarkup.new
|
||||
|
||||
xml.instruct!(:xml, :standalone => 'no')
|
||||
xml.instruct!(:xml, standalone: 'no')
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
|
||||
xml.command do
|
||||
xml.renew do
|
||||
|
@ -111,11 +107,11 @@ module Epp
|
|||
end
|
||||
end
|
||||
|
||||
def domain_check_xml(xml_params={})
|
||||
def domain_check_xml(xml_params = {})
|
||||
xml_params[:names] = xml_params[:names] || ['example.ee']
|
||||
xml = Builder::XmlMarkup.new
|
||||
|
||||
xml.instruct!(:xml, :standalone => 'no')
|
||||
xml.instruct!(:xml, standalone: 'no')
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
|
||||
xml.command do
|
||||
xml.check do
|
||||
|
@ -130,14 +126,14 @@ module Epp
|
|||
end
|
||||
end
|
||||
|
||||
def domain_info_xml(xml_params={})
|
||||
def domain_info_xml(xml_params = {})
|
||||
xml_params[:name_value] = xml_params[:name_value] || 'example.ee'
|
||||
xml_params[:name_hosts] = xml_params[:name_hosts] || 'all'
|
||||
xml_params[:pw] = xml_params[:pw] || '2fooBAR'
|
||||
|
||||
xml = Builder::XmlMarkup.new
|
||||
|
||||
xml.instruct!(:xml, :standalone => 'no')
|
||||
xml.instruct!(:xml, standalone: 'no')
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do
|
||||
xml.command do
|
||||
xml.info do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue