refworks 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/refworks/response.rb +0 -11
- data/lib/refworks/version.rb +1 -1
- data/lib/refworks.rb +20 -25
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzU5NzhjZDUyNzFkMmQ4ZDFkNGYyNTM1N2IwNjM3MzEzMjE3OTExNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGQyODU2NWVjOTlmM2Y2N2UxYTViZTA1MzY5ZGE0NzIyMjgxZDg0Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzcxNDE0ZDM3YTk5YWI5ZWM4YTdiNzA1NTVmYzczNWUyNjQxODgyNjY3MGM3
|
10
|
+
N2ZhNWQyODhlMThjNGNiNjA5MGI0Y2FkYjdjMmYyZDc5YTBlYWIxN2IzNjNj
|
11
|
+
ZWQ2MGFmZWVmNDg3ZDM2NjIyNjRkNjI0MGVjODJkMTBiYTNiNTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWVlMDk5NWU0ZDJlOTVkYWY0OGU5MWYwNDllZjQzMmIzOTZmODMwMGFjZGQ1
|
14
|
+
MzUyZmU1NDRlOWViYjMzNzUzMWFkNzljODg0ZWM2ZWYyZDlmYmI4MTYxMmE0
|
15
|
+
MjJjOWU0NzcyYThkNWMyNmIyN2Q1Y2ZlYWUyYWVhOGI5ZWI3MzQ=
|
data/lib/refworks/response.rb
CHANGED
@@ -3,17 +3,6 @@ class Response
|
|
3
3
|
attr_reader :body, :parsed_response, :result_code, :result_msg, :process_time
|
4
4
|
|
5
5
|
def initialize(raw_response)
|
6
|
-
# The RefWorks API emits invalid XML. Specifically, when the session is invalid, the ResultMsg field
|
7
|
-
# which comes back contains some illegal raw characters. This is the only set of transformations I
|
8
|
-
# could find which completely eliminate the junk characters.
|
9
|
-
|
10
|
-
p raw_response.body
|
11
|
-
|
12
|
-
raw_response.body.encode!('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')
|
13
|
-
raw_response.body.gsub!(/[\u0001-\u0019]/,'?')
|
14
|
-
|
15
|
-
p raw_response.body
|
16
|
-
|
17
6
|
@body = raw_response.body
|
18
7
|
@parsed_response = raw_response.parsed_response
|
19
8
|
@result_code = parsed_response["refworks"]["RWResult"]["result"]
|
data/lib/refworks/version.rb
CHANGED
data/lib/refworks.rb
CHANGED
@@ -18,7 +18,6 @@ class Refworks
|
|
18
18
|
include HTTParty
|
19
19
|
|
20
20
|
attr_reader :api_url, :access_key, :secret_key, :login_name, :password, :group_code, :id, :sess
|
21
|
-
attr_writer :sess
|
22
21
|
|
23
22
|
# Create a new Refworks client instance.
|
24
23
|
# @example
|
@@ -56,33 +55,29 @@ class Refworks
|
|
56
55
|
|
57
56
|
# probably should check here that I have the minimal set of required attributes to continue
|
58
57
|
|
59
|
-
# Can't do much without a session, so get one now
|
60
|
-
|
61
|
-
|
58
|
+
# Can't do much without a session, so get one now
|
59
|
+
# May need to refactor this - there are parts of the API that don't strictly need a session
|
60
|
+
if (@group_code)
|
61
|
+
response = request('authentication', 'newsess',
|
62
|
+
{
|
63
|
+
:login_name => @login_name,
|
64
|
+
:group_code => @group_code,
|
65
|
+
:password => @password,
|
66
|
+
}
|
67
|
+
)
|
62
68
|
else
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}
|
71
|
-
)
|
72
|
-
else
|
73
|
-
response = request('authentication', 'newsess',
|
74
|
-
{
|
75
|
-
:login_name => @login_name,
|
76
|
-
:id => @id,
|
77
|
-
:password => @password,
|
78
|
-
}
|
79
|
-
)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Grab the session string.
|
83
|
-
@sess = response.sess
|
69
|
+
response = request('authentication', 'newsess',
|
70
|
+
{
|
71
|
+
:login_name => @login_name,
|
72
|
+
:id => @id,
|
73
|
+
:password => @password,
|
74
|
+
}
|
75
|
+
)
|
84
76
|
end
|
85
77
|
|
78
|
+
# Grab the session string.
|
79
|
+
@sess = response.sess
|
80
|
+
|
86
81
|
# Need some error checking here
|
87
82
|
end
|
88
83
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refworks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fran Fabrizio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|