Class: Orthanc::Attachment

Inherits:
Object
  • Object
show all
Includes:
Response
Defined in:
lib/orthanc/attachments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_uriObject

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_dataObject

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_md5Object

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_sizeObject

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

#dataObject

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_attachmentObject

DELETE /resourceType/id/attachments/name



12
13
14
# File 'lib/orthanc/attachments.rb', line 12

def delete_attachment
  handle_response(base_uri["attachments/#{name}"].delete)
end

#md5Object

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

#sizeObject

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_md5Object

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