9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/dldinternet/opensrs/api/mixins/cookie.rb', line 9
def cookie(domain='delionsden.com')
domain ||= 'dldinternet.com'
@cookie ||= (
response = server.call(
action: 'SET',
object: 'COOKIE',
attributes: {
domain: domain,
reg_username: options[:username],
reg_password: options[:password],
},
)
hash = Hashie::Mash.new(response.response)
@logger.debug.ai
unless hash['is_success'].to_i == 1
@logger.fatal StandardError.new(hash['response_text'])
exit 1
end
hash['attributes']['cookie'] rescue nil)
rescue ::OpenSRS::BadResponse => e
@logger.error e.message
exit 1
rescue ::Net::HTTPServerException => e
@logger.error "#{e.message}: #{(e.response && e.response[:body]) ? e.response.body : ''}"
exit 1
rescue SystemExit => e
exit e.status
rescue StandardError => e
raise e
rescue Exception => e
@logger.error "Unknown exception: #{e}"
raise e
end
|