Class: Cumulus::Patient

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

Constant Summary collapse

PARAMETERS =
{
  'id' => 'id',
  'first_name' => 'nombre',
  'middle_name' => 'apellido',
  'last_name' => 'apellidoSegundo',
  'telephone' => 'telefono',
  'telephone2' => 'telefonoAlt',
  'email' => 'correo',
  'born_at' => 'fechaNacimiento',
  'gender' => 'sexo',
  'curp' => 'curp',
  'street' => 'calle',
  'city' => 'ciudad',
  'state' => 'estado',
  'country' => 'pais',
  'zipcode' => 'codigoPostal'
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, parameters = {}) ⇒ Patient



27
28
29
30
# File 'lib/cumulus/patient.rb', line 27

def initialize(client, parameters={})
  @client = client
  parameters_handler.set(parameters)
end

Class Method Details

.fetch(client, curp) ⇒ Object



23
24
25
# File 'lib/cumulus/patient.rb', line 23

def self.fetch(client, curp)
  client.request(:get, "/pacientes/#{curp}")
end

Instance Method Details

#create(parameters = {}) ⇒ Object



32
33
34
35
# File 'lib/cumulus/patient.rb', line 32

def create(parameters={})
  parameters_handler.set(parameters)
  client.request(:post, '/pacientes', parameters_handler.for_request)
end

#search(curp, query) ⇒ Object



42
43
44
# File 'lib/cumulus/patient.rb', line 42

def search(curp, query)
  client.request(:post, "/pacientes/#{curp}/busqueda", { query: query })
end

#update(parameters = {}) ⇒ Object



37
38
39
40
# File 'lib/cumulus/patient.rb', line 37

def update(parameters={})
  parameters_handler.set(parameters)
  client.request(:put, "/pacientes/#{curp}", parameters_handler.for_request)
end