diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 287f260..afe8568 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,22 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: special_inside_parentheses, consistent, align_braces -Layout/FirstHashElementIndentation: - Exclude: - - 'lib/sharepoint/client.rb' - -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. -# SupportedHashRocketStyles: key, separator, table -# SupportedColonStyles: key, separator, table -# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit -Layout/HashAlignment: - Exclude: - - 'lib/sharepoint/client.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: aligned, indented, indented_relative_to_receiver @@ -52,7 +36,7 @@ Metrics/AbcSize: # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 513 + Max: 521 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: diff --git a/lib/sharepoint/client.rb b/lib/sharepoint/client.rb index 63fc751..7d59887 100644 --- a/lib/sharepoint/client.rb +++ b/lib/sharepoint/client.rb @@ -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}" @@ -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) @@ -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 }) @@ -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,