Class: Organizai::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_response, format) ⇒ Response

Returns a new instance of Response.



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

def initialize(http_response,format)
  @http_response = http_response
  @format        = format
  @error         = http_response.code != "200"
  set_response_object
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



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

def error
  @error
end

#formatObject (readonly)

Returns the value of attribute format.



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

def format
  @format
end

#httpObject (readonly)

Returns the value of attribute http.



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

def http
  @http
end

#objectObject (readonly)

Returns the value of attribute object.



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

def object
  @object
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


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

def error?
  @error
end

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  !error?
end