Update representable, mimetype dependencies + others
This commit is contained in:
parent
e6acda7118
commit
2c190e9745
4
Gemfile
4
Gemfile
|
@ -10,8 +10,8 @@ group :development do
|
||||||
gem 'rspec', '~> 3.1'
|
gem 'rspec', '~> 3.1'
|
||||||
gem 'json_spec', '~> 1.1'
|
gem 'json_spec', '~> 1.1'
|
||||||
gem 'webmock', '~> 1.21'
|
gem 'webmock', '~> 1.21'
|
||||||
gem 'simplecov', '~> 0.9'
|
gem 'simplecov', '~> 0.12'
|
||||||
gem 'coveralls', '~> 0.7.11'
|
gem 'coveralls', '~> 0.8'
|
||||||
gem 'rubocop', '~> 0.29'
|
gem 'rubocop', '~> 0.29'
|
||||||
gem 'launchy', '~> 2.4'
|
gem 'launchy', '~> 2.4'
|
||||||
gem 'dotenv', '~> 2.0'
|
gem 'dotenv', '~> 2.0'
|
||||||
|
|
|
@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
|
||||||
|
|
||||||
spec.required_ruby_version = '~> 2.0'
|
spec.required_ruby_version = '~> 2.0'
|
||||||
|
|
||||||
spec.add_runtime_dependency 'representable', '~> 2.3.0'
|
spec.add_runtime_dependency 'representable', '~> 3.0'
|
||||||
spec.add_runtime_dependency 'retriable', '~> 2.0'
|
spec.add_runtime_dependency 'retriable', '~> 2.0'
|
||||||
spec.add_runtime_dependency 'addressable', '~> 2.3'
|
spec.add_runtime_dependency 'addressable', '~> 2.3'
|
||||||
spec.add_runtime_dependency 'mime-types', '>= 1.6'
|
spec.add_runtime_dependency 'mime-types', '>= 3.0'
|
||||||
spec.add_runtime_dependency 'googleauth', '~> 0.5'
|
spec.add_runtime_dependency 'googleauth', '~> 0.5'
|
||||||
spec.add_runtime_dependency 'httpclient', '>= 2.8.1', '< 3.0'
|
spec.add_runtime_dependency 'httpclient', '>= 2.8.1', '< 3.0'
|
||||||
spec.add_runtime_dependency 'memoist', '~> 0.11'
|
spec.add_runtime_dependency 'memoist', '~> 0.11'
|
||||||
|
|
|
@ -51,7 +51,7 @@ module Google
|
||||||
query[FIELDS_PARAM] = normalize_fields_param(query[FIELDS_PARAM]) if query.key?(FIELDS_PARAM)
|
query[FIELDS_PARAM] = normalize_fields_param(query[FIELDS_PARAM]) if query.key?(FIELDS_PARAM)
|
||||||
if request_representation && request_object
|
if request_representation && request_object
|
||||||
header['Content-Type'] ||= JSON_CONTENT_TYPE
|
header['Content-Type'] ||= JSON_CONTENT_TYPE
|
||||||
self.body = request_representation.new(request_object).to_json(skip_undefined: true)
|
self.body = request_representation.new(request_object).to_json(user_options: { skip_undefined: true })
|
||||||
end
|
end
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,7 +55,7 @@ module Google
|
||||||
def if_fn(name)
|
def if_fn(name)
|
||||||
ivar_name = "@#{name}".to_sym
|
ivar_name = "@#{name}".to_sym
|
||||||
lambda do |opts|
|
lambda do |opts|
|
||||||
if opts[:skip_undefined]
|
if opts[:user_options] && opts[:user_options][:skip_undefined]
|
||||||
if respond_to?(:key?)
|
if respond_to?(:key?)
|
||||||
self.key?(name) || instance_variable_defined?(ivar_name)
|
self.key?(name) || instance_variable_defined?(ivar_name)
|
||||||
else
|
else
|
||||||
|
@ -137,7 +137,7 @@ module Google
|
||||||
|
|
||||||
def to_json
|
def to_json
|
||||||
representation = self.class.const_get(:Representation)
|
representation = self.class.const_get(:Representation)
|
||||||
representation.new(self).to_json(skip_undefined: true)
|
representation.new(self).to_json(user_options: { skip_undefined: true })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,13 +18,7 @@ require 'google/apis/core/api_command'
|
||||||
require 'google/apis/errors'
|
require 'google/apis/errors'
|
||||||
require 'addressable/uri'
|
require 'addressable/uri'
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
begin
|
require 'mime-types'
|
||||||
require 'mime/types/columnar'
|
|
||||||
rescue LoadError
|
|
||||||
# Temporary until next major bump when we can tighten
|
|
||||||
# dependency to mime-types >-=3.0
|
|
||||||
require 'mime-types'
|
|
||||||
end
|
|
||||||
|
|
||||||
module Google
|
module Google
|
||||||
module Apis
|
module Apis
|
||||||
|
@ -59,6 +53,10 @@ module Google
|
||||||
@close_io_on_finish = false
|
@close_io_on_finish = false
|
||||||
elsif upload_source.is_a?(String)
|
elsif upload_source.is_a?(String)
|
||||||
self.upload_io = File.new(upload_source, 'r')
|
self.upload_io = File.new(upload_source, 'r')
|
||||||
|
if upload_content_type.nil?
|
||||||
|
type = MIME::Types.of(upload_source)
|
||||||
|
upload_content_type = type.first.content_type unless type.nil? || type.empty?
|
||||||
|
end
|
||||||
@close_io_on_finish = true
|
@close_io_on_finish = true
|
||||||
else
|
else
|
||||||
fail Google::Apis::ClientError, 'Invalid upload source'
|
fail Google::Apis::ClientError, 'Invalid upload source'
|
||||||
|
|
|
@ -109,7 +109,7 @@ RSpec.describe Google::Apis::Core::JsonRepresentation do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with model object' do
|
context 'with model object' do
|
||||||
let(:json) { representer_class.new(model).to_json(skip_undefined: true) }
|
let(:json) { representer_class.new(model).to_json(user_options: { skip_undefined: true }) }
|
||||||
let(:model) do
|
let(:model) do
|
||||||
model = model_class.new
|
model = model_class.new
|
||||||
model.nil_value = nil
|
model.nil_value = nil
|
||||||
|
@ -132,7 +132,7 @@ RSpec.describe Google::Apis::Core::JsonRepresentation do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with hash' do
|
context 'with hash' do
|
||||||
let(:json) { representer_class.new(model).to_json(skip_undefined: true) }
|
let(:json) { representer_class.new(model).to_json(user_options: { skip_undefined: true }) }
|
||||||
let(:model) do
|
let(:model) do
|
||||||
{
|
{
|
||||||
nil_value: nil,
|
nil_value: nil,
|
||||||
|
|
|
@ -80,9 +80,8 @@ RSpec.describe Google::Apis::Error do
|
||||||
|
|
||||||
context '@cause is falsy' do
|
context '@cause is falsy' do
|
||||||
before do
|
before do
|
||||||
subject.class.superclass.any_instance.stub(:backtrace) do
|
expect_any_instance_of(subject.class.superclass).to receive(:backtrace).and_return(
|
||||||
"super class's #backtrace called"
|
"super class's #backtrace called")
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "calls super class's #backtrace" do
|
it "calls super class's #backtrace" do
|
||||||
|
|
Loading…
Reference in New Issue