eteos-client 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/eteos-client.rb +48 -0
- metadata +37 -0
data/lib/eteos-client.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# eteos-client.rb
|
2
|
+
# eteos client for rails
|
3
|
+
# v0.2.0
|
4
|
+
#
|
5
|
+
# David Adams
|
6
|
+
# March 10, 2005
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'uri'
|
10
|
+
require 'net/http'
|
11
|
+
|
12
|
+
module EteosClient
|
13
|
+
EteosLoginURL = "http://www.eteos.com/login?url="
|
14
|
+
EteosServer = "www.eteos.com"
|
15
|
+
EteosTicketURI = "/ticket/"
|
16
|
+
|
17
|
+
# authenticate takes session hash and updates it
|
18
|
+
def authenticate
|
19
|
+
# check to see that EteosClientURL is set
|
20
|
+
if EteosClientURL.nil? or EteosClientURL.empty?
|
21
|
+
render_text "Error: you must specify EteosClientURL " +
|
22
|
+
"in your class definition " +
|
23
|
+
"before calling authenticate."
|
24
|
+
|
25
|
+
# if eteosUsername is defined, do nothing
|
26
|
+
unless @session["eteosUsername"]
|
27
|
+
unless @params["eteosTicket"]
|
28
|
+
# TODO: URI.escape doesn't sufficiently escape URLs
|
29
|
+
redirect_to EteosLoginURL + URI.escape(EteosClientURL + @request.request_uri)
|
30
|
+
else
|
31
|
+
# we have a ticket, we must check it
|
32
|
+
Net::HTTP.start(EteosServer, 80) do |http|
|
33
|
+
response = http.get("#{EteosTicketURI + @params['eteosTicket']}")
|
34
|
+
status,msg = response.body.split(":")
|
35
|
+
if status == "OK"
|
36
|
+
@session["eteosUsername"] = msg
|
37
|
+
return true
|
38
|
+
else
|
39
|
+
render_text "Invalid Ticket. Please try again!"
|
40
|
+
return false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
else
|
45
|
+
return true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.4
|
3
|
+
specification_version: 1
|
4
|
+
name: eteos-client
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2005-03-10
|
8
|
+
summary: Eteos Client for Ruby on Rails
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: daveadams@gmail.com
|
12
|
+
homepage: http://eteos-client.rubyforge.org
|
13
|
+
rubyforge_project: eteos-client
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
-
|
22
|
+
- ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
25
|
+
version:
|
26
|
+
platform: ruby
|
27
|
+
authors:
|
28
|
+
- David Adams
|
29
|
+
files:
|
30
|
+
- lib/eteos-client.rb
|
31
|
+
test_files: []
|
32
|
+
rdoc_options: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
executables: []
|
35
|
+
extensions: []
|
36
|
+
requirements: []
|
37
|
+
dependencies: []
|