Class: Taleo::Attachment
Instance Attribute Summary
Attributes inherited from Resource
#client, #data
Instance Method Summary
collapse
Methods inherited from Resource
has_many, has_one, #initialize, #related_resource, #related_resources, #relationship_urls
Instance Method Details
#can_download? ⇒ Boolean
19
20
21
|
# File 'lib/taleo/attachment.rb', line 19
def can_download?
data.key?('downloadUrl')
end
|
#content_type ⇒ Object
15
16
17
|
# File 'lib/taleo/attachment.rb', line 15
def content_type
data.fetch('contentType')
end
|
#download ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/taleo/attachment.rb', line 23
def download
unless can_download?
raise Error.new("Attachment #{id} is not available for download")
end
client.download(data.fetch('downloadUrl'))
end
|
#id ⇒ Object
7
8
9
|
# File 'lib/taleo/attachment.rb', line 7
def id
data.fetch('id')
end
|
#type ⇒ Object
11
12
13
|
# File 'lib/taleo/attachment.rb', line 11
def type
data.fetch('attachmentType')
end
|