Class: ShareNotify::PushDocument
- Inherits:
-
Object
- Object
- ShareNotify::PushDocument
- Defined in:
- lib/share_notify/push_document.rb
Defined Under Namespace
Classes: ShareUri
Instance Attribute Summary collapse
-
#contributors ⇒ Object
readonly
Returns the value of attribute contributors.
-
#providerUpdatedDateTime ⇒ Object
readonly
Returns the value of attribute providerUpdatedDateTime.
-
#title ⇒ Object
Returns the value of attribute title.
-
#uris ⇒ Object
readonly
Returns the value of attribute uris.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #add_contributor(contributor) ⇒ Object
-
#initialize(uri) ⇒ PushDocument
constructor
A new instance of PushDocument.
- #to_share ⇒ Object
- #updated ⇒ Object
- #updated=(time) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(uri) ⇒ PushDocument
Returns a new instance of PushDocument.
7 8 9 10 11 |
# File 'lib/share_notify/push_document.rb', line 7 def initialize(uri) @uris = ShareUri.new(uri) @providerUpdatedDateTime = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ") @contributors = [] end |
Instance Attribute Details
#contributors ⇒ Object (readonly)
Returns the value of attribute contributors.
3 4 5 |
# File 'lib/share_notify/push_document.rb', line 3 def contributors @contributors end |
#providerUpdatedDateTime ⇒ Object (readonly)
Returns the value of attribute providerUpdatedDateTime.
3 4 5 |
# File 'lib/share_notify/push_document.rb', line 3 def providerUpdatedDateTime @providerUpdatedDateTime end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/share_notify/push_document.rb', line 4 def title @title end |
#uris ⇒ Object (readonly)
Returns the value of attribute uris.
3 4 5 |
# File 'lib/share_notify/push_document.rb', line 3 def uris @uris end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/share_notify/push_document.rb', line 3 def version @version end |
Instance Method Details
#add_contributor(contributor) ⇒ Object
33 34 35 36 |
# File 'lib/share_notify/push_document.rb', line 33 def add_contributor(contributor) return false unless contributor.keys.include?(:name) @contributors << contributor end |
#to_share ⇒ Object
38 39 40 |
# File 'lib/share_notify/push_document.rb', line 38 def to_share { jsonData: self } end |
#updated ⇒ Object
17 18 19 |
# File 'lib/share_notify/push_document.rb', line 17 def updated @providerUpdatedDateTime end |
#updated=(time) ⇒ Object
22 23 24 25 |
# File 'lib/share_notify/push_document.rb', line 22 def updated=(time) return unless time.respond_to?(:strftime) @providerUpdatedDateTime = time.utc.strftime("%Y-%m-%dT%H:%M:%SZ") end |
#valid? ⇒ Boolean
13 14 15 |
# File 'lib/share_notify/push_document.rb', line 13 def valid? !(title.nil? || contributors.empty?) end |