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



25
26
27
# File 'lib/ostatus/entry.rb', line 25

def activity
  Activity.new(self)
end

#activity=(value) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ostatus/entry.rb', line 29

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
  activity_object_type = "HEY"
end

#infoObject

Returns a Hash of all fields.



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ostatus/entry.rb', line 66

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


57
58
59
# File 'lib/ostatus/entry.rb', line 57

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

#link=(options) ⇒ Object



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

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

#urlObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ostatus/entry.rb', line 41

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



53
54
55
# File 'lib/ostatus/entry.rb', line 53

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