Class: Luma::Models::PatientResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/luma/models/patient_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data: nil, response: nil) ⇒ PatientResponse

Returns a new instance of PatientResponse.



6
7
8
9
10
11
# File 'lib/luma/models/patient_response.rb', line 6

def initialize(data: nil, response: nil)
  @data = data
  @data = response.parsed_response if @data.nil? && response && response.ok?
  @data ||= {}
  @response = response
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/luma/models/patient_response.rb', line 4

def data
  @data
end

Instance Method Details

#contactObject



17
18
19
# File 'lib/luma/models/patient_response.rb', line 17

def contact
  @data['contact']
end

#do_not_contactObject



13
14
15
# File 'lib/luma/models/patient_response.rb', line 13

def do_not_contact
  @data['doNotContact']
end

#errors?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/luma/models/patient_response.rb', line 25

def errors?
  !@data['errors'].nil? && !@data['errors'].empty?
end

#ok?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/luma/models/patient_response.rb', line 21

def ok?
  @response&.ok?
end