class Gizmo::Response
Attributes
callback[RW]
data[RW]
format[RW]
headers[RW]
status[RW]
Public Class Methods
new(attrs={})
click to toggle source
TODO document options
# File lib/gizmo/models/response.rb, line 7 def initialize(attrs={}) @headers = {} attrs.each do |name, val| setter = :"#{name}=" send(setter, val) if respond_to? setter end end
Public Instance Methods
header(name, value)
click to toggle source
# File lib/gizmo/models/response.rb, line 16 def header(name, value) headers[name.to_s] = value.to_s end
to_hash(opts={})
click to toggle source
# File lib/gizmo/models/response.rb, line 20 def to_hash(opts={}) hash = { format => data.as_json(opts), status: status, callback: callback } hash[:headers] = headers unless headers.nil? || headers.empty? hash end