Bump representable dependency to 3.0 (#532)

Also fixes a breaking change introduced between `representable` 2.3 and
3.0. Specifically, `:skip_undefined` is now be passed via the
`:user_options` option.
This commit is contained in:
Sai Cheemalapati authored and GitHub committed 2017-02-13 12:24:14 -08:00
1 parent 2ea7f12106
commit 4f143ae551
5 files changed
+13 -10

No files matched your search

+1 -1
View File
@@ -55,7 +55,7 @@ module Google
query[FIELDS_PARAM] = normalize_fields_param(query[FIELDS_PARAM]) if query.key?(FIELDS_PARAM)
if request_representation && request_object
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
super
end
+2 -2
View File
@@ -55,7 +55,7 @@ module Google
def if_fn(name)
ivar_name = "@#{name}".to_sym
lambda do |opts|
if opts[:skip_undefined]
if opts[:options][:user_options] and opts[:options][:user_options][:skip_undefined]
if respond_to?(:key?)
self.key?(name) || instance_variable_defined?(ivar_name)
else
@@ -137,7 +137,7 @@ module Google
def to_json
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