Class: DistributionWrappers::Backstitch
- Inherits:
-
Base
- Object
- Base
- DistributionWrappers::Backstitch
show all
- Defined in:
- lib/distribution_wrappers/backstitch/backstitch.rb
Instance Attribute Summary
Attributes inherited from Base
#params
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/distribution_wrappers/backstitch/backstitch.rb', line 21
def get_contacts
channel = DistributionChannelDistro.find @params[:channel_id]
user = UserDistro.find(channel.owner_id)
feeds = user.managed_feeds
csv_string = ""
feeds.each_with_index do |feed, index|
csv_string += CSV.generate_line [feed.name, feed.feed_id, '{"url": null}', 'feed', @params[:channel_id]]
if index % 100 == 0
@params[:temp_file].write(csv_string)
csv_string = ""
end
end
@params[:temp_file].write(csv_string)
return true
end
|
#send_message(recipient) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/distribution_wrappers/backstitch/backstitch.rb', line 4
def send_message(recipient)
super
@response = Semantic::OrganizationResults::Article.bulk_store([@message], true, true)
results = []
@version_contact.channel_entity_identifier = @message[:reference_id]
@version_contact.save
feed = FeedDistro.find(recipient['identifier'].to_i)
if feed.params["priority_alerts"] && @message
pushwoosh_id = feed.owner.pushwoosh_id if feed.owner_type == "Organization" && feed.owner.pushwoosh_id
organization_id = feed.owner.id if feed.owner && feed.owner_type == "Organization"
send_notifications(@message, feed.id, organization_id, pushwoosh_id)
end
end
|