Class: Oja::Mock::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/oja/mock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, payload) ⇒ Response

Returns a new instance of Response.



9
10
11
12
# File 'lib/oja/mock.rb', line 9

def initialize(status_code, payload)
  @status_code = status_code
  @payload = payload
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



7
8
9
# File 'lib/oja/mock.rb', line 7

def payload
  @payload
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



7
8
9
# File 'lib/oja/mock.rb', line 7

def status_code
  @status_code
end

Instance Method Details

#bodyObject



18
19
20
# File 'lib/oja/mock.rb', line 18

def body
  JSON.dump(payload)
end

#ok?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/oja/mock.rb', line 14

def ok?
  200 == status_code.to_i
end