class Mhc::Sync::Status

status

Public Class Methods

new(uid, manager, wrapped_record = nil) click to toggle source
# File lib/mhc/sync/status.rb, line 7
def initialize(uid, manager, wrapped_record = nil)
  @uid, @manager, @wrapped_record = uid, manager, wrapped_record
end

Public Instance Methods

created?() click to toggle source
# File lib/mhc/sync/status.rb, line 35
def created?
  sync_status == :created
end
deleted?() click to toggle source
# File lib/mhc/sync/status.rb, line 47
def deleted?
  sync_status == :deleted
end
etag() click to toggle source
# File lib/mhc/sync/status.rb, line 15
def etag
  @manager.etag(@uid)
end
ex_etag() click to toggle source
# File lib/mhc/sync/status.rb, line 19
def ex_etag
  @manager.ex_etag(@uid)
end
mark_synced(etag = self.etag) click to toggle source
# File lib/mhc/sync/status.rb, line 51
def mark_synced(etag = self.etag)
  @manager.mark_synced(uid, etag)
  return self
end
modified?() click to toggle source
# File lib/mhc/sync/status.rb, line 31
def modified?
  sync_status == :modified
end
norecord?() click to toggle source
# File lib/mhc/sync/status.rb, line 43
def norecord?
  sync_status == :norecord
end
sync_status() click to toggle source
# File lib/mhc/sync/status.rb, line 23
def sync_status
  return :norecord   if !etag and !ex_etag
  return :created    if  etag and !ex_etag
  return :deleted    if !etag and  ex_etag
  return :unmodified if  etag ==   ex_etag
  return :modified   if  etag !=   ex_etag
end
to_ics_string() click to toggle source

as a calendar DB redord

# File lib/mhc/sync/status.rb, line 57
def to_ics_string
  # LastNote or mhc is assumed.
  if  @wrapped_record.respond_to?(:to_ics_string)
    result = @wrapped_record.to_ics_string
     return result
  end

  # HTTP::Response from caldav server is assumed.
  if @wrapped_record.respond_to?(:body)
    return @wrapped_record.body
  end

  return nil # Nil or unsupport object class. XXX donot put.
end
uid() click to toggle source
# File lib/mhc/sync/status.rb, line 11
def uid
  return @uid
end
unmodified?() click to toggle source
# File lib/mhc/sync/status.rb, line 39
def unmodified?
  sync_status == :unmodified
end