Class: Xing::Activity

Inherits:
Base
  • Object
show all
Defined in:
lib/xing/activity.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#[], #initialize, lazy_attr_reader

Constructor Details

This class inherits a constructor from Xing::Base

Instance Method Details

Returns String.

Returns:

  • String



6
7
8
# File 'lib/xing/activity.rb', line 6

def link
  @link ||= @attrs["permalink"] unless @attrs["permalink"].nil?
end

Returns String.

Returns:

  • String



11
12
13
# File 'lib/xing/activity.rb', line 11

def link_desc
  @name ||= @attrs["name"].nil? ? @attrs["display_name"] : @attrs["name"]
end

#objectObject



15
16
17
18
19
20
# File 'lib/xing/activity.rb', line 15

def object
  name = @attrs["type"].camelize
  if Xing.const_defined?(name)
    @object ||= Xing.const_get(name).new(@attrs)
  end
end

#textObject

Returns String.

Returns:

  • String



23
24
25
26
27
28
29
# File 'lib/xing/activity.rb', line 23

def text
  @text ||= case @attrs["type"]
              when "status" then @attrs["content"]
              when "bookmark" then @attrs["description"]
              else nil
            end
end