collectiveaccess 0.2.1 → 0.2.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/collectiveaccess.gemspec +3 -3
- data/lib/collectiveaccess.rb +34 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d00ccf45255fc0a19c4a7043b92a8e763176bf23
|
4
|
+
data.tar.gz: 3cd38501963b88a784a19bd391465c5651481689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: accc3a54849e185553cec9e58a534078140f88f33bbdb5cc6cadeae819e8c8de2e9e869f4188d625642dfa6aa04beaa4abb477e51b9349f5beef33b0b86de566
|
7
|
+
data.tar.gz: 8aa9868368e1f745584abb700948d3a507417154d2acf3f611afe0e2b347f6a382bf2ba10733a170a62cd9b398ee010784ded39f32441d1374d49379d5569483
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/collectiveaccess.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: collectiveaccess 0.2.
|
5
|
+
# stub: collectiveaccess 0.2.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "collectiveaccess"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["CollectiveAccess", "Stefan"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-09-01"
|
15
15
|
s.description = "This gem is a simple plain Ruby wrapper for the CollectiveAccess Web Service API. For more info see https://github.com/CollectiveAccessProject/collectiveaccess"
|
16
16
|
s.email = "info@collectiveaccess.org"
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/collectiveaccess.rb
CHANGED
@@ -20,7 +20,8 @@ class CollectiveAccess
|
|
20
20
|
endpoint: 'item',
|
21
21
|
request_body: {},
|
22
22
|
get_params: {},
|
23
|
-
url_string: ''
|
23
|
+
url_string: '',
|
24
|
+
verify: false
|
24
25
|
}
|
25
26
|
|
26
27
|
|
@@ -95,21 +96,35 @@ class CollectiveAccess
|
|
95
96
|
end
|
96
97
|
|
97
98
|
def self.build_uri(opts)
|
99
|
+
|
100
|
+
uri_opts = { :host => opts[:hostname],
|
101
|
+
:path => opts[:url_root]+opts[:script_name]+'/'+opts[:endpoint]+'/'+opts[:table_name]+'/'+opts[:url_string],
|
102
|
+
:query => URI.encode_www_form(opts[:get_params].merge(authToken: stored_auth_token)) }
|
103
|
+
|
98
104
|
# URI available params: scheme, userinfo, host, port, registry, path, opaque, query and fragment
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
105
|
+
if opts[:protocol] == 'http'
|
106
|
+
url = URI::HTTP.build uri_opts
|
107
|
+
else
|
108
|
+
url = URI::HTTPS.build uri_opts
|
109
|
+
end
|
110
|
+
|
103
111
|
url.path.gsub! %r{/+}, '/'
|
112
|
+
|
104
113
|
url
|
105
114
|
end
|
106
115
|
|
107
116
|
def self.build_simple_uri(opts)
|
108
117
|
# URI available params: scheme, userinfo, host, port, registry, path, opaque, query and fragment
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
118
|
+
uri_opts = { :host => opts[:hostname],
|
119
|
+
:path => opts[:url_root]+opts[:script_name]+'/simple/'+opts[:endpoint],
|
120
|
+
:query => URI.encode_www_form(opts[:get_params].merge(authToken: stored_auth_token)) }
|
121
|
+
|
122
|
+
if opts[:protocol] == 'http'
|
123
|
+
url = URI::HTTP.build uri_opts
|
124
|
+
else
|
125
|
+
url = URI::HTTPS.build uri_opts
|
126
|
+
end
|
127
|
+
|
113
128
|
url.path.gsub! %r{/+}, '/'
|
114
129
|
url
|
115
130
|
end
|
@@ -121,10 +136,16 @@ class CollectiveAccess
|
|
121
136
|
# authenticate with CA Web Service API and store auth token in a temporary file
|
122
137
|
def self.authenticate(request_opts = {})
|
123
138
|
opts = parse_options request_opts
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
139
|
+
uri_opts = { :host => opts[:hostname],
|
140
|
+
:path => opts[:url_root] + '/service.php/auth/login',
|
141
|
+
:query => URI.encode_www_form(opts[:get_params]) }
|
142
|
+
|
143
|
+
if opts[:protocol] == 'http'
|
144
|
+
auth_url = URI::HTTP.build uri_opts
|
145
|
+
else
|
146
|
+
auth_url = URI::HTTPS.build uri_opts
|
147
|
+
end
|
148
|
+
|
128
149
|
auth_url.path.gsub! %r{/+}, '/'
|
129
150
|
|
130
151
|
resp = HTTParty.get auth_url, basic_auth: @auth
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: collectiveaccess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CollectiveAccess
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|