Class: YammerApi::Post
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#attachment ⇒ Object
Hashie::Mash.
-
#posted_at ⇒ Object
Time.
-
#recipient ⇒ Object
YammerApi::User.
-
#text ⇒ Object
String.
-
#user ⇒ Object
YammerApi::User.
Methods inherited from Base
#[], #initialize, lazy_attr_reader
Constructor Details
This class inherits a constructor from YammerApi::Base
Instance Method Details
#attachment ⇒ Object
Returns Hashie::Mash.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/yammer_api/post.rb', line 7 def = @attrs['attachments'].first if if ['type'] == "image" @attachment ||= Mash.new(type: "image", id: ["id"], image_url: .fetch("image", {"url" => ""}).fetch("url")) else @attachment ||= Mash.new(type: ['type'], name: ['name'], id: ["id"], image_url: ["large_icon_url"], url: ["download_url"]) end end end |
#posted_at ⇒ Object
Returns Time.
19 20 21 22 |
# File 'lib/yammer_api/post.rb', line 19 def posted_at #puts @attrs['created_at'] @posted_at ||= Time.parse(@attrs['created_at']).utc unless @attrs['created_at'].nil? end |
#recipient ⇒ Object
Returns YammerApi::User.
35 36 37 |
# File 'lib/yammer_api/post.rb', line 35 def recipient @recipient ||= YammerApi::User.new(@attrs['recipient']) if @attrs['recipient'] end |
#text ⇒ Object
Returns String.
25 26 27 |
# File 'lib/yammer_api/post.rb', line 25 def text @text ||= @attrs['body']['plain'] if @attrs['body'] && @attrs['body']['plain'] end |