class FaceGroups::Posting

Single posting on group's feed

Attributes

attachment[R]
created_time[R]
id[R]
message[R]
name[R]
updated_time[R]

Public Class Methods

find(id:) click to toggle source
# File lib/facegroups/posting.rb, line 14
def self.find(id:)
  posting_data = FaceGroups::FbApi.posting_data(id)
  posting_data.keys.include?('error') ? nil : new(data: posting_data)
end
new(data: nil) click to toggle source
# File lib/facegroups/posting.rb, line 10
def initialize(data: nil)
  load_data(data)
end

Private Instance Methods

load_data(posting_data) click to toggle source
# File lib/facegroups/posting.rb, line 21
def load_data(posting_data)
  @id = posting_data['id']
  @updated_time = posting_data['updated_time']
  @created_time = posting_data['created_time']
  @name = posting_data['message']
  @message = posting_data['message']
  attached = posting_data['attachments']
  @attachment = Attachment.new(attached) if attached
end