Class: Chute::Response

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/chute/response.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.with_code_and_error(code, error) ⇒ Object



6
7
8
9
10
11
# File 'lib/chute/response.rb', line 6

def self.with_code_and_error(code, error)
  object        = Chute::Response.new
  object.code   = code
  object.errors = [error]
  object
end

Instance Method Details

#pretty_printObject



17
18
19
# File 'lib/chute/response.rb', line 17

def pretty_print
  puts JSON.pretty_generate self
end

#success?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/chute/response.rb', line 13

def success?
  [200, 201].include?(response.code)
end