Migrated to MultiJson from JSON gem.
This commit is contained in:
1 parent
04ec835ca1
commit
0bc3d4936b
9 files changed
+16
-16
No files matched your search
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
require 'time'
|
||||
require 'json'
|
||||
require 'multi_json'
|
||||
require 'base64'
|
||||
require 'autoparse'
|
||||
require 'addressable/uri'
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
require 'json'
|
||||
require 'multi_json'
|
||||
|
||||
|
||||
module Google
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
require 'json'
|
||||
require 'multi_json'
|
||||
require 'google/api_client/parser'
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ module Google
|
||||
end
|
||||
|
||||
def initialize(data)
|
||||
@data = data.kind_of?(Hash) ? data : ::JSON.parse(data)
|
||||
@data = data.kind_of?(Hash) ? data : MultiJson.decode(data)
|
||||
end
|
||||
|
||||
def [](key)
|
||||
@@ -107,7 +107,7 @@ module Google
|
||||
end
|
||||
|
||||
def self.parse(json)
|
||||
data = json.kind_of?(Hash) ? json : ::JSON.parse(json)
|
||||
data = json.kind_of?(Hash) ? json : MultiJson.decode(json)
|
||||
parser = self.match(data)
|
||||
if parser
|
||||
return parser.new(data)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
require 'stringio'
|
||||
require 'json'
|
||||
require 'multi_json'
|
||||
require 'addressable/uri'
|
||||
require 'google/api_client/discovery'
|
||||
|
||||
@@ -44,7 +44,7 @@ module Google
|
||||
if options[:body_object].respond_to?(:to_json)
|
||||
serialized_body = options[:body_object].to_json
|
||||
elsif options[:body_object].respond_to?(:to_hash)
|
||||
serialized_body = JSON.generate(options[:body_object].to_hash)
|
||||
serialized_body = MultiJson.encode(options[:body_object].to_hash)
|
||||
else
|
||||
raise TypeError,
|
||||
'Could not convert body object to JSON.' +
|
||||
|
||||
@@ -57,7 +57,7 @@ module Google
|
||||
data = self.body
|
||||
case media_type
|
||||
when 'application/json'
|
||||
data = ::JSON.parse(data)
|
||||
data = MultiJson.decode(data)
|
||||
# Strip data wrapper, if present
|
||||
data = data['data'] if data.has_key?('data')
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user