Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4']
channel: [stable]

include:
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins:

AllCops:
NewCops: enable
TargetRubyVersion: 2.3
TargetRubyVersion: 3.0
Exclude:
- .git/**/*
- .github/**/*
Expand Down
16 changes: 8 additions & 8 deletions lib/sharepoint/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def create_folder(name, path, site_path = nil)

sanitized_name = sanitize_filename(name)
url = computed_web_api_url(site_path)
path = path[1..-1] if path[0].eql?('/')
path = path[1..] if path[0].eql?('/')
url = uri_escape "#{url}GetFolderByServerRelativeUrl('#{path}')/Folders"
easy = ethon_easy_json_requester
easy.headers = with_bearer_authentication_header({
Expand Down Expand Up @@ -388,7 +388,7 @@ def folder_exists?(path, site_path = nil)
def upload(filename, content, path, site_path = nil)
sanitized_filename = sanitize_filename(filename)
url = computed_web_api_url(site_path)
path = path[1..-1] if path[0].eql?('/')
path = path[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 = with_bearer_authentication_header({ 'accept' => 'application/json;odata=verbose',
Expand Down Expand Up @@ -443,7 +443,7 @@ def update_metadata(filename, metadata, path, site_path = nil)
# * `:server_responded_at` [Time] the time when server returned its response
# * `:results` [Array] of OpenStructs with all lists returned by the query
def lists(site_path = '', query = {})
url = "#{computed_web_api_url(site_path)}Lists".dup
url = "#{computed_web_api_url(site_path)}Lists"
url << "?#{build_query_params(query)}" if query.present?

ethon = ethon_easy_json_requester
Expand Down Expand Up @@ -599,7 +599,7 @@ def last_location_header(ethon)
last_redirect_idx = ethon.response_headers.rindex('HTTP/1.1 302')
return if last_redirect_idx.nil?

last_response_headers = ethon.response_headers[last_redirect_idx..-1]
last_response_headers = ethon.response_headers[last_redirect_idx..]
location = last_response_headers.match(/\r\n(Location:)(.+)\r\n/)[2].strip
utf8_encode uri_unescape(location)
end
Expand Down Expand Up @@ -630,7 +630,7 @@ def split_path(file_path)
last_slash_pos = file_path.rindex('/')
{
path: file_path[0..last_slash_pos - 1],
name: file_path[last_slash_pos + 1..-1]
name: file_path[last_slash_pos + 1..]
}
end

Expand Down Expand Up @@ -659,13 +659,13 @@ def validate_ntlm_config
end

def valid_config_options(options = [])
options.map do |opt|
options.filter_map do |opt|
c = config.send(opt)

next if c.present? && string_not_blank?(c)

opt
end.compact
end
end

def validate_config!
Expand Down Expand Up @@ -850,7 +850,7 @@ def parse_lists_in_site_response(response_body)
results = json_response.dig('d', 'results')

results.map do |result|
OpenStruct.new(result.map { |k, v| [k.underscore.to_sym, v] }.to_h)
OpenStruct.new(result.transform_keys { |k| k.underscore.to_sym })
end
end

Expand Down
9 changes: 1 addition & 8 deletions lib/sharepoint/version.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# frozen_string_literal: true

module Sharepoint
module Version
MAJOR = 1
MINOR = 0
PATCH = 0
BUILD = nil

VERSION = [MAJOR, MINOR, PATCH, BUILD].compact.join('.').freeze
end
VERSION = '2.0.0'
end
7 changes: 4 additions & 3 deletions sharepoint.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'sharepoint/version'

Gem::Specification.new do |gem|
gem.name = 'sharepoint'
gem.version = Sharepoint::Version::VERSION
gem.version = Sharepoint::VERSION
gem.authors = ['Antonio Delfin']
gem.email = ['a.delfin@ifad.org']
gem.description = 'Ruby client to consume Sharepoint services'
Expand All @@ -15,10 +15,11 @@ Gem::Specification.new do |gem|
gem.files = Dir.glob('{LICENSE,README.md,lib/**/*.rb}', File::FNM_DOTMATCH)
gem.require_paths = ['lib']

gem.required_ruby_version = '>= 2.3'
gem.required_ruby_version = '>= 3.0'

gem.add_dependency 'activesupport', '>= 4.0'
gem.add_dependency 'activesupport', '>= 7.0'
gem.add_dependency 'ethon'
gem.add_dependency 'ostruct'

gem.metadata['rubygems_mfa_required'] = 'true'
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def fixture(name)

# Requires supporting ruby files with custom matchers and macros, etc,
# # in spec/support/ and its subdirectories.
Dir[SPEC_BASE.join('support/**/*.rb')].sort.each { |f| require f }
Dir[SPEC_BASE.join('support/**/*.rb')].each { |f| require f }

# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
Expand Down