Class: Mirah::PushResult

Inherits:
Object
  • Object
show all
Defined in:
lib/mirah/push_result.rb

Overview

The result of a create or update operation.

Examples:

Create a new patient

result = client.push_patient(external_id: 'mrn001', given_name: 'Henry', family_name: 'Jones',
                             birth_date: Date.parse('1983-03-20'))
  => #<Mirah::PushResult:... @given_name="Henry", @family_name="Jones", @birth_date=#<Date: 1983-03-20>
result.status # => "UPDATED"
result.result.given_name # => "Henry"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, result:, errors:, input:) ⇒ PushResult

Returns a new instance of PushResult.



13
14
15
16
17
18
# File 'lib/mirah/push_result.rb', line 13

def initialize(status:, result:, errors:, input:)
  @result = result
  @status = status
  @errors = errors
  @input = input
end

Instance Attribute Details

#errorsArray<Error> (readonly)

Any errors that occurred in processing

Returns:

  • (Array<Error>)

    any errors that occurred.



34
35
36
# File 'lib/mirah/push_result.rb', line 34

def errors
  @errors
end

#inputInput (readonly)

The input parameters used

Returns:

  • (Input)

    the input object



38
39
40
# File 'lib/mirah/push_result.rb', line 38

def input
  @input
end

#resultData? (readonly)

The result, where executed successfully.

Returns:

  • (Data, nil)

    the appropriate data type, if the result was successful



30
31
32
# File 'lib/mirah/push_result.rb', line 30

def result
  @result
end

#status"CREATED", ... (readonly)

The status of the request. It can be one of:

* CREATED: A new resource was created
* UPDATED: An existing resource was updated
* SKIPPED: The record was understood but not processed.
* ERROR: An error occured.

Returns:

  • ("CREATED", "UPDATED", "ERROR", "SKIPPED")


26
27
28
# File 'lib/mirah/push_result.rb', line 26

def status
  @status
end