lib/mailgun/messages/message_builder.rb
def make_json(obj)
      return JSON.parse(obj).to_json if obj.is_a?(String)
      return obj.to_json if obj.is_a?(Hash)
      return JSON.generate(obj).to_json
    rescue
      raise Mailgun::ParameterError, 'Provided data could not be made into JSON. Try a JSON string or Hash.', obj
    end
# Private: given an object attempt to make it into JSON
#
# obj - an object. Hopefully a JSON string or Hash
#
# Returns a JSON object or raises ParameterError
given an object attempt to make it into JSON
obj - an object. Hopefully a JSON string or Hash

Returns a JSON object or raises ParameterError
given an object attempt to make it into JSON obj - an object . Hopefully a JSON string or Hash Returns a JSON object or raises ParameterError
def make_json(obj)
      return JSON.parse(obj).to_json if obj.is_a?(String)
      return obj.to_json if obj.is_a?(Hash)
      return JSON.generate(obj).to_json
    rescue
      raise Mailgun::ParameterError, 'Provided data could not be made into JSON. Try a JSON string or Hash.', obj
    end
def make_json ( obj ) return JSON . parse ( obj ) . to_json if obj . is_a? ( String ) return obj . to_json if obj . is_a? ( Hash ) return JSON . generate ( obj ) . to_json rescue raise Mailgun :: ParameterError , 'Provided data could not be made into JSON. Try a JSON string or Hash.' , obj end
Private: given an object attempt to make it into JSON
obj - an object.
Private : given an object attempt to make it into JSON obj - an object .
obj