Class: CasRestClient

Inherits:
Object
  • Object
show all
Defined in:
lib/cas_rest_client/cas_rest_client.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{:use_cookies => true}

Instance Method Summary collapse

Constructor Details

#initialize(cas_opts = {}) ⇒ CasRestClient

Returns a new instance of CasRestClient.



8
9
10
11
12
13
14
15
16
# File 'lib/cas_rest_client/cas_rest_client.rb', line 8

def initialize(cas_opts = {})
  @cas_opts = DEFAULT_OPTIONS.merge(get_cas_config).merge(cas_opts)
  
  begin
    get_tgt
  rescue RestClient::BadRequest => e
    raise RestClient::Request::Unauthorized.new
  end
end

Instance Method Details

#delete(uri, options = {}) ⇒ Object



22
23
24
# File 'lib/cas_rest_client/cas_rest_client.rb', line 22

def delete(uri, options = {})
  execute("delete", uri, {}, options)
end

#get(uri, options = {}) ⇒ Object



18
19
20
# File 'lib/cas_rest_client/cas_rest_client.rb', line 18

def get(uri, options = {})
  execute("get", uri, {}, options)
end

#post(uri, params = {}, options = {}) ⇒ Object



26
27
28
# File 'lib/cas_rest_client/cas_rest_client.rb', line 26

def post(uri, params = {}, options = {})
  execute("post", uri, params, options)
end

#put(uri, params = {}, options = {}) ⇒ Object



30
31
32
# File 'lib/cas_rest_client/cas_rest_client.rb', line 30

def put(uri, params = {}, options = {})
  execute("put", uri, params, options)
end