diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-02-22 16:00:20 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-02-22 16:00:20 +0100 |
commit | 709c6685a90bb819696566cc9e42e587546d72dc (patch) | |
tree | 272783009e0a0c8b13b8003dc4bc4e58f3b0b84b /app/views/atom/user_stream.xml.ruby | |
parent | 9c4856bdb11fc9311ab30a97224cee3dfaec492f (diff) |
Made some progress
Diffstat (limited to 'app/views/atom/user_stream.xml.ruby')
-rw-r--r-- | app/views/atom/user_stream.xml.ruby | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/app/views/atom/user_stream.xml.ruby b/app/views/atom/user_stream.xml.ruby new file mode 100644 index 000000000..d418ea0ec --- /dev/null +++ b/app/views/atom/user_stream.xml.ruby @@ -0,0 +1,35 @@ +Nokogiri::XML::Builder.new do |xml| + xml.feed(xmlns: 'http://www.w3.org/2005/Atom', 'xmlns:thr': 'http://purl.org/syndication/thread/1.0', 'xmlns:activity': 'http://activitystrea.ms/spec/1.0/') do + xml.id_ atom_user_stream_url(id: @account.id) + xml.title @account.display_name + xml.subtitle @account.note + xml.updated stream_updated_at + + xml.author do + xml['activity'].send('object-type', 'http://activitystrea.ms/schema/1.0/person') + xml.uri profile_url(name: @account.username) + xml.name @account.username + xml.summary @account.note + + xml.link(rel: 'alternate', type: 'text/html', href: profile_url(name: @account.username)) + end + + xml.link(rel: 'alternate', type: 'text/html', href: profile_url(name: @account.username)) + xml.link(rel: 'hub', href: '') + xml.link(rel: 'salmon', href: salmon_url(@account)) + xml.link(rel: 'self', type: 'application/atom+xml', href: atom_user_stream_url(id: @account.id)) + + @account.stream_entries.each do |stream_entry| + xml.entry do + xml.id_ unique_tag(stream_entry.created_at, stream_entry.activity_id, stream_entry.activity_type) + xml.published stream_entry.activity.created_at.iso8601 + xml.updated stream_entry.activity.updated_at.iso8601 + xml.content({ type: 'html' }, stream_entry.content) + xml.title + + xml['activity'].send('verb', "http://activitystrea.ms/schema/1.0/#{stream_entry.verb}") + xml['activity'].send('object-type', "http://activitystrea.ms/schema/1.0/#{stream_entry.object_type}") + end + end + end +end.to_xml |