ssedap-client 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ 1.9.3-p194
@@ -9,33 +9,29 @@ module SSEDAP
9
9
  @host = host unless host.nil?
10
10
  end
11
11
 
12
+ def create_anon(username, password)
13
+ api_cal "/api/create_anon", username: username, password: password
14
+ end
15
+
12
16
  def authorize(username, password)
13
- ps = session
17
+ api_call "/api/authorize", username: username, password: password
18
+ end
14
19
 
15
- # url encode parameters
16
- username = CGI::escape username
17
- password = CGI::escape password
20
+ def userinfo(username, password, lookup)
21
+ api_call "/api/userinfo", username: username, password: password, lookup: lookup
22
+ end
18
23
 
19
- # make the request
20
- resp = ps.post("/api/authorize", "username=#{username}&password=#{password}")
24
+ private
21
25
 
22
- retval = {}
23
- retval["status"] = resp.status
24
- retval["data"] = JSON.parse resp.body
26
+ def api_call(path, *args)
27
+ if args.first.is_a? Hash
28
+ options = args.first
29
+ end
25
30
 
26
- retval
27
- end
31
+ data = options.map { |k, v| "#{k}=#{CGI::escape v}" }
28
32
 
29
- def userinfo(username, password, lookup)
30
33
  ps = session
31
-
32
- # url encode parameters
33
- username = CGI::escape username
34
- password = CGI::escape password
35
- lookup = CGI::escape lookup
36
-
37
- # make the request
38
- resp = ps.post("/api/userinfo", "username=#{username}&password=#{password}&lookup=#{lookup}")
34
+ resp = ps.post path, data.join('&')
39
35
 
40
36
  retval = {}
41
37
  retval["status"] = resp.status
@@ -44,8 +40,6 @@ module SSEDAP
44
40
  retval
45
41
  end
46
42
 
47
- private
48
-
49
43
  def session
50
44
  ps = Patron::Session.new
51
45
  ps.timeout = 10
@@ -1,5 +1,5 @@
1
1
  module SSEDAP
2
2
  class Client
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssedap-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-02 00:00:00.000000000 Z
13
+ date: 2012-04-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: patron
17
- requirement: &70142811205480 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70142811205480
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: json
28
- requirement: &70142811205000 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,7 +38,12 @@ dependencies:
33
38
  version: '0'
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *70142811205000
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  description: A gem for authenticating and interfacing with an SSEDAP interface.
38
48
  email:
39
49
  - sean@seanbarkley.com
@@ -43,6 +53,7 @@ extensions: []
43
53
  extra_rdoc_files: []
44
54
  files:
45
55
  - .gitignore
56
+ - .rbenv-version
46
57
  - .rvmrc
47
58
  - Gemfile
48
59
  - README.md
@@ -73,7 +84,7 @@ requirements:
73
84
  - Patron, for HTTPS requests
74
85
  - JSON, for decoding response bodies
75
86
  rubyforge_project:
76
- rubygems_version: 1.8.11
87
+ rubygems_version: 1.8.23
77
88
  signing_key:
78
89
  specification_version: 3
79
90
  summary: A gem for authenticating and interfacing with an SSEDAP interface.