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



37
38
39
# File 'lib/ostatus/entry.rb', line 37

def activity
  Activity.new(self)
end

#activity=(value) ⇒ Object



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

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.



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

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


68
69
70
# File 'lib/ostatus/entry.rb', line 68

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

#link=(options) ⇒ Object



72
73
74
# File 'lib/ostatus/entry.rb', line 72

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

#urlObject



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

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



64
65
66
# File 'lib/ostatus/entry.rb', line 64

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