diff --git a/lib/diaspora_federation.rb b/lib/diaspora_federation.rb
index ffd1cbd..81fdc93 100644
--- a/lib/diaspora_federation.rb
+++ b/lib/diaspora_federation.rb
@@ -1,3 +1,5 @@
+require "base64"
+
require "diaspora_federation/logging"
require "diaspora_federation/callbacks"
diff --git a/lib/diaspora_federation/entities.rb b/lib/diaspora_federation/entities.rb
index 3665875..e2748cc 100644
--- a/lib/diaspora_federation/entities.rb
+++ b/lib/diaspora_federation/entities.rb
@@ -10,3 +10,7 @@ end
require "diaspora_federation/entities/profile"
require "diaspora_federation/entities/person"
+require "diaspora_federation/entities/location"
+require "diaspora_federation/entities/photo"
+require "diaspora_federation/entities/status_message"
+require "diaspora_federation/entities/request"
diff --git a/lib/diaspora_federation/entities/location.rb b/lib/diaspora_federation/entities/location.rb
new file mode 100644
index 0000000..e16517e
--- /dev/null
+++ b/lib/diaspora_federation/entities/location.rb
@@ -0,0 +1,9 @@
+module DiasporaFederation
+ module Entities
+ class Location < Entity
+ property :address
+ property :lat
+ property :lng
+ end
+ end
+end
diff --git a/lib/diaspora_federation/entities/photo.rb b/lib/diaspora_federation/entities/photo.rb
new file mode 100644
index 0000000..a5b75fc
--- /dev/null
+++ b/lib/diaspora_federation/entities/photo.rb
@@ -0,0 +1,16 @@
+module DiasporaFederation
+ module Entities
+ class Photo < Entity
+ property :guid
+ property :diaspora_id, xml_name: :diaspora_handle
+ property :public, default: false
+ property :created_at, default: -> { Time.now.utc }
+ property :remote_photo_path
+ property :remote_photo_name
+ property :text, default: nil
+ property :status_message_guid
+ property :height
+ property :width
+ end
+ end
+end
diff --git a/lib/diaspora_federation/entities/request.rb b/lib/diaspora_federation/entities/request.rb
new file mode 100644
index 0000000..e54760b
--- /dev/null
+++ b/lib/diaspora_federation/entities/request.rb
@@ -0,0 +1,8 @@
+module DiasporaFederation
+ module Entities
+ class Request < Entity
+ property :sender_id, xml_name: :sender_handle
+ property :recipient_id, xml_name: :recipient_handle
+ end
+ end
+end
diff --git a/lib/diaspora_federation/entities/status_message.rb b/lib/diaspora_federation/entities/status_message.rb
new file mode 100644
index 0000000..22b56ee
--- /dev/null
+++ b/lib/diaspora_federation/entities/status_message.rb
@@ -0,0 +1,14 @@
+module DiasporaFederation
+ module Entities
+ class StatusMessage < Entity
+ property :raw_message
+ entity :photos, [Entities::Photo], default: []
+ entity :location, Entities::Location, default: nil
+ property :guid
+ property :diaspora_id, xml_name: :diaspora_handle
+ property :public, default: false
+ property :created_at, default: -> { Time.now.utc }
+ property :provider_display_name, default: nil
+ end
+ end
+end
diff --git a/spec/factories.rb b/spec/factories.rb
index ed7c60a..25fce9b 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -68,4 +68,23 @@ FactoryGirl.define do
nsfw false
tag_string "#i #love #tags"
end
+
+ factory :location_entity, class: DiasporaFederation::Entities::Location do
+ address "Vienna, Austria"
+ lat 48.208174.to_s
+ lng 16.373819.to_s
+ end
+
+ factory :photo_entity, class: DiasporaFederation::Entities::Photo do
+ guid
+ diaspora_id
+ public(true)
+ created_at { Time.zone.now }
+ remote_photo_path "https://diaspora.example.tld/uploads/images/"
+ remote_photo_name "f2a41e9d2db4d9a199c8.jpg"
+ text "what you see here..."
+ status_message_guid { guid }
+ height 480
+ width 800
+ end
end
diff --git a/spec/lib/diaspora_federation/entities/location_spec.rb b/spec/lib/diaspora_federation/entities/location_spec.rb
new file mode 100644
index 0000000..e8cd263
--- /dev/null
+++ b/spec/lib/diaspora_federation/entities/location_spec.rb
@@ -0,0 +1,19 @@
+module DiasporaFederation
+ describe Entities::Location do
+ let(:data) { FactoryGirl.attributes_for(:location_entity) }
+
+ let(:xml) {
+ <<-XML
+
+ #{data[:address]}
+ #{data[:lat]}
+ #{data[:lng]}
+
+ XML
+ }
+
+ it_behaves_like "an Entity subclass" do
+ let(:klass) { Entities::Location }
+ end
+ end
+end
diff --git a/spec/lib/diaspora_federation/entities/photo_spec.rb b/spec/lib/diaspora_federation/entities/photo_spec.rb
new file mode 100644
index 0000000..e07d5a3
--- /dev/null
+++ b/spec/lib/diaspora_federation/entities/photo_spec.rb
@@ -0,0 +1,26 @@
+module DiasporaFederation
+ describe Entities::Photo do
+ let(:data) { FactoryGirl.attributes_for(:photo_entity) }
+
+ let(:xml) {
+ <<-XML
+
+ #{data[:guid]}
+ #{data[:diaspora_id]}
+ #{data[:public]}
+ #{data[:created_at]}
+ #{data[:remote_photo_path]}
+ #{data[:remote_photo_name]}
+ #{data[:text]}
+ #{data[:status_message_guid]}
+ #{data[:height]}
+ #{data[:width]}
+
+ XML
+ }
+
+ it_behaves_like "an Entity subclass" do
+ let(:klass) { Entities::Photo }
+ end
+ end
+end
diff --git a/spec/lib/diaspora_federation/entities/request_spec.rb b/spec/lib/diaspora_federation/entities/request_spec.rb
new file mode 100644
index 0000000..f142ed6
--- /dev/null
+++ b/spec/lib/diaspora_federation/entities/request_spec.rb
@@ -0,0 +1,21 @@
+module DiasporaFederation
+ describe Entities::Request do
+ let(:data) {
+ {sender_id: "alice@somepod.org",
+ recipient_id: "bob@otherpod.net"}
+ }
+
+ let(:xml) {
+ <<-XML
+
+ alice@somepod.org
+ bob@otherpod.net
+
+ XML
+ }
+
+ it_behaves_like "an Entity subclass" do
+ let(:klass) { Entities::Request }
+ end
+ end
+end
diff --git a/spec/lib/diaspora_federation/entities/status_message_spec.rb b/spec/lib/diaspora_federation/entities/status_message_spec.rb
new file mode 100644
index 0000000..08bfa74
--- /dev/null
+++ b/spec/lib/diaspora_federation/entities/status_message_spec.rb
@@ -0,0 +1,65 @@
+module DiasporaFederation
+ describe Entities::StatusMessage do
+ let(:photo1) { Entities::Photo.new(FactoryGirl.attributes_for(:photo_entity)) }
+ let(:photo2) { Entities::Photo.new(FactoryGirl.attributes_for(:photo_entity)) }
+ let(:location) { Entities::Location.new(FactoryGirl.attributes_for(:location_entity)) }
+ let(:data) {
+ {
+ raw_message: "this is such an interesting text",
+ photos: [photo1, photo2],
+ location: location,
+ guid: FactoryGirl.generate(:guid),
+ diaspora_id: FactoryGirl.generate(:diaspora_id),
+ public: true,
+ created_at: Time.zone.now,
+ provider_display_name: "something"
+ }
+ }
+
+ let(:xml) {
+ <<-XML
+
+ #{data[:raw_message]}
+
+ #{photo1.guid}
+ #{photo1.diaspora_id}
+ #{photo1.public}
+ #{photo1.created_at}
+ #{photo1.remote_photo_path}
+ #{photo1.remote_photo_name}
+ #{photo1.text}
+ #{photo1.status_message_guid}
+ #{photo1.height}
+ #{photo1.width}
+
+
+ #{photo2.guid}
+ #{photo2.diaspora_id}
+ #{photo2.public}
+ #{photo2.created_at}
+ #{photo2.remote_photo_path}
+ #{photo2.remote_photo_name}
+ #{photo2.text}
+ #{photo2.status_message_guid}
+ #{photo2.height}
+ #{photo2.width}
+
+
+ #{location.address}
+ #{location.lat}
+ #{location.lng}
+
+ #{data[:guid]}
+ #{data[:diaspora_id]}
+ #{data[:public]}
+ #{data[:created_at]}
+ #{data[:provider_display_name]}
+
+ XML
+ }
+
+ it_behaves_like "an Entity subclass" do
+ let(:klass) { Entities::StatusMessage }
+ end
+ end
+end