sharepoint-ruby 0.0.2 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ae2fa825b6ae80d590550ff62b460e1dadcf48eb
4
- data.tar.gz: 929e567c7977f3da76dfb0111578b422f195f5a1
2
+ SHA256:
3
+ metadata.gz: 9066e1d5499871de09ed46063dd308a81980f9e108bcdcb833092e05c4aa3f98
4
+ data.tar.gz: fda3bfa38a5730aa6328370f0a46e7aced79271851eb9eb02765f17e939b19db
5
5
  SHA512:
6
- metadata.gz: 738befa9bedaf7032b6d3e7f00bc01fcd3145d16d4e44c35f18f38b86ab15267405b14ac1bd7f19573a481a66ec96ca21b1b62266c81ea47355422af6a5da343
7
- data.tar.gz: f869e68e7d377126d05651a06022d23c02660cfd132d192306472f65e6fa21c63050e1993250018daa8a75f5a180e5c302820778b51cc8c61ff5ca9b94ced807
6
+ metadata.gz: '0091b8b591e50ef402cb9f06b3922a50126e4c2e2818df1c3f318ab06aeedadbb07cd7f3d436ae2cbc6265f4965fa4e05f6a589d9389f68af43a513e4faacf38'
7
+ data.tar.gz: 6b0cc5c1f06c2296168a3eb967c5b856dbfbc73202872df3b54c6102a021dc7cb6c245368725d786a409587406510119fecd661e8f86825808e90e48a07ccf02
@@ -0,0 +1,30 @@
1
+ require 'curb'
2
+ require 'cgi'
3
+
4
+ module Sharepoint
5
+ module KerberosAuth
6
+ class Session
7
+ attr_accessor :site
8
+ attr_reader :user, :password
9
+
10
+ def initialize site
11
+ @site = site
12
+ end
13
+
14
+ def authenticate user, password
15
+ @user = user
16
+ @password = password
17
+ end
18
+
19
+ def cookie
20
+ String.new
21
+ end
22
+
23
+ def curl curb
24
+ curb.http_auth_types = :gssnegotiate
25
+ curb.username = @user
26
+ curb.password = @password
27
+ end
28
+ end
29
+ end
30
+ end
@@ -97,7 +97,7 @@ module Sharepoint
97
97
 
98
98
  def add_folder path, attributes
99
99
  path = path.gsub(/\/*$/, '') # remove slashes at the end of the path
100
- site_url = "#{@site.protocole}://#{@site.server_url}/"
100
+ site_url = "#{@site.protocol}://#{@site.server_url}/"
101
101
  action = "#{site_url}_vti_bin/listdata.svc/#{self.title}"
102
102
  path = root_folder.server_relative_url + '/' + path
103
103
  attributes['ContentTypeID'] ||= '0x01200059042D1A09191046851FA83D5B89816A'
@@ -21,7 +21,7 @@ module Sharepoint
21
21
 
22
22
  class Site
23
23
  attr_reader :server_url
24
- attr_accessor :url, :protocole
24
+ attr_accessor :url, :protocol
25
25
  attr_accessor :session
26
26
  attr_accessor :name
27
27
  attr_accessor :verbose
@@ -32,16 +32,16 @@ module Sharepoint
32
32
  @url = "#{@server_url}/#{@name}"
33
33
  @session = Session.new self
34
34
  @web_context = nil
35
- @protocole = 'https'
35
+ @protocol = 'https'
36
36
  @verbose = false
37
37
  end
38
38
 
39
39
  def authentication_path
40
- "#{@protocole}://#{@server_url}/_forms/default.aspx?wa=wsignin1.0"
40
+ "#{@protocol}://#{@server_url}/_forms/default.aspx?wa=wsignin1.0"
41
41
  end
42
42
 
43
43
  def api_path uri
44
- "#{@protocole}://#{@url}/_api/web/#{uri}"
44
+ "#{@protocol}://#{@url}/_api/web/#{uri}"
45
45
  end
46
46
 
47
47
  def filter_path uri
@@ -58,7 +58,7 @@ module Sharepoint
58
58
  def form_digest
59
59
  if @web_context.nil? or (not @web_context.is_up_to_date?)
60
60
  @getting_form_digest = true
61
- @web_context = query :post, "#{@protocole}://#{@server_url}/_api/contextinfo"
61
+ @web_context = query :post, "#{@protocol}://#{@url}/_api/contextinfo"
62
62
  @getting_form_digest = false
63
63
  end
64
64
  @web_context.form_digest_value
@@ -74,12 +74,12 @@ module Sharepoint
74
74
  if method != :get
75
75
  curl.headers["Content-Type"] = curl.headers["Accept"]
76
76
  curl.headers["X-RequestDigest"] = form_digest unless @getting_form_digest == true
77
+ curl.headers["Authorization"] = "Bearer " + form_digest unless @getting_form_digest == true
77
78
  end
78
79
  curl.verbose = @verbose
79
80
  @session.send :curl, curl unless not @session.methods.include? :curl
80
81
  block.call curl unless block.nil?
81
82
  end
82
-
83
83
  unless skip_json || (result.body_str.nil? || result.body_str.empty?)
84
84
  begin
85
85
  data = JSON.parse result.body_str
@@ -114,6 +114,8 @@ module Sharepoint
114
114
  # and return the corresponding Sharepoint::Object.
115
115
  def make_object_from_data data
116
116
  type_name = data['__metadata']['type'].gsub(/^SP\./, '')
117
+ .gsub(/^Collection\(Edm\.String\)/, 'CollectionString')
118
+ .gsub(/^Collection\(Edm\.Int32\)/, 'CollectionInteger')
117
119
  type_parts = type_name.split '.'
118
120
  type_name = type_parts.pop
119
121
  constant = Sharepoint
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharepoint-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Martin Moro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2020-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.8'
20
20
  - - "<="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.8.6
22
+ version: 0.9.10
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '0.8'
30
30
  - - "<="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.8.6
32
+ version: 0.9.10
33
33
  description: Client for Sharepoint's REST API
34
34
  email: michael@unetresgrossebite.com
35
35
  executables: []
@@ -39,6 +39,7 @@ files:
39
39
  - lib/sharepoint-fields.rb
40
40
  - lib/sharepoint-files.rb
41
41
  - lib/sharepoint-http-auth.rb
42
+ - lib/sharepoint-kerberos-auth.rb
42
43
  - lib/sharepoint-lists.rb
43
44
  - lib/sharepoint-object.rb
44
45
  - lib/sharepoint-properties.rb
@@ -68,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
69
  version: '0'
69
70
  requirements: []
70
71
  rubyforge_project:
71
- rubygems_version: 2.5.1
72
+ rubygems_version: 2.7.9
72
73
  signing_key:
73
74
  specification_version: 4
74
75
  summary: sharepoint client