Updated to avoid deprecation of encode and decode methods in multi_json gem.

This commit is contained in:
Bob Aman committed 2012-04-24 14:39:25 +03:00
1 parent 96b697bd5f
commit c651d69674
6 files changed
+10 -10

No files matched your search

+2 -2
View File
@@ -39,7 +39,7 @@ module Google
search_path = File.expand_path(File.join(search_path, '..'))
end
end
data = File.open(filename, 'r') { |file| MultiJson.decode(file.read) }
data = File.open(filename, 'r') { |file| MultiJson.load(file.read) }
return self.new(data)
end
@@ -77,7 +77,7 @@ module Google
)
def to_json
return MultiJson.encode({
return MultiJson.dump({
self.flow => ({
'client_id' => self.client_id,
'client_secret' => self.client_secret,
+1 -1
View File
@@ -103,7 +103,7 @@ module Google
def serialize_body(body)
return body.to_json if body.respond_to?(:to_json)
return MultiJson.encode(options[:body_object].to_hash) if body.respond_to?(:to_hash)
return MultiJson.dump(options[:body_object].to_hash) if body.respond_to?(:to_hash)
raise TypeError, 'Could not convert body object to JSON.' +
'Must respond to :to_json or :to_hash.'
end
+1 -1
View File
@@ -63,7 +63,7 @@ module Google
data = self.body
case media_type
when 'application/json'
data = MultiJson.decode(data)
data = MultiJson.load(data)
# Strip data wrapper, if present
data = data['data'] if data.has_key?('data')
else