Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20862 update deps #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 9 additions & 8 deletions google-api-client.gemspec → arvados-google-api-client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.authors = ["Bob Aman", "Steven Bazyl"]
s.license = "Apache-2.0"
s.description = "The Google API Ruby Client makes it trivial to discover and access supported APIs."
s.email = "sbazyl@google.com"
s.description = "Fork of google-api-client used by Ruby-based Arvados components."
s.email = "dev@arvados.org"
s.extra_rdoc_files = ["README.md"]
s.files = %w(google-api-client.gemspec Rakefile LICENSE CHANGELOG.md README.md Gemfile)
s.files = %w(arvados-google-api-client.gemspec Rakefile LICENSE CHANGELOG.md README.md Gemfile)
s.files += Dir.glob("lib/**/*.rb")
s.files += Dir.glob("lib/cacerts.pem")
s.files += Dir.glob("spec/**/*.{rb,opts}")
Expand All @@ -21,18 +21,19 @@ Gem::Specification.new do |s|
s.files += Dir.glob("website/**/*")
s.homepage = "https://github.com/arvados/google-api-ruby-client/"
s.rdoc_options = ["--main", "README.md"]
s.summary = "The Google API Ruby Client makes it trivial to discover and access Google's REST APIs."
s.summary = "Fork of google-api-client used by Ruby-based Arvados components."

s.add_runtime_dependency 'addressable', '~> 2.3'
s.add_runtime_dependency 'signet', '~> 0.6'
s.add_runtime_dependency 'faraday', '~> 0.9'
s.add_runtime_dependency 'googleauth', '~> 0.3'
s.add_runtime_dependency 'signet', '~> 1.0'
s.add_runtime_dependency 'faraday', '~> 2.0'
s.add_runtime_dependency 'faraday-multipart', '~> 1.0'
s.add_runtime_dependency 'googleauth', '~> 1.0'
s.add_runtime_dependency 'multi_json', '~> 1.10'
s.add_runtime_dependency 'autoparse', '~> 0.3'
s.add_runtime_dependency 'extlib', '~> 0.9'
s.add_runtime_dependency 'launchy', '~> 2.4'
s.add_runtime_dependency 'retriable', '~> 1.4'
s.add_runtime_dependency 'activesupport', '>= 3.2', '< 5.3'
s.add_runtime_dependency 'activesupport', '>= 3.2', '< 8.0'

s.add_development_dependency 'rake', '~> 10.0'
s.add_development_dependency 'yard', '~> 0.8'
Expand Down
5 changes: 3 additions & 2 deletions lib/google/api_client/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
require 'google/api_client/reference'
require 'faraday/multipart'

module Google
class APIClient
Expand All @@ -21,7 +22,7 @@ class APIClient
# @see Faraday::UploadIO
# @example
# media = Google::APIClient::UploadIO.new('mymovie.m4v', 'video/mp4')
class UploadIO < Faraday::UploadIO
class UploadIO < Faraday::Multipart::FilePart

# @return [Fixnum] Size of chunks to upload. Default is nil, meaning upload the entire file in a single request
attr_accessor :chunk_size
Expand Down Expand Up @@ -256,4 +257,4 @@ def to_hash

end
end
end
end
36 changes: 2 additions & 34 deletions lib/google/api_client/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

require 'faraday'
require 'faraday/request/multipart'
require 'compat/multi_json'
require 'addressable/uri'
require 'stringio'
Expand Down Expand Up @@ -279,32 +278,7 @@ def process_http_response(response)
# @option options [#read, #to_str] :body
# Raw body to send in POST/PUT requests
def initialize_media_upload(options)
self.media = options[:media]
case self.upload_type
when "media"
if options[:body] || options[:body_object]
raise ArgumentError, "Can not specify body & body object for simple uploads"
end
self.headers['Content-Type'] ||= self.media.content_type
self.headers['Content-Length'] ||= self.media.length.to_s
self.body = self.media
when "multipart"
unless options[:body_object]
raise ArgumentError, "Multipart requested but no body object"
end
metadata = StringIO.new(serialize_body(options[:body_object]))
build_multipart([Faraday::UploadIO.new(metadata, 'application/json', 'file.json'), self.media])
when "resumable"
file_length = self.media.length
self.headers['X-Upload-Content-Type'] = self.media.content_type
self.headers['X-Upload-Content-Length'] = file_length.to_s
if options[:body_object]
self.headers['Content-Type'] ||= 'application/json'
self.body = serialize_body(options[:body_object])
else
self.body = ''
end
end
raise "not supported"
end

##
Expand All @@ -319,13 +293,7 @@ def initialize_media_upload(options)
# @param [String] boundary
# Boundary for separating each part of the message
def build_multipart(parts, mime_type = 'multipart/related', boundary = MULTIPART_BOUNDARY)
env = Faraday::Env.new
env.request = Faraday::RequestOptions.new
env.request.boundary = boundary
env.request_headers = {'Content-Type' => "#{mime_type};boundary=#{boundary}"}
multipart = Faraday::Request::Multipart.new
self.body = multipart.create_multipart(env, parts.map {|part| [nil, part]})
self.headers.update(env[:request_headers])
raise "not supported"
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/google/api_client/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module VERSION
MAJOR = 0
MINOR = 8
TINY = 7
PATCH = 4
PATCH = 5
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
end
end
Expand Down