diff --git a/lib/diaspora_federation/entities.rb b/lib/diaspora_federation/entities.rb index 763a790..c7f33c0 100644 --- a/lib/diaspora_federation/entities.rb +++ b/lib/diaspora_federation/entities.rb @@ -46,6 +46,3 @@ require "diaspora_federation/entities/message" require "diaspora_federation/entities/conversation" require "diaspora_federation/entities/retraction" - -# deprecated -require "diaspora_federation/entities/request" diff --git a/lib/diaspora_federation/entities/request.rb b/lib/diaspora_federation/entities/request.rb deleted file mode 100644 index 6627f36..0000000 --- a/lib/diaspora_federation/entities/request.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module DiasporaFederation - module Entities - # This entity represents a sharing request for a user. A user issues it - # when they start sharing with another user. - # - # @see Validators::RequestValidator - # @deprecated will be replaced with {Contact} - class Request < Entity - # @!attribute [r] author - # The diaspora* ID of the person who share their profile - # @see Person#author - # @return [String] sender ID - property :author, :string, xml_name: :sender_handle - - # @!attribute [r] recipient - # The diaspora* ID of the person who will be shared with - # @see Validation::Rule::DiasporaId - # @return [String] recipient ID - property :recipient, :string, xml_name: :recipient_handle - - def initialize(*) - raise "Sending Request is not supported anymore! Use Contact instead!" - end - - # @return [Retraction] instance - def self.from_hash(hash) - Contact.new(hash) - end - end - end -end diff --git a/spec/lib/diaspora_federation/entities/request_spec.rb b/spec/lib/diaspora_federation/entities/request_spec.rb deleted file mode 100644 index 0d07035..0000000 --- a/spec/lib/diaspora_federation/entities/request_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module DiasporaFederation - describe Entities::Request do - let(:data) { {author: Fabricate.sequence(:diaspora_id), recipient: Fabricate.sequence(:diaspora_id)} } - - let(:xml) { <<~XML } - - #{data[:author]} - #{data[:recipient]} - - XML - - describe "#initialize" do - it "raises because it is not supported anymore" do - expect { - Entities::Request.new(data) - }.to raise_error RuntimeError, "Sending Request is not supported anymore! Use Contact instead!" - end - end - - context "parse contact" do - it "parses the xml as a contact" do - contact = Entities::Request.from_xml(Nokogiri::XML(xml).root) - expect(contact).to be_a(Entities::Contact) - expect(contact.author).to eq(data[:author]) - expect(contact.recipient).to eq(data[:recipient]) - expect(contact.following).to be_truthy - expect(contact.sharing).to be_truthy - end - end - end -end