ruby_eds 1.0.2

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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ruby_eds.rb +41 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6f59b2bc90e835f7eee7c095f544263f313094f2
4
+ data.tar.gz: b0b4ec7c533ccc5f096711c892a68d42c2a7fe3e
5
+ SHA512:
6
+ metadata.gz: 2ffbc6566c16ee62f8a4417ea076df0751493003b819044fe27737c2dd2f5e7fef682eb3b816f8e7060da1343219dec8cf11cf05cdf4faf115aafa1db9e5bccb
7
+ data.tar.gz: f1eafb64e26135c65ad002a2a25eaca549f583b0b4e3909268af77df2b15fddd8f8739b85b7bf72fe6f1a51651c5c70da9065a6875ffc622c20de1b6a2ab21a0
data/lib/ruby_eds.rb ADDED
@@ -0,0 +1,41 @@
1
+ require 'rest-open-uri'
2
+ require 'nokogiri'
3
+ require 'rest-client'
4
+ require 'json'
5
+
6
+ module RubyEDS
7
+
8
+ def authenticate_user(username, password)
9
+ auth_json = {"UserId"=>"#{username}","Password"=>"#{password}","InterfaceId"=>"WSapi"}.to_json
10
+ response = open('https://eds-api.ebscohost.com/authservice/rest/UIDAuth', :method=>:post, :body => auth_json, 'Content-Type' => 'application/json')
11
+ doc = Nokogiri::XML(response.read)
12
+ doc.remove_namespaces!
13
+ auth_token = doc.xpath("//AuthToken").inner_text
14
+ end
15
+
16
+ def open_session(profile, guest, auth_token)
17
+ response = RestClient.get "http://eds-api.ebscohost.com/edsapi/rest/CreateSession", {:params=>{"profile"=>profile, "guest"=>guest}, :content_type=>:json, "x-authenticationToken"=>auth_token}
18
+ doc = Nokogiri::XML(response)
19
+ doc.remove_namespaces!
20
+ session_token = doc.xpath("//SessionToken").inner_text
21
+ end
22
+
23
+ def close_session(session_token, auth_token)
24
+ response = RestClient.get "http://eds-api.ebscohost.com/edsapi/rest/endsession", {:params=>{"sessiontoken"=>session_token}, :content_type=>:json, "x-authenticationToken"=>auth_token, "x-sessionToken"=>session_token}
25
+ doc = Nokogiri::XML(response)
26
+ doc.remove_namespaces!
27
+ success = doc.xpath("//IsSuccessful").inner_text
28
+ end
29
+
30
+ def get_info(session_token, auth_token, return_type="xml")
31
+ response = RestClient.get "http://eds-api.ebscohost.com/edsapi/rest/info", "x-authenticationToken"=>auth_token, "x-sessionToken"=>session_token, :accept=>return_type
32
+ end
33
+
34
+ def basic_search(query, session_token, auth_token, view='brief', offset=1, limit=10, order='relevance', return_type="xml")
35
+ response = RestClient.get "http://eds-api.ebscohost.com/edsapi/rest/Search", {:params=>{"query-1"=>query}, "x-authenticationToken"=>auth_token, "x-sessionToken"=>session_token, :accept=>return_type}
36
+ end
37
+
38
+ def advanced_search(search_json, return_type="xml")
39
+ end
40
+
41
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_eds
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Sam Popowich
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Ruby wrapper for EDS API.
14
+ email: Sam.Popowich@ualberta.ca
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/ruby_eds.rb
20
+ homepage: http://github.com/ualbertalib/ruby_eds
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.0.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Ruby wrapper for EDS API.
44
+ test_files: []