class Blockspring::Response
Public Class Methods
new()
click to toggle source
# File lib/blockspring.rb, line 232 def initialize @result = { :_blockspring_spec => true, :_errors => [] } end
Public Instance Methods
addErrorOutput(title, message = nil)
click to toggle source
# File lib/blockspring.rb, line 258 def addErrorOutput(title, message = nil) @result[:_errors].push({ title: title, message: message } ) return self end
addFileOutput(name, filepath)
click to toggle source
# File lib/blockspring.rb, line 244 def addFileOutput(name, filepath) filename = File.basename(filepath) b64_file_contents = Base64.strict_encode64(File.read(filepath)) mime_type_object = MIME::Types.of(filename).last mime_type = mime_type_object ? mime_type_object.content_type : nil @result[name] = { :filename => filename, :"content-type" => mime_type, :data => b64_file_contents } return self end
addOutput(name, value = nil)
click to toggle source
# File lib/blockspring.rb, line 239 def addOutput(name, value = nil) @result[name] = value return self end
end()
click to toggle source
# File lib/blockspring.rb, line 268 def end puts @result.to_json end