Sha256: b2e74d7938d16705a23df01b7b403709ab1f74e45674dcf0a15b97fba33041b2

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

class RemoteSubject < ActiveRecord::Base
  attr_accessible :name, :webfinger_slug, :hub_url, :origin_node_url
  
  #validates_format_of :webfinger_slug, :with => Devise.email_regexp, :allow_blank => true
  
  class << self
    def find_or_create_using_wslug(slug)
      r_user = RemoteSubject.find_by_webfinger_slug(slug)
      if r_user == nil
        wfslug = slug.split('@')
        r_user = RemoteSubject.create!(:name => wfslug[0], 
                                    :webfinger_slug => slug,
                                    :origin_node_url => wfslug[1],
                                    :hub_url => Social2social.hub)
      end
      r_user
    end
  end
  
  #Home feed url for this RemoteUser
  def home_feed_url
    "http://"+origin_node_url.to_s+"/api/user/"+name.to_s+"/home.atom"                       
  end
  
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
social2social-0.0.4 app/models/remote_subject.rb
social2social-0.0.3 app/models/remote_subject.rb