Class: HipTail::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/hiptail/atom.rb

Direct Known Subclasses

Notification, Talk

Defined Under Namespace

Classes: Notification, Talk

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Message

Returns a new instance of Message.



55
56
57
# File 'lib/hiptail/atom.rb', line 55

def initialize(params)
  @raw = params.dup
end

Instance Attribute Details

#dateTime (readonly)

Returns:

  • (Time)


67
68
69
70
# File 'lib/hiptail/atom.rb', line 67

def date
  @date ||= Time.parse(@raw['date'])
  @date
end

#fromHipTail::User (readonly)

Returns:



74
75
76
77
# File 'lib/hiptail/atom.rb', line 74

def from
  @from ||= User.create(@raw['from'])
  @from
end

#idString (readonly)

Returns:

  • (String)


61
62
63
# File 'lib/hiptail/atom.rb', line 61

def id
  @raw['id']
end

#is_notification?Boolean (readonly)

Returns:

  • (Boolean)


104
105
106
# File 'lib/hiptail/atom.rb', line 104

def is_notification?
  false
end

#is_talk?Boolean (readonly)

Returns:

  • (Boolean)


99
100
101
# File 'lib/hiptail/atom.rb', line 99

def is_talk?
  false
end

#mentionsArray (readonly)

Returns Array of HipTail::User.

Returns:

  • (Array)

    Array of HipTail::User.



81
82
83
84
# File 'lib/hiptail/atom.rb', line 81

def mentions
  @mentions ||= (@raw['mentions'] || []).map { |data| User.create(data) }
  @mentions
end

#messageString (readonly)

Returns:

  • (String)


88
89
90
# File 'lib/hiptail/atom.rb', line 88

def message
  @raw['message']
end

#rawObject (readonly)

Returns the value of attribute raw.



53
54
55
# File 'lib/hiptail/atom.rb', line 53

def raw
  @raw
end

#textString (readonly)

Returns:

  • (String)


94
95
96
# File 'lib/hiptail/atom.rb', line 94

def text
  message
end