Skip to content

Commit

Permalink
Merge pull request #38 from ifad/chore/improve-indendation
Browse files Browse the repository at this point in the history
Improve hash indentation
  • Loading branch information
tagliala authored Apr 21, 2024
2 parents e8d88c0 + 589fa54 commit d6c2883
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 33 deletions.
18 changes: 1 addition & 17 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 24 additions & 16 deletions lib/sharepoint/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,13 @@ def create_folder(name, path, site_path = nil)
path = path[1..-1] if path[0].eql?('/')
url = uri_escape "#{url}GetFolderByServerRelativeUrl('#{path}')/Folders"
easy = ethon_easy_json_requester
easy.headers = { 'accept' => 'application/json;odata=verbose',
'content-type' => 'application/json;odata=verbose',
'X-RequestDigest' => xrequest_digest(site_path) }
easy.headers = {
'accept' => 'application/json;odata=verbose',
'content-type' => 'application/json;odata=verbose',
'X-RequestDigest' => xrequest_digest(site_path)
}
payload = {
'__metadata' => {
'__metadata' => {
'type' => 'SP.Folder'
},
'ServerRelativeUrl' => "#{path}/#{sanitized_name}"
Expand Down Expand Up @@ -349,8 +351,10 @@ def upload(filename, content, path, site_path = nil)
path = path[1..-1] if path[0].eql?('/')
url = uri_escape "#{url}GetFolderByServerRelativeUrl('#{path}')/Files/Add(url='#{sanitized_filename}',overwrite=true)"
easy = ethon_easy_json_requester
easy.headers = { 'accept' => 'application/json;odata=verbose',
'X-RequestDigest' => xrequest_digest(site_path) }
easy.headers = {
'accept' => 'application/json;odata=verbose',
'X-RequestDigest' => xrequest_digest(site_path)
}
easy.http_request(url, :post, { body: content })
easy.perform
check_and_raise_failure(easy)
Expand Down Expand Up @@ -378,11 +382,13 @@ def update_metadata(filename, metadata, path, site_path = nil)
prepared_metadata = prepare_metadata(metadata, __metadata['type'])

easy = ethon_easy_json_requester
easy.headers = { 'accept' => 'application/json;odata=verbose',
'content-type' => 'application/json;odata=verbose',
'X-RequestDigest' => xrequest_digest(site_path),
'X-Http-Method' => 'PATCH',
'If-Match' => '*' }
easy.headers = {
'accept' => 'application/json;odata=verbose',
'content-type' => 'application/json;odata=verbose',
'X-RequestDigest' => xrequest_digest(site_path),
'X-Http-Method' => 'PATCH',
'If-Match' => '*'
}
easy.http_request(update_metadata_url,
:post,
{ body: prepared_metadata })
Expand Down Expand Up @@ -750,11 +756,13 @@ def update_object_metadata(metadata, new_metadata, site_path = '')
prepared_metadata = prepare_metadata(new_metadata, metadata['type'])

easy = ethon_easy_json_requester
easy.headers = { 'accept' => 'application/json;odata=verbose',
'content-type' => 'application/json;odata=verbose',
'X-RequestDigest' => xrequest_digest(site_path),
'X-Http-Method' => 'PATCH',
'If-Match' => '*' }
easy.headers = {
'accept' => 'application/json;odata=verbose',
'content-type' => 'application/json;odata=verbose',
'X-RequestDigest' => xrequest_digest(site_path),
'X-Http-Method' => 'PATCH',
'If-Match' => '*'
}

easy.http_request(update_metadata_url,
:post,
Expand Down

0 comments on commit d6c2883

Please sign in to comment.