Class: Orthanc::Attachment
- Inherits:
-
Object
- Object
- Orthanc::Attachment
- Includes:
- Response
- Defined in:
- lib/orthanc/attachments.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
Instance Method Summary collapse
-
#compressed_data ⇒ Object
GET /resourceType/id/attachments/name/compressed-data.
-
#compressed_md5 ⇒ Object
GET /resourceType/id/attachments/name/compressed-md5.
-
#compressed_size ⇒ Object
GET /resourceType/id/attachments/name/compressed-size.
-
#data ⇒ Object
GET /resourceType/id/attachments/name/data.
-
#delete_attachment ⇒ Object
DELETE /resourceType/id/attachments/name.
-
#initialize(resource, id = nil) ⇒ Attachment
constructor
A new instance of Attachment.
-
#md5 ⇒ Object
GET /resourceType/id/attachments/name/md5.
-
#modify(payload = {}) ⇒ Object
PUT /resourceType/id/attachments/name.
-
#size ⇒ Object
GET /resourceType/id/attachments/name/size.
-
#verify_md5 ⇒ Object
POST /resourceType/id/attachments/name/verify-md5.
Methods included from Response
#bool_to_num, #handle_response, #num_to_bool
Constructor Details
#initialize(resource, id = nil) ⇒ Attachment
Returns a new instance of Attachment.
6 7 8 |
# File 'lib/orthanc/attachments.rb', line 6 def initialize(resource, id = nil) self.base_uri = resource["/attachments/#{id}"] end |
Instance Attribute Details
#base_uri ⇒ Object
Returns the value of attribute base_uri.
4 5 6 |
# File 'lib/orthanc/attachments.rb', line 4 def base_uri @base_uri end |
Instance Method Details
#compressed_data ⇒ Object
GET /resourceType/id/attachments/name/compressed-data
22 23 24 |
# File 'lib/orthanc/attachments.rb', line 22 def compressed_data handle_response(base_uri["compressed-data"].get) end |
#compressed_md5 ⇒ Object
GET /resourceType/id/attachments/name/compressed-md5
27 28 29 |
# File 'lib/orthanc/attachments.rb', line 27 def compressed_md5 handle_response(base_uri["compressed-md5"].get) end |
#compressed_size ⇒ Object
GET /resourceType/id/attachments/name/compressed-size
32 33 34 |
# File 'lib/orthanc/attachments.rb', line 32 def compressed_size handle_response(base_uri["compressed-size"].get) end |
#data ⇒ Object
GET /resourceType/id/attachments/name/data
37 38 39 |
# File 'lib/orthanc/attachments.rb', line 37 def data handle_response(base_uri["data"].get) end |
#delete_attachment ⇒ Object
DELETE /resourceType/id/attachments/name
12 13 14 |
# File 'lib/orthanc/attachments.rb', line 12 def handle_response(base_uri["attachments/#{name}"].delete) end |
#md5 ⇒ Object
GET /resourceType/id/attachments/name/md5
42 43 44 |
# File 'lib/orthanc/attachments.rb', line 42 def md5 handle_response(base_uri["md5"].get) end |
#modify(payload = {}) ⇒ Object
PUT /resourceType/id/attachments/name
17 18 19 |
# File 'lib/orthanc/attachments.rb', line 17 def modify(payload = {}) handle_response(base_uri["attachments/#{name}"].put(payload)) end |
#size ⇒ Object
GET /resourceType/id/attachments/name/size
47 48 49 |
# File 'lib/orthanc/attachments.rb', line 47 def size handle_response(base_uri["size"].get) end |
#verify_md5 ⇒ Object
POST /resourceType/id/attachments/name/verify-md5
52 53 54 |
# File 'lib/orthanc/attachments.rb', line 52 def verify_md5 handle_response(base_uri["verify-md5"].get) end |