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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTQ0MGNjZmEyNDI0MzAzNmE5NDg5YjIxNzQzZDI5MGNlOWM1YTQ3Ng==
4
+ YzU5NzhjZDUyNzFkMmQ4ZDFkNGYyNTM1N2IwNjM3MzEzMjE3OTExNg==
5
5
  data.tar.gz: !binary |-
6
- NDI0YTljYzU3YTYzYzViY2IwNzk2MGNmODcwZTMyZTYzMzE0M2Y1Nw==
6
+ ZGQyODU2NWVjOTlmM2Y2N2UxYTViZTA1MzY5ZGE0NzIyMjgxZDg0Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjNjYTUwYWQ4YjQyMWJiMmI4NGM0ZDM0M2Q5ZmQ2YmMzYWNhNjc2Y2IzNTlk
10
- NTI3YjRmM2U0ZDNmYzdiYjVjYTRlMzllNzg1MWIyYzNlZDcxODU1ODE1ODk4
11
- OTk3YWJhZTFmMmZmYTVhMDU2NTNhMDE2OTBkOTE4ODYwNjliOGE=
9
+ NzcxNDE0ZDM3YTk5YWI5ZWM4YTdiNzA1NTVmYzczNWUyNjQxODgyNjY3MGM3
10
+ N2ZhNWQyODhlMThjNGNiNjA5MGI0Y2FkYjdjMmYyZDc5YTBlYWIxN2IzNjNj
11
+ ZWQ2MGFmZWVmNDg3ZDM2NjIyNjRkNjI0MGVjODJkMTBiYTNiNTA=
12
12
  data.tar.gz: !binary |-
13
- MDcyMmEzMDYxZDRmYjI2NzU3MWYwYTcwOWYyODBhYzg4ZGRhMTMwZGZiMTNh
14
- ZmYzODY3M2IyNjIyYmVjMGI3M2UwZDNhM2NiNDJmNWE0NTA3N2ZkZDhkZTI2
15
- NjI4MmIzYTM4ZDIyM2E2MzgxMDRiOWYyYTQ0NjY3ZTE4MzM0MWM=
13
+ YWVlMDk5NWU0ZDJlOTVkYWY0OGU5MWYwNDllZjQzMmIzOTZmODMwMGFjZGQ1
14
+ MzUyZmU1NDRlOWViYjMzNzUzMWFkNzljODg0ZWM2ZWYyZDlmYmI4MTYxMmE0
15
+ MjJjOWU0NzcyYThkNWMyNmIyN2Q1Y2ZlYWUyYWVhOGI5ZWI3MzQ=
@@ -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"]
@@ -1,3 +1,3 @@
1
1
  class Refworks
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
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 if one wasn't passed in
60
- if params[:sess]
61
- @sess = params[:sess]
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
- # May need to refactor this - there are parts of the API that don't strictly need a session
64
- if (@group_code)
65
- response = request('authentication', 'newsess',
66
- {
67
- :login_name => @login_name,
68
- :group_code => @group_code,
69
- :password => @password,
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.6
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-19 00:00:00.000000000 Z
11
+ date: 2014-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty