lib/recurly/schema/json_parser.rb in recurly-3.0.0.beta.4 vs lib/recurly/schema/json_parser.rb in recurly-3.0.0.beta.5

- old
+ new

@@ -1,6 +1,6 @@ -require 'json' +require "json" module Recurly # This is a wrapper class to help parse responses into Recurly objects. class JSONParser # Parses the json body into a recurly object. @@ -21,11 +21,11 @@ # @return [Error,Resource] def self.from_json(data) type = if data.has_key?("error") "error" else - data.delete('object') + data.delete("object") end klazz = self.recurly_class(type) unless klazz raise ArgumentError, "Unknown resource for json type #{type}" @@ -50,13 +50,13 @@ # @return [Resource,Pager,nil] def self.recurly_class(type) case type when nil nil - when 'list' + when "list" Pager else - type_camelized = type.split('_').map(&:capitalize).join + type_camelized = type.split("_").map(&:capitalize).join if Resources.const_defined?(type_camelized) klazz = Resources.const_get(type_camelized) if klazz.ancestors.include?(Resource) klazz else