orthanc 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 509d31ee74414e383409a5189892149d32457ce2
4
- data.tar.gz: 9867650b3e71e828cc86ae3c1096b1220fb0d792
3
+ metadata.gz: ccf9301babd64787d744d69a9a81464e3398fe4d
4
+ data.tar.gz: b8e4c42dac43349a5b14f8ac0fa0ad4cfb80433e
5
5
  SHA512:
6
- metadata.gz: 2fc432f1593ad9c8a64c8042de72fc93360b36873f909fee6841977bdb533cb65ecd4db6b375f37a782a4e4a7a9a6cf279d4d5422f3355c4124b93955d653e0f
7
- data.tar.gz: eda048fbf6e437af42013473290af66fd1234efc4d1f344372ad83a460f1f3e15d7d08294135e8230de03d43214237e6a731d3577a1cd44cf6d93ea78daacc96
6
+ metadata.gz: 185f53de1ddf328fbca69fb818d0b46c50ece065b54c78c5c0827d16232740ad450167bef087bece28312a4e0b36c2016ac060c459fdab0bf02f846f9e11fbb8
7
+ data.tar.gz: faf58cb724d81b4325a9052cb1046e41e0feed709f9db707298a71b434fba7779c0dd33ae4cace4f92b8336ac5669471f64adf2c0667100476e68b0813951298
@@ -24,33 +24,69 @@ module Orthanc
24
24
  end
25
25
 
26
26
  # POST /modalities/{dicom}/echo
27
- def echo(payload = {}) # C-Echo SCU
28
- handle_response(base_uri["echo"].post(payload))
27
+ def echo(payload = {}) # C-Echo SCU. Return true if successful
28
+ base_uri["echo"].post(payload){|response, request, result, &block|
29
+ if response.code == 200
30
+ return true
31
+ else
32
+ return false
33
+ end
34
+ }
29
35
  end
30
36
 
31
37
  # POST /modalities/{dicom}/find
32
- def find(payload = {})
33
- handle_response(base_uri["find"].post(payload))
38
+ def find(payload = {}) # C-Echo SCU. Return true if successful
39
+ base_uri["find"].post(payload){|response, request, result, &block|
40
+ if response.code == 200
41
+ return handle_response(response)
42
+ else
43
+ return false
44
+ end
45
+ }
34
46
  end
35
47
 
36
48
  # POST /modalities/{dicom}/find-patient
37
- def find_patient(payload = {})
38
- handle_response(base_uri["find-patient"].post(payload))
49
+ def find_patient(payload = {}) # eg. '{"PatientName":"JOD*","PatientSex":"M"}'
50
+ base_uri["find-patient"].post(payload){|response, request, result, &block|
51
+ if response.code == 200
52
+ return handle_response(response)
53
+ else
54
+ return false
55
+ end
56
+ }
39
57
  end
40
58
 
41
59
  # POST /modalities/{dicom}/find-series
42
- def find_series(payload = {})
43
- handle_response(base_uri["find-series"].post(payload))
60
+ def find_series(payload = {}) # eg. '{"PatientID":"0555643F"}'
61
+ base_uri["find-series"].post(payload){|response, request, result, &block|
62
+ if response.code == 200
63
+ return handle_response(response)
64
+ else
65
+ return false
66
+ end
67
+ }
44
68
  end
45
69
 
46
70
  # POST /modalities/{dicom}/find-study
47
- def find_study(payload = {})
48
- handle_response(base_uri["find-study"].post(payload))
71
+ def find_study(payload = {}) # eg. '{"PatientID":"0555643F","StudyInstanceUID":"1.2.840.113704.1.111.2768.1239195678.57"}'
72
+ base_uri["find-study"].post(payload){|response, request, result, &block|
73
+ if response.code == 200
74
+ return handle_response(response)
75
+ else
76
+ return false
77
+ end
78
+ }
49
79
  end
50
80
 
51
81
  # POST /modalities/{dicom}/store
52
82
  def store(payload = {}) # POST body = UUID series, UUID instance, or raw DICOM file
53
- handle_response(base_uri["store"].post(payload))
83
+ base_uri["store"].post(payload){|response, request, result, &block|
84
+ if response.code == 200
85
+ return true
86
+ else
87
+ return false
88
+ end
89
+ }
54
90
  end
55
91
 
56
92
  end
@@ -16,7 +16,11 @@ module Response
16
16
  parsed_response = JSON.parse(response)
17
17
 
18
18
  if parsed_response.class == Array
19
- return parsed_response
19
+ # Normalize to an array inside a hash, so RecursiveOpenStruct can act
20
+ data = {}
21
+ data["response"] = parsed_response
22
+ return RecursiveOpenStruct.new(data.to_snake_keys, recurse_over_arrays: true ).response
23
+
20
24
  elsif parsed_response.class == Hash
21
25
  return RecursiveOpenStruct.new(parsed_response.to_snake_keys, recurse_over_arrays: true )
22
26
  else
@@ -1,4 +1,4 @@
1
1
  module Orthanc
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  ORTHANC_API_VERSION = "0.8.6"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthanc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Rascovsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-19 00:00:00.000000000 Z
11
+ date: 2015-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler