athena_health 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/athena_health.rb +7 -0
- data/lib/athena_health/balance.rb +8 -0
- data/lib/athena_health/base_collection.rb +9 -0
- data/lib/athena_health/base_model.rb +5 -0
- data/lib/athena_health/client.rb +15 -0
- data/lib/athena_health/connection.rb +4 -4
- data/lib/athena_health/department.rb +30 -0
- data/lib/athena_health/department_collection.rb +5 -0
- data/lib/athena_health/patient.rb +52 -0
- data/lib/athena_health/patient_collection.rb +5 -0
- data/lib/athena_health/practice.rb +1 -3
- data/lib/athena_health/practice_collection.rb +1 -4
- data/lib/athena_health/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d6421f4e82d9baceb3cc863df051453c79bc1fc
|
4
|
+
data.tar.gz: 1ddbeca3dc8409eb06aeb9c3a19554547cd741a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e0500b98eddced67eaa21e937b9d0a0bac1f7f69b327185e4b2f20d3d4fe91204d8135f89872cf8a7dcffa5abaa6c03a6904207fb69ab0f687e8f198adfe412
|
7
|
+
data.tar.gz: 3df3b128080fc78e7734acd0221991e543eec67bf89b32195474341d6d58114eb16333458d3f4667bb102064ca7b43819060085509dc43bd39cbc091da35efb0
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/athena_health.svg)](https://badge.fury.io/rb/athena_health)
|
1
2
|
[![Build Status](https://travis-ci.org/MatUrbanski/athena_health.svg?branch=master)](https://travis-ci.org/MatUrbanski/athena_health)
|
2
3
|
[![Dependency Status](https://gemnasium.com/MatUrbanski/athena_health.svg)](https://gemnasium.com/MatUrbanski/athena_health)
|
3
4
|
|
data/lib/athena_health.rb
CHANGED
@@ -5,8 +5,15 @@ require 'athena_health/version'
|
|
5
5
|
require 'athena_health/connection'
|
6
6
|
require 'athena_health/error'
|
7
7
|
require 'athena_health/client'
|
8
|
+
require 'athena_health/base_collection'
|
9
|
+
require 'athena_health/base_model'
|
8
10
|
require 'athena_health/practice'
|
9
11
|
require 'athena_health/practice_collection'
|
12
|
+
require 'athena_health/department'
|
13
|
+
require 'athena_health/department_collection'
|
14
|
+
require 'athena_health/balance'
|
15
|
+
require 'athena_health/patient'
|
16
|
+
require 'athena_health/patient_collection'
|
10
17
|
|
11
18
|
module AthenaHealth
|
12
19
|
end
|
data/lib/athena_health/client.rb
CHANGED
@@ -13,5 +13,20 @@ module AthenaHealth
|
|
13
13
|
response = @api.call(endpoint: "#{practice_id}/practiceinfo", method: :get, params: params)
|
14
14
|
PracticeCollection.new(response).practiceinfo.first
|
15
15
|
end
|
16
|
+
|
17
|
+
def all_departments(practice_id:, params: {})
|
18
|
+
response = @api.call(endpoint: "#{practice_id}/departments", method: :get, params: params)
|
19
|
+
DepartmentCollection.new(response)
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_department(practice_id:, department_id:, params: {})
|
23
|
+
response = @api.call(endpoint: "#{practice_id}/departments/#{department_id}", method: :get, params: params)
|
24
|
+
Department.new(response.first)
|
25
|
+
end
|
26
|
+
|
27
|
+
def all_patients(practice_id:, department_id:, params: {})
|
28
|
+
response = @api.call(endpoint: "#{practice_id}/patients", method: :get, params: params.merge!(departmentid: department_id))
|
29
|
+
PatientCollection.new(response)
|
30
|
+
end
|
16
31
|
end
|
17
32
|
end
|
@@ -24,21 +24,21 @@ module AthenaHealth
|
|
24
24
|
def call(endpoint:, method:, params: {}, second_call: false)
|
25
25
|
authenticate if @token.nil?
|
26
26
|
|
27
|
-
|
27
|
+
response = Typhoeus::Request.new(
|
28
28
|
"#{BASE_URL}/#{@version}/#{endpoint}",
|
29
29
|
method: method,
|
30
30
|
headers: { "Authorization" => "Bearer #{@token}"},
|
31
31
|
params: params
|
32
32
|
).run
|
33
33
|
|
34
|
-
if
|
34
|
+
if response.response_code == 401 && !second_call
|
35
35
|
authenticate
|
36
36
|
call(endpoint: endpoint, method: method, second_call: true)
|
37
37
|
end
|
38
38
|
|
39
|
-
AthenaHealth::Error.new(code:
|
39
|
+
AthenaHealth::Error.new(code: response.response_code).render if response.response_code != 200
|
40
40
|
|
41
|
-
JSON.parse(
|
41
|
+
JSON.parse(response.response_body)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module AthenaHealth
|
2
|
+
class Department < BaseModel
|
3
|
+
attribute :creditcardtypes, Array
|
4
|
+
attribute :medicationhistoryconsent, Boolean
|
5
|
+
attribute :timezoneoffset, Fixnum
|
6
|
+
attribute :providergroupid, Integer
|
7
|
+
attribute :singleappointmentcontractmax, Integer
|
8
|
+
attribute :state, String
|
9
|
+
attribute :portalurl, String
|
10
|
+
attribute :city, String
|
11
|
+
attribute :placeofservicefacility, Boolean
|
12
|
+
attribute :oneyearcontractmax, Integer
|
13
|
+
attribute :latitude, Float
|
14
|
+
attribute :providergroupname, String
|
15
|
+
attribute :doesnotobservedst, Boolean
|
16
|
+
attribute :departmentid, Integer
|
17
|
+
attribute :address, String
|
18
|
+
attribute :placeofservicetypeid, Integer
|
19
|
+
attribute :longitude, Float
|
20
|
+
attribute :clinicals, String
|
21
|
+
attribute :timezone, Fixnum
|
22
|
+
attribute :patientdepartmentname, String
|
23
|
+
attribute :name, String
|
24
|
+
attribute :placeofservicetypename, String
|
25
|
+
attribute :phone, String
|
26
|
+
attribute :ecommercecreditcardtypes, Array
|
27
|
+
attribute :zip, String
|
28
|
+
attribute :communicatorbrandid, Integer
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module AthenaHealth
|
2
|
+
class Patient < BaseModel
|
3
|
+
attribute :email, String
|
4
|
+
attribute :occupationcode, String
|
5
|
+
attribute :departmentid, Integer
|
6
|
+
attribute :homephone, String
|
7
|
+
attribute :guarantorstate, String
|
8
|
+
attribute :driverslicense, Boolean
|
9
|
+
attribute :workphone, String
|
10
|
+
attribute :ethnicitycode, String
|
11
|
+
attribute :industrycode, String
|
12
|
+
attribute :contacthomephone, String
|
13
|
+
attribute :guarantorssn, String
|
14
|
+
attribute :guarantordob, String
|
15
|
+
attribute :zip, String
|
16
|
+
attribute :guarantoraddresssameaspatient, Boolean
|
17
|
+
attribute :employerphone, String
|
18
|
+
attribute :contactmobilephone, String
|
19
|
+
attribute :nextkinphone, String
|
20
|
+
attribute :portaltermsonfile, Boolean
|
21
|
+
attribute :status, String
|
22
|
+
attribute :lastname, String
|
23
|
+
attribute :guarantorfirstname, String
|
24
|
+
attribute :city, String
|
25
|
+
attribute :ssn, String
|
26
|
+
attribute :guarantoremail, String
|
27
|
+
attribute :guarantorcity, String
|
28
|
+
attribute :guarantorzip, String
|
29
|
+
attribute :privacyinformationverified, Boolean
|
30
|
+
attribute :primarydepartmentid, Integer
|
31
|
+
attribute :balances, Array[Balance]
|
32
|
+
attribute :race, Array
|
33
|
+
attribute :language6392code, String
|
34
|
+
attribute :primaryproviderid, Integer
|
35
|
+
attribute :patientphoto, Boolean
|
36
|
+
attribute :caresummarydeliverypreference, Boolean
|
37
|
+
attribute :guarantorlastname, Boolean
|
38
|
+
attribute :firstname, String
|
39
|
+
attribute :guarantorcountrycode, String
|
40
|
+
attribute :state, String
|
41
|
+
attribute :patientid, Integer
|
42
|
+
attribute :dob, String
|
43
|
+
attribute :guarantorrelationshiptopatient, Integer
|
44
|
+
attribute :address1, String
|
45
|
+
attribute :guarantorphone, String
|
46
|
+
attribute :countrycode, String
|
47
|
+
attribute :guarantoraddress1, String
|
48
|
+
attribute :consenttotext, Boolean
|
49
|
+
attribute :countrycode3166, String
|
50
|
+
attribute :guarantorcountrycode3166, String
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: athena_health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Urbański
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -111,9 +111,16 @@ files:
|
|
111
111
|
- Rakefile
|
112
112
|
- athena_health.gemspec
|
113
113
|
- lib/athena_health.rb
|
114
|
+
- lib/athena_health/balance.rb
|
115
|
+
- lib/athena_health/base_collection.rb
|
116
|
+
- lib/athena_health/base_model.rb
|
114
117
|
- lib/athena_health/client.rb
|
115
118
|
- lib/athena_health/connection.rb
|
119
|
+
- lib/athena_health/department.rb
|
120
|
+
- lib/athena_health/department_collection.rb
|
116
121
|
- lib/athena_health/error.rb
|
122
|
+
- lib/athena_health/patient.rb
|
123
|
+
- lib/athena_health/patient_collection.rb
|
117
124
|
- lib/athena_health/practice.rb
|
118
125
|
- lib/athena_health/practice_collection.rb
|
119
126
|
- lib/athena_health/version.rb
|