Class: DiasporaLinkService

Inherits:
Object
  • Object
show all
Defined in:
app/services/diaspora_link_service.rb

Overview

Encapsulates logic of processing diaspora:// links

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(link) ⇒ DiasporaLinkService

Returns a new instance of DiasporaLinkService.


7
8
9
10
# File 'app/services/diaspora_link_service.rb', line 7

def initialize(link)
  @link = link.dup
  parse
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author


5
6
7
# File 'app/services/diaspora_link_service.rb', line 5

def author
  @author
end

#guidObject (readonly)

Returns the value of attribute guid


5
6
7
# File 'app/services/diaspora_link_service.rb', line 5

def guid
  @guid
end

#typeObject (readonly)

Returns the value of attribute type


5
6
7
# File 'app/services/diaspora_link_service.rb', line 5

def type
  @type
end

Instance Method Details

#find_or_fetch_entityObject


12
13
14
15
16
17
18
# File 'app/services/diaspora_link_service.rb', line 12

def find_or_fetch_entity
  if type && guid
    entity_finder.find || fetch_entity
  elsif author
    find_or_fetch_person
  end
end