Skip to content
This repository
  • 5 commits
  • 2 files changed
  • 0 comments
  • 3 contributors
7 lib/google/api_client/environment.rb
@@ -24,6 +24,13 @@ module ENV
24 24 `ver`.sub(/\s*\[Version\s*/, '/').sub(']', '').strip
25 25 elsif RUBY_PLATFORM =~ /darwin/i
26 26 "Mac OS X/#{`sw_vers -productVersion`}"
  27 + elsif RUBY_PLATFORM == 'java'
  28 + # Get the information from java system properties to avoid spawning a
  29 + # sub-process, which is not friendly in some contexts (web servers).
  30 + require 'java'
  31 + name = java.lang.System.getProperty('os.name')
  32 + version = java.lang.System.getProperty('os.version')
  33 + "#{name}/#{version}"
27 34 else
28 35 `uname -sr`.sub(' ', '/')
29 36 end
10 lib/google/api_client/reference.rb
@@ -66,17 +66,17 @@ def initialize(options={})
66 66 :request => { :boundary => MULTIPART_BOUNDARY }
67 67 }
68 68 multipart = Faraday::Request::Multipart.new
69   - self.body = multipart.create_multipart(env, {
70   - :metadata => Faraday::UploadIO.new(metadata, 'application/json'),
71   - :content => self.media})
  69 + self.body = multipart.create_multipart(env, [
  70 + [nil,Faraday::UploadIO.new(metadata, 'application/json', 'file.json')],
  71 + [nil, self.media]])
72 72 self.headers.update(env[:request_headers])
73 73 when "resumable"
74 74 file_length = self.media.length
75 75 self.headers['X-Upload-Content-Type'] = self.media.content_type
76   - self.headers['X-Upload-Content-Length'] = file_length.to_s
  76 + self.headers['X-Upload-Content-Length'] = file_length.to_s
77 77 if options[:body_object]
78 78 self.headers['Content-Type'] ||= 'application/json'
79   - self.body = serialize_body(options[:body_object])
  79 + self.body = serialize_body(options[:body_object])
80 80 else
81 81 self.body = ''
82 82 end

No commit comments for this range

Something went wrong with that request. Please try again.