Class: Medicapi::Symptom

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_options) ⇒ Symptom

Returns a new instance of Symptom.



7
8
9
10
11
# File 'lib/medicapi.rb', line 7

def initialize(input_options)
  @id = input_options["ID"].to_i
  @name = input_options["Name"]
  
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/medicapi.rb', line 6

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/medicapi.rb', line 6

def name
  @name
end

Class Method Details

.all(token) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/medicapi.rb', line 12

def self.all(token)
  ruby_data = []
  bulk_data = Unirest.get("https://healthservice.priaid.ch/symptoms?token=#{token}&language=en-gb&format=json").body
  bulk_data.each do |symptom|
    ruby_data << Symptom.new(symptom)
  end
  ruby_data
end