class GNUSocial::Notice

Represents a status or activity

Attributes

created_at[R]
id[R]
source[R]
text[R]
uri[R]

Public Class Methods

new(data) click to toggle source

Parses and create a new Notice object from data

# File lib/gsruby.rb, line 248
def initialize(data)
    data.each do |key, value|
        case key
            when "created_at" then set_time(value)
            else instance_variable_set(:"@#{key}",value)
        end
    end
end

Public Instance Methods

author() click to toggle source
# File lib/gsruby.rb, line 266
def author
    @user["name"]
end
html() click to toggle source
# File lib/gsruby.rb, line 286
def html
    @statusnet_html
end
is_reply?() click to toggle source
# File lib/gsruby.rb, line 270
def is_reply?
    @in_reply_to_status_id != nil
end
reply_to() click to toggle source
# File lib/gsruby.rb, line 274
def reply_to
    @in_reply_to_status_id
end
reply_to_name() click to toggle source
# File lib/gsruby.rb, line 278
def reply_to_name
    @in_reply_to_screen_name
end
reply_to_userid() click to toggle source
# File lib/gsruby.rb, line 282
def reply_to_userid
    @in_reply_to_user_id
end
set_time(at) click to toggle source
# File lib/gsruby.rb, line 261
def set_time(at)
    /\w{3} (?<mo>\w{3}) (?<d>\d+) (?<h>\d+):(?<m>\d+):(?<s>\d+) \+\d+ (?<y>\d+)/ =~ at
    @created_at = Time.utc(y,mo,d,h,m,s).getlocal
end
to_s() click to toggle source
# File lib/gsruby.rb, line 257
def to_s
    "#{@text} by #{@user["name"]} at #{@created_at} ID [#{@id}]"
end