Class: Cassiopeia::Client

Inherits:
Base
  • Object
show all
Defined in:
lib/cassiopeia/client.rb

Constant Summary collapse

SERVICE_URL =
Cassiopeia::CONFIG[:service_url]
SERVICE_ID =
Cassiopeia::CONFIG[:service_id]
SERVICE_URL_KEY =
Cassiopeia::CONFIG[:service_url_key]
SERVICE_ID_KEY =
Cassiopeia::CONFIG[:service_id_key]
TICKET_ID_KEY =
Cassiopeia::CONFIG[:ticket_id_key]
REQ_KEY =
Cassiopeia::CONFIG[:rack_unique_req_key]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



46
47
48
49
# File 'lib/cassiopeia/client.rb', line 46

def self.instance
  return @instance if @instance
  @instance = Cassiopeia::Client.new
end

Instance Method Details

#cas_check_url(session, params) ⇒ Object



65
66
67
# File 'lib/cassiopeia/client.rb', line 65

def cas_check_url(session, params)
  server_url + "?" + hash_to_query(cas_data(session, params))
end

#cas_current_ticket(session, request) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cassiopeia/client.rb', line 51

def cas_current_ticket(session, request)
  res = do_post(server_url, cas_data(session, request))
  case res
  when Net::HTTPSuccess
    begin
      return ActiveSupport::JSON.decode(res.body).symbolize_keys if Cassiopeia::CONFIG[:format] == "js"
      return YAML::load(res.body).symbolize_keys if Cassiopeia::CONFIG[:format] == "yaml"
      return Hash.from_xml(res.body).symbolize_keys if Cassiopeia::CONFIG[:format] == "xml"
    rescue 
    end
  end 
  return {}
end