dock_health_api 0.5.8 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 744bfe703e4f755b8a9b1e17713dc55e65d1a03f1e11de51fd0d684c3f031afb
4
- data.tar.gz: 89dcf95b0ad77852e57e7ebe60b8c542f45758f986a702f2e72285f869a92fbd
3
+ metadata.gz: b2af1c1407e571857886d5e50fcc2316eaa54133fa4337d4de31127686f50d57
4
+ data.tar.gz: b3d2f3e11c255f1a36d6b70ae1cca858599e57b6731b0757a79e6b4f45e547f0
5
5
  SHA512:
6
- metadata.gz: 6f2bc2e66d7adee6e4984d7a21e05c91c7a24b5cd5d37fa850111ecdf004fc306e11812f4d4db48862ef9424457b2ee0495fc39b70ac4711e128439735bacac3
7
- data.tar.gz: 3a986259f4154205e21a4b935bd981276b4ecd5139ced86486cfe18657c5107e177124ee1acc9733389d134b0e4ccdb621d73920a2fe1ff47bbd3b95f72135a1
6
+ metadata.gz: '08bce4c99c414cdffbad1a4abcc3d19fff2d42fae49d5f923a0be3f938bb2c3becc150aae028de15d767974848b12c74e51a18e99e3b923860af0e3e759348ed'
7
+ data.tar.gz: 83bdcc745db915f1ba250d8eedf00f463777bd7f755bd2e36c48a2ae96d7496d5f77e466f78245cd8d85c646e0babcd9c030027a03cf7f2dfddf75ece71b78da
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dock_health_api (0.5.8)
4
+ dock_health_api (0.5.10)
5
5
  oauth2 (~> 1.4)
6
6
  ostruct
7
7
  rspec (~> 3.0)
data/README.md CHANGED
@@ -126,6 +126,19 @@ params = { userId: "<user id>", organizationId: "<organization id>" }
126
126
  DockHealthApi::Organization::User.update(params)
127
127
  # Delete User from Organization
128
128
  DockHealthApi::Organization::User.delete({id: "< user id >"})
129
+
130
+ # Get Specific Comment
131
+ DockHealthApi::Task::Comment.get("<comment id>")
132
+ # List comments for a specific task
133
+ DockHealthApi::Task::Comment.list(taskIdentifier: "<task id>")
134
+ # Create comment for a specific task
135
+ params = { comment: "comment text here", task: { type: "TASK", id: "<task id>" }}
136
+ DockHealthApi::Task::Comment.create(params)
137
+ # Update specific comment
138
+ params = { comment: "comment text here", id: "<comment id>" }
139
+ DockHealthApi::Task::Comment.update(params)
140
+ # Delete a specific comment
141
+ DockHealthApi::Task::Comment.delete(id: "<comment id>")
129
142
  ```
130
143
 
131
144
  # Patient Data Format
@@ -16,5 +16,11 @@ module DockHealthApi
16
16
  "#{Task.resource_url}/group"
17
17
  end
18
18
  end
19
+
20
+ class Comment < Task
21
+ def self.resource_url
22
+ "#{Task.resource_url}/comment"
23
+ end
24
+ end
19
25
  end
20
26
  end
@@ -1,3 +1,3 @@
1
1
  module DockHealthApi
2
- VERSION = "0.5.8"
2
+ VERSION = "0.5.10"
3
3
  end
@@ -49,7 +49,7 @@ module DockHealthApi
49
49
  def_delegators :@config, :iframe_base_url, :iframe_base_url=
50
50
 
51
51
  def receive_iframe_token
52
- @receive_iframe_token ||= Client.instance.iframe_token_connection
52
+ Client.instance.iframe_token_connection
53
53
  end
54
54
 
55
55
  def iframe_token
@@ -0,0 +1,72 @@
1
+ require 'dock_health_api'
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe DockHealthApi::Task::Comment do
5
+ let(:tasklistid) {DockHealthApi::TaskList.list.last["id"]}
6
+ let(:task) { DockHealthApi::Task.create({ description: "test foobar", taskList: { type: "DEVELOPER", id: tasklistid } }) }
7
+ let(:params) { { comment: "initial comment", task: { type: "TASK", id: task["id"] }} }
8
+ let!(:comment) { DockHealthApi::Task::Comment.create(params) }
9
+
10
+ describe "#create" do
11
+ context "create new task comment" do
12
+ let(:new_comment_params) { { comment: "new comment", task: { type: "TASK", id: task["id"] }} }
13
+
14
+ it "should create new task comment" do
15
+ initial_count = DockHealthApi::Task::Comment.list(taskIdentifier: task["id"]).count
16
+ response = DockHealthApi::Task::Comment.create(new_comment_params)
17
+ final_count = DockHealthApi::Task::Comment.list(taskIdentifier: task["id"]).count
18
+ expect(response["comment"]).to eq(new_comment_params[:comment])
19
+ expect(final_count - initial_count).to eq(1)
20
+ end
21
+ end
22
+ end
23
+
24
+ describe "#list" do
25
+ context "list task comment by criteria" do
26
+ it "should list all task comments by criteria" do
27
+ response = DockHealthApi::Task::Comment.list(taskIdentifier: task["id"])
28
+ expect(response.last.is_a?(DockHealthApi::Task::Comment))
29
+ end
30
+ end
31
+ end
32
+
33
+ describe "#get" do
34
+ context "get a specific task comment" do
35
+ it "should get the correct task comment" do
36
+ response = DockHealthApi::Task::Comment.get(comment["id"])
37
+ expect(response["comment"]).to eq(params[:comment])
38
+ end
39
+ end
40
+
41
+ context "get task comment with wrong id" do
42
+ it "should return 404" do
43
+ wrong_id = "a" * 36
44
+ response = DockHealthApi::Task::Comment.get(wrong_id)
45
+ expect(response["status"]).to eq(500)
46
+ end
47
+ end
48
+ end
49
+
50
+ describe "#update" do
51
+ context "update existing task comment" do
52
+ it "should update existing task comment" do
53
+ update_params = { comment: "updated text", id: comment["id"] }
54
+ response = DockHealthApi::Task::Comment.update(update_params)
55
+ expect(response["comment"]).to eq(update_params[:comment])
56
+ updated_task = DockHealthApi::Task::Comment.get(comment["id"])
57
+ expect(updated_task["comment"]).to eq(update_params[:comment])
58
+ end
59
+ end
60
+ end
61
+
62
+ describe "#delete" do
63
+ context "Delete existing task comment" do
64
+ it "should delete existing task comment" do
65
+ initial_count = DockHealthApi::Task::Comment.list(taskIdentifier: task["id"]).count
66
+ response = DockHealthApi::Task::Comment.delete(id: comment["id"])
67
+ final_count = DockHealthApi::Task::Comment.list(taskIdentifier: task["id"]).count
68
+ expect(initial_count - final_count).to eq(1)
69
+ end
70
+ end
71
+ end
72
+ end
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.5.8
4
+ version: 0.5.10
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: 2023-01-20 00:00:00.000000000 Z
12
+ date: 2023-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
@@ -127,6 +127,7 @@ files:
127
127
  - spec/organization.rb
128
128
  - spec/patient_spec.rb
129
129
  - spec/spec_helper.rb
130
+ - spec/task_comment_spec.rb
130
131
  - spec/task_group_spec.rb
131
132
  - spec/task_spec.rb
132
133
  - spec/tasklist_spec.rb