Class: LIS::Data::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/lis/data.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Request

Returns a new instance of Request



4
5
6
# File 'lib/lis/data.rb', line 4

def initialize(data={})
  @data = data
end

Class Method Details

.from_yaml(text, barcode) ⇒ Object



36
37
38
39
40
41
# File 'lib/lis/data.rb', line 36

def self.from_yaml(text, barcode)
  data = YAML.load(text)
  data["id"] = barcode

  new(data)
end

Instance Method Details

#each_typeObject



26
27
28
29
30
# File 'lib/lis/data.rb', line 26

def each_type
  @data["types"].each do |t|
    yield id, t
  end
end

#idObject



17
18
19
# File 'lib/lis/data.rb', line 17

def id
  @data["id"]
end

#patient_first_nameObject



14
15
16
# File 'lib/lis/data.rb', line 14

def patient_first_name
  @data["patient"]["first_name"]
end

#patient_idObject



8
9
10
# File 'lib/lis/data.rb', line 8

def patient_id
  @data["patient"]["number"]
end

#patient_last_nameObject



11
12
13
# File 'lib/lis/data.rb', line 11

def patient_last_name
  @data["patient"]["last_name"]
end

#to_hashObject



32
33
34
# File 'lib/lis/data.rb', line 32

def to_hash
  @data
end

#typesObject



21
22
23
# File 'lib/lis/data.rb', line 21

def types
  @data["types"]
end