class GoogleCells::Revision
Public Class Methods
list(key)
click to toggle source
# File lib/google_cells/revision.rb, line 12 def list(key) revisions = [] res = request(:get, self.revisions_uri(key)) JSON.parse(res.body)['items'].each do |entry| args = parse_from_entry(entry) revisions << Revision.new(args.merge(spreadsheet_key: key)) end revisions.sort{|a,b| a.updated_at <=> b.updated_at} end
Private Class Methods
parse_from_entry(entry)
click to toggle source
# File lib/google_cells/revision.rb, line 29 def self.parse_from_entry(entry) author = entry['lastModifyingUser'] { id: entry['id'], updated_at: entry['modifiedDate'], etag: entry['etag'], author: (author.nil? ? nil : Author.new( name: author['displayName'], email: author['emailAddress'] )) } end
Public Instance Methods
spreadsheet()
click to toggle source
# File lib/google_cells/revision.rb, line 23 def spreadsheet @spreadsheet ||= Spreadsheet.get(self.spreadsheet_key) end