Class: Materialize::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.



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

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.



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

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

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


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

def ok?
  status == :ok
end