0.0
No commit activity in last 3 years
No release in over 3 years
Cumulus API Ruby Wrapper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
>= 0
~> 10.0
>= 0
>= 0

Runtime

 Project Readme

Cumulus Ruby Gem

A Ruby wrapper for the Cumulus API.

You should access the Cumulus API documentation in order to learn more about the request/response parameters for each endpoint.

Installation

$ gem install cumulus_ruby

Or if you are using Bundler, add

gem 'cumulus_ruby'
```

## API Usage Examples

You will need to get an access token. Once you have it, initialize the client
to make authenticated calls.

```ruby
require 'cumulus'

client = Cumulus::Client.new(token: '<redacted>', url: '<redacted>')
```

### Patients

Create a patient.

```ruby
attributes = { first_name: 'John', middle_name: 'Doe', curp: 'JDOE' }
patient = Cumulus::Patient.new(client, attributes)
patient.create
# or
patient = Patient.new(client)
patient.create(attributes)
```

Update a patient.

```ruby
patient.update(first_name: 'Mike')
```

Fetch a patient.

```ruby
patient = Cumulus::Patient.fetch(client, patient.curp)
```

Search patient info.

```ruby
patient.search(other_patient.curp, { query: 'foo' })
```

### P*mex

```ruby
pmx = Cumulus::Pmx.new(client)
```

Fetch Pemex companies

```ruby
pmx.fetch_companies
```

Fetch Pemex employees

```ruby
pmx.fetch_employees({
  'numeroEmpresa' => '123',
  'numeroEmpleado' => '123'
})
```

Fetch Pemex entitled

```ruby
pmx.fetch_entitled({
  'numeroEmpresa' => '123',
  'numeroEmpleado' => '123',
  'codigoDerechoHabiente' => '0'
})
```

Fetch patient by Pemex

```ruby
pmx.fetch_patient({
  'numeroEmpresa' => '123',
  'numeroEmpleado' => '123',
  'codigoDerechoHabiente' => '0'
})
```

Fetch patient by CURP

```ruby
pmx.fetch_patient_by_curp('SIFU123123')
```

Link patient to Pemex

```ruby
pmx.link_patient('AMED123123', {
  'numeroEmpresa' => '123',
  'numeroEmpleado' => '124',
  'codigoDerechoHabiente' => '0',
  'localidad' => 'Localidad 01',
  'derechoHabiente' => false
})
```

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).