class ShareNotify::PushDocument

Attributes

contributors[R]
description[RW]
languages[R]
otherProperties[R]
providerUpdatedDateTime[R]
publisher[R]
tags[R]
title[RW]
uris[R]
version[R]

Public Class Methods

new(uri, datetime = nil) click to toggle source

@param [String] uri that identifies the resource

# File lib/share_notify/push_document.rb, line 14
def initialize(uri, datetime = nil)
  datetime = (datetime.is_a?(Time) || datetime.is_a?(DateTime)) ? datetime : Time.now
  @uris = ShareUri.new(uri)
  @providerUpdatedDateTime = datetime.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
  @contributors = []
end

Public Instance Methods

add_contributor(contributor) click to toggle source

@param [Hash] contributor containing required keys for description

# File lib/share_notify/push_document.rb, line 41
def add_contributor(contributor)
  return false unless contributor.keys.include?(:name)
  @contributors << contributor
end
delete() click to toggle source
# File lib/share_notify/push_document.rb, line 68
def delete
  @otherProperties = [OtherProperty.new("status", status: ["deleted"])]
end
languages=(languages) click to toggle source

@param [Array<String>] languages list of languages

# File lib/share_notify/push_document.rb, line 53
def languages=(languages)
  return false unless languages.is_a?(Array)
  @languages = languages
end
publisher=(publisher) click to toggle source

@param [Hash] publisher containing required keys for publisher

# File lib/share_notify/push_document.rb, line 47
def publisher=(publisher)
  return false unless publisher.keys.include?(:name)
  @publisher = publisher
end
tags=(tags) click to toggle source

@param [Array<String>] tags list of tags

# File lib/share_notify/push_document.rb, line 59
def tags=(tags)
  return false unless tags.is_a?(Array)
  @tags = tags
end
to_share() click to toggle source
# File lib/share_notify/push_document.rb, line 64
def to_share
  { jsonData: self }
end
updated() click to toggle source
# File lib/share_notify/push_document.rb, line 25
def updated
  @providerUpdatedDateTime
end
updated=(time) click to toggle source

@param [DateTime or Time] time object that can be formatted in to the correct representation

# File lib/share_notify/push_document.rb, line 30
def updated=(time)
  return unless time.respond_to?(:strftime)
  @providerUpdatedDateTime = time.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
end
valid?() click to toggle source
# File lib/share_notify/push_document.rb, line 21
def valid?
  !(title.nil? || contributors.empty?)
end
version=(version) click to toggle source

@param [String] version identifying the version of the resource

# File lib/share_notify/push_document.rb, line 36
def version=(version)
  @version = { versionId: version }
end