casual 0.1.0 → 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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/casual.gemspec +2 -2
  3. data/lib/casual.rb +9 -9
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{casual}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Zach Holman"]
12
- s.date = %q{2010-03-31}
12
+ s.date = %q{2010-06-10}
13
13
  s.description = %q{A tiny CAS client for Ruby}
14
14
  s.email = %q{github.com@zachholman.com}
15
15
  s.extra_rdoc_files = [
@@ -1,10 +1,10 @@
1
1
  require 'net/https'
2
- require 'nokogiri'
2
+ require 'hpricot'
3
3
 
4
4
  module Casual
5
5
  class Client
6
6
  attr_accessor :server_path, :callback_url, :port
7
-
7
+
8
8
  def initialize(config)
9
9
  @server_path = config[:server_path]
10
10
  @callback_url = config[:callback_url]
@@ -21,10 +21,10 @@ module Casual
21
21
  status,response = connection.post('/login', params)#.last
22
22
  (status.code == '200') ? username : nil
23
23
  end
24
-
24
+
25
25
  def acquire_ticket
26
26
  login_page = connection.get('/login')
27
- Nokogiri::HTML(login_page.body).css('input#lt').first['value']
27
+ Hpricot(login_page.body).search('input[@id=lt]').first['value']
28
28
  end
29
29
 
30
30
  def connection
@@ -32,19 +32,19 @@ module Casual
32
32
  http.use_ssl = true
33
33
  http
34
34
  end
35
-
35
+
36
36
  def authenticate_ticket(ticket)
37
37
  connection.get("/serviceValidate?service=#{callback_url}&ticket=#{ticket}").body
38
38
  end
39
-
39
+
40
40
  def user_login(ticket)
41
- user = Nokogiri::XML(authenticate_ticket(ticket)).xpath('//cas:authenticationSuccess //cas:user').text
41
+ user = Hpricot::XML(authenticate_ticket(ticket)).search('//cas:authenticationSuccess //cas:user').text
42
42
  user.strip != '' ? user : nil
43
43
  end
44
-
44
+
45
45
  def server_url
46
46
  "https://#{server_path}:#{port}"
47
47
  end
48
-
48
+
49
49
  end
50
50
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Zach Holman
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-31 00:00:00 -07:00
17
+ date: 2010-06-10 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency