Class: Koko::Tracker::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/koko/tracker/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status = 200, body = nil) ⇒ Response

public: Simple class to wrap responses from the API



9
10
11
12
# File 'lib/koko/tracker/response.rb', line 9

def initialize(status = 200, body = nil)
  @status = status
  @body  = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/koko/tracker/response.rb', line 4

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/koko/tracker/response.rb', line 4

def status
  @status
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/koko/tracker/response.rb', line 14

def valid?
  @status >= 200 && @status < 300
end