Module: ShareNotify::Metadata

Extended by:
ActiveSupport::Concern
Defined in:
lib/share_notify/metadata.rb

Overview

Queries the SHARE search api for an existing record. This assumes the class into which this module is included responds to #url and that in turn is mapped to the docID of the Share document that was originally uploaded via the SHARE push API.

Instance Method Summary collapse

Instance Method Details

#callObject



13
14
15
# File 'lib/share_notify/metadata.rb', line 13

def call
  api.search("shareProperties.docID:\"#{url}\"")
end

#share_notified?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/share_notify/metadata.rb', line 7

def share_notified?
  return if response.status != 200
  return false if response.count < 1
  response.docs.first.doc_id == url
end