Class: FaspClient::EventSubscription
Constant Summary
ApplicationRecord::CATEGORIES
Instance Method Summary
collapse
Instance Method Details
#announce_lifecycle(event_type:, uri:) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/models/fasp_client/event_subscription.rb', line 10
def announce_lifecycle(event_type:, uri:)
return if subscription_type != "lifecycle"
Rails.logger.debug("Announcing #{subscription_type} event: #{event_type} #{category} #{uri}")
request = Net::HTTP::Post.new(URI(fasp_client_provider.base_url + "/data_sharing/v0/announcements"))
request.body = {
source: {
subscription: {
id: id.to_s
}
},
category: category,
eventType: event_type,
objectUris: [ uri ]
}.to_json
request.content_type = "application/json"
HttpRequestService.new(provider: fasp_client_provider).execute!(request)
end
|