Class: OStatus::Entry

Inherits:
Atom::Entry
  • Object
show all
Includes:
Atom::SimpleExtensions
Defined in:
lib/ostatus/entry.rb

Overview

Holds information about an individual entry in the Feed.

Instance Method Summary collapse

Instance Method Details

#activityObject



35
36
37
# File 'lib/ostatus/entry.rb', line 35

def activity
  Activity.new(self)
end

#activity=(value) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/ostatus/entry.rb', line 39

def activity= value
  if value.object_type
    self.activity_object_type = OStatus::Activity::SCHEMA_ROOT + value.object_type.to_s
  end
  self.activity_object = value.activity_object if value.object
  if value.verb
    self.activity_verb = OStatus::Activity::SCHEMA_ROOT + value.activity_verb.to_s
  end
  self.activity_target = value.activity_target if value.target
end

#infoObject

Returns a Hash of all fields.



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/ostatus/entry.rb', line 75

def info
  {
    :activity => self.activity.info,
    :id => self.id,
    :title => self.title,
    :content => self.content,
    :link => self.link,
    :published => self.published,
    :updated => self.updated
  }
end


66
67
68
# File 'lib/ostatus/entry.rb', line 66

def link
  links.group_by { |l| l.rel.intern }
end

#link=(options) ⇒ Object



70
71
72
# File 'lib/ostatus/entry.rb', line 70

def link= options
  links.clear << Atom::Link.new(options)
end

#urlObject



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ostatus/entry.rb', line 50

def url
  if links.alternate
    links.alternate.href
  elsif links.self
    links.self.href
  else
    links.map.each do |l|
      l.href
    end.compact.first
  end
end

#url=(value) ⇒ Object



62
63
64
# File 'lib/ostatus/entry.rb', line 62

def url= value
  links << Atom::Link.new(:rel => "alternate", :href => value)
end