dock_health_api 0.4.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -19
- data/README.md +2 -1
- data/bin/console +1 -0
- data/lib/dock_health_api/config.rb +1 -4
- data/lib/dock_health_api/crud/create.rb +1 -6
- data/lib/dock_health_api/crud/delete.rb +1 -3
- data/lib/dock_health_api/crud/get.rb +1 -3
- data/lib/dock_health_api/crud/list.rb +5 -9
- data/lib/dock_health_api/crud/put.rb +1 -6
- data/lib/dock_health_api/crud/update.rb +1 -6
- data/lib/dock_health_api/resource.rb +2 -1
- data/lib/dock_health_api/resources/customfield.rb +1 -3
- data/lib/dock_health_api/resources/customstatus.rb +9 -0
- data/lib/dock_health_api/resources/task.rb +1 -3
- data/lib/dock_health_api/version.rb +1 -1
- data/lib/dock_health_api.rb +2 -0
- data/spec/customstatus_spec.rb +14 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/user_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a9382899e5f580794246b7cf1b1bce2e6bd00bf66bb04ef0de22685dfda82d8
|
4
|
+
data.tar.gz: 1d6aaa0c748708faec3c5029ecb5be843e1887a4c5f358b1622831cea09cd07e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bd14582d8b5979b9eb4101757a394e8c42deeffb7c014fed877cab1e28225e0f4b397e3e023c92dc64506d6517cd678f9fff0b51c43e8d6af4a2e41189876f6
|
7
|
+
data.tar.gz: 3490c9b42d257a7fff77cbcaabbc59a501e94c5d727192a8eae5d2e6a6f2070832a53adc1012f80a7799691a9ac4c3d3175a2f9f78a225535b0e8f42831cfab2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dock_health_api (0.
|
4
|
+
dock_health_api (0.5.3)
|
5
5
|
oauth2 (~> 1.4)
|
6
6
|
ostruct
|
7
7
|
rspec (~> 3.0)
|
@@ -12,38 +12,38 @@ GEM
|
|
12
12
|
coderay (1.1.3)
|
13
13
|
diff-lcs (1.5.0)
|
14
14
|
dotenv (2.7.6)
|
15
|
-
faraday (2.
|
16
|
-
faraday-net_http (
|
15
|
+
faraday (2.7.2)
|
16
|
+
faraday-net_http (>= 2.0, < 3.1)
|
17
17
|
ruby2_keywords (>= 0.0.4)
|
18
|
-
faraday-net_http (
|
19
|
-
jwt (2.
|
18
|
+
faraday-net_http (3.0.2)
|
19
|
+
jwt (2.5.0)
|
20
20
|
method_source (1.0.0)
|
21
21
|
multi_json (1.15.0)
|
22
22
|
multi_xml (0.6.0)
|
23
|
-
oauth2 (1.4.
|
23
|
+
oauth2 (1.4.11)
|
24
24
|
faraday (>= 0.17.3, < 3.0)
|
25
25
|
jwt (>= 1.0, < 3.0)
|
26
26
|
multi_json (~> 1.3)
|
27
27
|
multi_xml (~> 0.5)
|
28
|
-
rack (>= 1.2, <
|
28
|
+
rack (>= 1.2, < 4)
|
29
29
|
ostruct (0.5.5)
|
30
30
|
pry (0.14.1)
|
31
31
|
coderay (~> 1.1)
|
32
32
|
method_source (~> 1.0)
|
33
|
-
rack (
|
34
|
-
rspec (3.
|
35
|
-
rspec-core (~> 3.
|
36
|
-
rspec-expectations (~> 3.
|
37
|
-
rspec-mocks (~> 3.
|
38
|
-
rspec-core (3.
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-expectations (3.
|
33
|
+
rack (3.0.2)
|
34
|
+
rspec (3.12.0)
|
35
|
+
rspec-core (~> 3.12.0)
|
36
|
+
rspec-expectations (~> 3.12.0)
|
37
|
+
rspec-mocks (~> 3.12.0)
|
38
|
+
rspec-core (3.12.0)
|
39
|
+
rspec-support (~> 3.12.0)
|
40
|
+
rspec-expectations (3.12.1)
|
41
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-mocks (3.
|
42
|
+
rspec-support (~> 3.12.0)
|
43
|
+
rspec-mocks (3.12.1)
|
44
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-support (3.
|
45
|
+
rspec-support (~> 3.12.0)
|
46
|
+
rspec-support (3.12.0)
|
47
47
|
ruby2_keywords (0.0.5)
|
48
48
|
|
49
49
|
PLATFORMS
|
data/README.md
CHANGED
@@ -124,7 +124,8 @@ DockHealthApi::Organization.delete({id: "id of organization"})
|
|
124
124
|
# Add User to Organization
|
125
125
|
params = { userId: "<user id>", organizationId: "<organization id>" }
|
126
126
|
DockHealthApi::Organization::User.update(params)
|
127
|
-
|
127
|
+
# Delete User from Organization
|
128
|
+
DockHealthApi::Organization::User.delete({id: "< user id >"})
|
128
129
|
```
|
129
130
|
|
130
131
|
# Patient Data Format
|
data/bin/console
CHANGED
@@ -17,6 +17,7 @@ DockHealthApi.resource_url = ENV["DOCK_HEALTH_URL"]
|
|
17
17
|
DockHealthApi.org_id = ENV["DOCK_ORG"]
|
18
18
|
DockHealthApi.user_id = ENV["DOCK_USER"]
|
19
19
|
DockHealthApi.api = ENV["DOCK_HEALTH_API"]
|
20
|
+
DockHealthApi.token_url = ENV["DOCK_HEALTH_AUTH_URL"]
|
20
21
|
|
21
22
|
require "irb"
|
22
23
|
IRB.start(__FILE__)
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module DockHealthApi
|
2
2
|
class Config
|
3
|
-
attr_accessor :api_key, :api_secret, :api_base, :token_url, :resource_url, :org_id, :user_id, :api, :iframe_token, :token, :iframe_token_expires_at, :token_expires_at
|
3
|
+
attr_accessor :api_key, :api_secret, :api_base, :token_url, :resource_url, :org_id, :user_id, :api, :iframe_token, :token, :iframe_token_expires_at, :token_expires_at, :debug
|
4
4
|
|
5
|
-
def initialize
|
6
|
-
@token_url = "https://dock-health-dev.auth.us-east-1.amazoncognito.com/oauth2/token"
|
7
|
-
end
|
8
5
|
end
|
9
6
|
end
|
@@ -2,12 +2,7 @@ module DockHealthApi
|
|
2
2
|
module Crud
|
3
3
|
module Create
|
4
4
|
def create(**params)
|
5
|
-
|
6
|
-
resource_url,
|
7
|
-
headers: headers,
|
8
|
-
body_params: params)
|
9
|
-
return response.parsed
|
10
|
-
new(response.parsed)
|
5
|
+
execute_request(:post, resource_url, headers: headers, body_params: params)
|
11
6
|
end
|
12
7
|
end
|
13
8
|
end
|
@@ -3,9 +3,7 @@ module DockHealthApi
|
|
3
3
|
module Delete
|
4
4
|
def delete(**params)
|
5
5
|
id = params.delete(:id)
|
6
|
-
|
7
|
-
return response.parsed
|
8
|
-
new(response.parsed)
|
6
|
+
execute_request(:delete, "#{resource_url}/#{id}", headers: headers, body_params: params)
|
9
7
|
end
|
10
8
|
end
|
11
9
|
end
|
@@ -2,9 +2,7 @@ module DockHealthApi
|
|
2
2
|
module Crud
|
3
3
|
module Get
|
4
4
|
def get(id)
|
5
|
-
|
6
|
-
return response.parsed
|
7
|
-
new(response.parsed)
|
5
|
+
execute_request(:get, "#{resource_url}/#{id}", headers: headers )
|
8
6
|
end
|
9
7
|
end
|
10
8
|
end
|
@@ -3,16 +3,12 @@ module DockHealthApi
|
|
3
3
|
module List
|
4
4
|
def list(**params)
|
5
5
|
response = execute_request(:get, "#{resource_url}", headers: headers)
|
6
|
-
if params.empty?
|
7
|
-
|
8
|
-
|
9
|
-
search_result =
|
10
|
-
params.each do |p|
|
11
|
-
search_result = search_result.select { |list| list[p[0].to_s] == p[1] }
|
12
|
-
end
|
13
|
-
return search_result
|
6
|
+
return response if client.config.debug || params.empty?
|
7
|
+
search_result = response
|
8
|
+
params.each do |p|
|
9
|
+
search_result = search_result.select { |list| list[p[0].to_s] == p[1] }
|
14
10
|
end
|
15
|
-
|
11
|
+
return search_result
|
16
12
|
end
|
17
13
|
end
|
18
14
|
end
|
@@ -3,12 +3,7 @@ module DockHealthApi
|
|
3
3
|
module Put
|
4
4
|
def put(**params)
|
5
5
|
id = params.delete(:id)
|
6
|
-
response = execute_request(:put,
|
7
|
-
"#{resource_url}/#{id}",
|
8
|
-
headers: headers,
|
9
|
-
body_params: params)
|
10
|
-
return response.parsed
|
11
|
-
new(response.parsed)
|
6
|
+
response = execute_request(:put, "#{resource_url}/#{id}", headers: headers, body_params: params)
|
12
7
|
end
|
13
8
|
end
|
14
9
|
end
|
@@ -9,12 +9,7 @@ module DockHealthApi
|
|
9
9
|
resource_url_fixed = resource_url
|
10
10
|
end
|
11
11
|
id = params.delete(:id)
|
12
|
-
|
13
|
-
"#{resource_url_fixed}/#{id}",
|
14
|
-
headers: headers,
|
15
|
-
body_params: params)
|
16
|
-
return response.parsed
|
17
|
-
new(response.parsed)
|
12
|
+
execute_request(:patch, "#{resource_url_fixed}/#{id}", headers: headers, body_params: params)
|
18
13
|
end
|
19
14
|
end
|
20
15
|
end
|
@@ -27,7 +27,8 @@ module DockHealthApi
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.execute_request(method, url, params: {}, headers: {}, body_params: nil)
|
30
|
-
client.token_connection.send(method, url, params: params, headers: headers, body: body_params.to_json)
|
30
|
+
response = client.token_connection.send(method, url, params: params, headers: headers, body: body_params.to_json)
|
31
|
+
client.config.debug ? response : response.parsed
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
@@ -12,9 +12,7 @@ module DockHealthApi
|
|
12
12
|
|
13
13
|
def self.list(**params)
|
14
14
|
headers = {"x-api-key": "#{ENV["DOCK_HEALTH_API"]}", "x-user-id": "#{ENV["DOCK_USER"]}", "x-organization-id": client.config.org_id}
|
15
|
-
|
16
|
-
return response.parsed
|
17
|
-
new(response.parsed)
|
15
|
+
execute_request(:get, "#{resource_url}", headers: headers, params: params)
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
@@ -8,9 +8,7 @@ module DockHealthApi
|
|
8
8
|
|
9
9
|
def self.list(**params)
|
10
10
|
headers = {"x-api-key": "#{ENV["DOCK_HEALTH_API"]}", "x-user-id": "#{ENV["DOCK_USER"]}", "x-organization-id": client.config.org_id}
|
11
|
-
|
12
|
-
return response.parsed
|
13
|
-
new(response.parsed)
|
11
|
+
execute_request(:get, "#{resource_url}", headers: headers, params: params)
|
14
12
|
end
|
15
13
|
|
16
14
|
class Group < Task
|
data/lib/dock_health_api.rb
CHANGED
@@ -27,6 +27,7 @@ module DockHealthApi
|
|
27
27
|
autoload :Developer, "dock_health_api/resources/developer"
|
28
28
|
autoload :Organization, "dock_health_api/resources/organization"
|
29
29
|
autoload :CustomField, "dock_health_api/resources/customfield"
|
30
|
+
autoload :CustomStatus, "dock_health_api/resources/customstatus"
|
30
31
|
|
31
32
|
@config = DockHealthApi::Config.new
|
32
33
|
@iframe_base_url = "https://dev.dockhealth.app/#/auth/embedded?"
|
@@ -48,6 +49,7 @@ module DockHealthApi
|
|
48
49
|
def_delegators :@config, :iframe_token_expires_at, :iframe_token_expires_at=
|
49
50
|
def_delegators :@config, :token, :token=
|
50
51
|
def_delegators :@config, :token_expires_at, :token_expires_at=
|
52
|
+
def_delegators :@config, :debug, :debug=
|
51
53
|
|
52
54
|
def receive_iframe_token
|
53
55
|
Client.active_client.iframe_token_connection if iframe_token_expired?
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'dock_health_api'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe DockHealthApi::CustomStatus do
|
5
|
+
|
6
|
+
describe "#list" do
|
7
|
+
context "list all customstatus" do
|
8
|
+
it 'should list all customstatus' do
|
9
|
+
response = DockHealthApi::CustomStatus.list
|
10
|
+
expect(response.first.is_a?(DockHealthApi::CustomStatus))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/user_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dock_health_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Magomero
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-12-
|
12
|
+
date: 2022-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/dock_health_api/object.rb
|
110
110
|
- lib/dock_health_api/resource.rb
|
111
111
|
- lib/dock_health_api/resources/customfield.rb
|
112
|
+
- lib/dock_health_api/resources/customstatus.rb
|
112
113
|
- lib/dock_health_api/resources/developer.rb
|
113
114
|
- lib/dock_health_api/resources/organization.rb
|
114
115
|
- lib/dock_health_api/resources/patient.rb
|
@@ -119,6 +120,7 @@ files:
|
|
119
120
|
- lib/dock_health_api/version.rb
|
120
121
|
- spec/client_spec.rb
|
121
122
|
- spec/customfield_spec.rb
|
123
|
+
- spec/customstatus_spec.rb
|
122
124
|
- spec/developer_spec.rb
|
123
125
|
- spec/dock_health_api_spec.rb
|
124
126
|
- spec/organization.rb
|