module SocialStream::Ostatus::Models::Actor

Public Instance Methods

actor_key!() click to toggle source

Fetch or create the associated {ActorKey}

# File lib/social_stream/ostatus/models/actor.rb, line 41
def actor_key!
  actor_key ||
    create_actor_key!
end
magic_public_key() click to toggle source

MagicKey string from public key

# File lib/social_stream/ostatus/models/actor.rb, line 65
def magic_public_key
  Proudhon::MagicKey.to_s rsa_public_key
end
publish_feed() click to toggle source
# File lib/social_stream/ostatus/models/actor.rb, line 69
def publish_feed
  return if subject_type == "RemoteSubject"

  # FIXME: Rails 4 queues
  Thread.new do
    uri = URI.parse(SocialStream::Ostatus.hub)
    topic = polymorphic_url [subject, :activities],
                            :format => :atom,
                            :host => SocialStream::Ostatus.activity_feed_host
    
    response = Net::HTTP::post_form uri, { 'hub.mode' => 'publish',
                                           'hub.url'  => topic }
    #TODO: process 4XX look at: response.status

    ActiveRecord::Base.connection.close
  end
end
rsa_key() click to toggle source

OpenSSL::PKey::RSA key

The key is generated if it does not exist

# File lib/social_stream/ostatus/models/actor.rb, line 49
def rsa_key
  actor_key!.key
end
rsa_key=(key) click to toggle source

Set OpenSSL::PKey::RSA key

# File lib/social_stream/ostatus/models/actor.rb, line 54
def rsa_key= key
  k = actor_key || build_actor_key
  k.key = key
end
rsa_public_key() click to toggle source

Public RSA instance of {#rsa_key}

# File lib/social_stream/ostatus/models/actor.rb, line 60
def rsa_public_key
  rsa_key.public_key
end
webfinger_id() click to toggle source

The Webfinger ID for this {Actor}

# File lib/social_stream/ostatus/models/actor.rb, line 31
def webfinger_id
  "#{ slug }@#{ SocialStream::Ostatus.activity_feed_host }"
end
webfinger_uri() click to toggle source

The Webfinger URI for this {Actor}

# File lib/social_stream/ostatus/models/actor.rb, line 36
def webfinger_uri
  "acct:#{ webfinger_id }"
end