Class: Trello::Attachment
Overview
A file or url that is linked to a Trello card
Instance Attribute Summary collapse
Attributes inherited from BasicData
#client
Instance Method Summary
collapse
Methods inherited from BasicData
#==, client, create, find, #initialize, many, one, parse, parse_many, path_name, #refresh!, register_attributes, save
Methods included from JsonUtils
included
Instance Attribute Details
#bytes ⇒ Fixnum
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/trello/attachment.rb', line 20
class Attachment < BasicData
register_attributes :name, :id, :pos, :url, :bytes, :member_id, :date, :is_upload, :mime_type, :previews
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
end
|
#date ⇒ Datetime
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/trello/attachment.rb', line 20
class Attachment < BasicData
register_attributes :name, :id, :pos, :url, :bytes, :member_id, :date, :is_upload, :mime_type, :previews
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
end
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/trello/attachment.rb', line 20
class Attachment < BasicData
register_attributes :name, :id, :pos, :url, :bytes, :member_id, :date, :is_upload, :mime_type, :previews
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
end
|
#is_upload ⇒ Boolean
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/trello/attachment.rb', line 20
class Attachment < BasicData
register_attributes :name, :id, :pos, :url, :bytes, :member_id, :date, :is_upload, :mime_type, :previews
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
end
|
#mime_type ⇒ String
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/trello/attachment.rb', line 20
class Attachment < BasicData
register_attributes :name, :id, :pos, :url, :bytes, :member_id, :date, :is_upload, :mime_type, :previews
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
end
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/trello/attachment.rb', line 20
class Attachment < BasicData
register_attributes :name, :id, :pos, :url, :bytes, :member_id, :date, :is_upload, :mime_type, :previews
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
end
|
#pos ⇒ Float
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/trello/attachment.rb', line 20
class Attachment < BasicData
register_attributes :name, :id, :pos, :url, :bytes, :member_id, :date, :is_upload, :mime_type, :previews
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
end
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/trello/attachment.rb', line 20
class Attachment < BasicData
register_attributes :name, :id, :pos, :url, :bytes, :member_id, :date, :is_upload, :mime_type, :previews
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
end
|
Instance Method Details
#update_fields(fields) ⇒ Object
Update the fields of an attachment.
Supply a hash of stringkeyed data retrieved from the Trello API representing an attachment.
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/trello/attachment.rb', line 26
def update_fields(fields)
attributes[:name] = fields['name'] || attributes[:name]
attributes[:id] = fields['id'] || attributes[:id]
attributes[:pos] = fields['pos'] || attributes[:pos]
attributes[:url] = fields['url'] || attributes[:url]
attributes[:bytes] = fields['bytes'].to_i || attributes[:bytes]
attributes[:member_id] = fields['idMember'] || attributes[:member_id]
attributes[:date] = Time.parse(fields['date']).presence || attributes[:date]
attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
attributes[:previews] = fields['previews'] if fields.has_key?('previews')
self
end
|