Class: Trello::Attachment

Inherits:
BasicData show all
Defined in:
lib/trello/attachment.rb

Overview

A file or url that is linked to a Trello card

Instance Attribute Summary

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

Constructor Details

This class inherits a constructor from Trello::BasicData

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.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/trello/attachment.rb', line 9

def update_fields(fields)
  attributes[:name]  = fields['name']
  attributes[:id] = fields['id']
  attributes[:url] = fields['url']
  attributes[:bytes] = fields['bytes'].to_i
  attributes[:member_id] = fields['idMember']
  attributes[:date] = Time.parse(fields['date'])
  attributes[:is_upload] = fields['isUpload']
  attributes[:mime_type] = fields['mimeType']
  self
end