module DLDInternet::OpenSRS::API::MixIns::Cookie
Public Instance Methods
cookie(domain='delionsden.com')
click to toggle source
# 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