Class: Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Response

Returns a new instance of Response.



5
6
7
8
9
# File 'lib/materialize/response.rb', line 5

def initialize(options)
  @message = options['message']
  @status  = options['status'].to_sym
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(message) ⇒ Object

This is used to look up ids -> e.g. patient_id, phase_id, etc.



16
17
18
# File 'lib/materialize/response.rb', line 16

def method_missing(message)
  options.send(:[], message.to_s)
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/materialize/response.rb', line 3

def message
  @message
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/materialize/response.rb', line 3

def options
  @options
end

#statusObject (readonly)

Returns the value of attribute status.



3
4
5
# File 'lib/materialize/response.rb', line 3

def status
  @status
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/materialize/response.rb', line 11

def ok?
  status == :ok
end