Class: ShareNotify::NotificationQueryService
- Inherits:
-
Object
- Object
- ShareNotify::NotificationQueryService
- Defined in:
- lib/share_notify/notification_query_service.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
-
#initialize(context) ⇒ NotificationQueryService
constructor
A new instance of NotificationQueryService.
- #share_notified? ⇒ Boolean
Constructor Details
#initialize(context) ⇒ NotificationQueryService
Returns a new instance of NotificationQueryService.
10 11 12 |
# File 'lib/share_notify/notification_query_service.rb', line 10 def initialize(context) self.context = context end |
Instance Method Details
#share_notified? ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/share_notify/notification_query_service.rb', line 14 def share_notified? response = search("shareProperties.docID:\"#{context.url}\"") return if response.status != 200 return false if response.count < 1 response.docs.first.doc_id == context.url end |