restful-sharepoint 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44cef9ce93eb602accca9fff9cc11e3ee4a5a304b4351c7638b7453d6e789cfc
4
- data.tar.gz: 950a9322055853209cb87413dd802d3128ec43eac8ab888060bd13940fea1f49
3
+ metadata.gz: c2e6bddfc8e8eb4afad9644e4fceb24043d312e04341485462de992153c49cdc
4
+ data.tar.gz: d476fd5cee073d7b86a966716898ffbd0dd510bca811997d9f93c8d46a45d53e
5
5
  SHA512:
6
- metadata.gz: 9094e55c0e4d386192d4afa5df01455f93613e54e85edbc71ccf5628110bb7e323a31134fdc4710d509c136b34763c84e30a8ad24b34cc9a97303db7a5ec8684
7
- data.tar.gz: 5468b96644de62e3338495790bc10ed7963fcd4c66a03886de54b9eaae1533651219f1456ffd746dbfc315f02e42657dcb9a0e87c90dec352529065f2353b65a
6
+ metadata.gz: d51978834840b49ea49236b599393d6199a1292ea04eb32e3931a9f69c9d8c645cb50e6776306f70ed3db08297989ce0bd2426ab018f8798422d2d9f81a5674e
7
+ data.tar.gz: b668f5b57dad92a36aad569443216783d061fb34750ecafe9afe7524b306e65bbf55d7116882a14e7ae9a4c982c1876334ac146ff54636e12a4b3b08c25f1fdf
@@ -9,6 +9,10 @@ module RestfulSharePoint
9
9
  @username = username
10
10
  @password = password
11
11
  @debug = debug
12
+
13
+ @httpclient = HTTPClient.new
14
+ @httpclient.set_auth(nil, @username, @password) if @username
15
+ @httpclient.ssl_config.set_default_paths
12
16
  end
13
17
 
14
18
  attr_reader :site_url
@@ -27,10 +31,7 @@ module RestfulSharePoint
27
31
  url = URI.parse(path).is_a?(URI::HTTP) ? path : "#{@site_url}#{path}"
28
32
  options_str = options.map { |k,v| "$#{k}=#{CGI.escape v.to_s}" }.join('&')
29
33
  url += "?#{options_str}"
30
-
31
- httpclient = HTTPClient.new
32
- httpclient.set_auth(nil, @username, @password) if @username
33
- httpclient.ssl_config.set_default_paths
34
+
34
35
  headers = {'accept' => 'application/json; odata=verbose'}
35
36
  if body
36
37
  body = JSON.dump(body).gsub('/', '\\/') # SharePoint requires forward slashes be escaped in JSON (WTF!!!)
@@ -40,7 +41,7 @@ module RestfulSharePoint
40
41
  end
41
42
 
42
43
  LOG.info "Making HTTP request to: #{url}"
43
- response = httpclient.request(method, url, nil, body, headers)
44
+ response = @httpclient.request(method, url, nil, body, headers)
44
45
 
45
46
  if response.body.empty?
46
47
  if response.code >= 300
@@ -1,3 +1,3 @@
1
1
  module RestfulSharePoint
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restful-sharepoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Wardrop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-21 00:00:00.000000000 Z
11
+ date: 2021-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient