Class: Oksky::Chat::Object::RoomsResource

Inherits:
Base
  • Object
show all
Defined in:
lib/oksky/chat/object/rooms_resource.rb

Direct Known Subclasses

ProviderRoomsResource

Instance Method Summary collapse

Methods inherited from Base

#[], #initialize

Constructor Details

This class inherits a constructor from Oksky::Chat::Object::Base

Instance Method Details

#awaiting_supportTime<Oksky::Chat::Event::Room>

Returns:

  • (Time<Oksky::Chat::Event::Room>)


58
59
60
# File 'lib/oksky/chat/object/rooms_resource.rb', line 58

def awaiting_support
  content_value("awaiting_support")
end

#client_idObject



98
99
100
# File 'lib/oksky/chat/object/rooms_resource.rb', line 98

def client_id
  @src.dig("relationships", "client", "data", "id")
end

#create_user_idObject



94
95
96
# File 'lib/oksky/chat/object/rooms_resource.rb', line 94

def create_user_id
  @src.dig("relationships", "create_user", "data", "id")
end

#created_atTime<Oksky::Chat::Event::Room>

Returns:

  • (Time<Oksky::Chat::Event::Room>)


68
69
70
# File 'lib/oksky/chat/object/rooms_resource.rb', line 68

def created_at
  content_value("created_at")
end

#created_at_unixTime<Oksky::Chat::Event::Room>

Returns:

  • (Time<Oksky::Chat::Event::Room>)


63
64
65
# File 'lib/oksky/chat/object/rooms_resource.rb', line 63

def created_at_unix
  content_value("created_at_unix")
end

#descriptionHash<Oksky::Chat::Event::Room>

Returns:

  • (Hash<Oksky::Chat::Event::Room>)


33
34
35
# File 'lib/oksky/chat/object/rooms_resource.rb', line 33

def description
  content_value("description")
end

#enabledTime<Oksky::Chat::Event::Room>

Returns:

  • (Time<Oksky::Chat::Event::Room>)


48
49
50
# File 'lib/oksky/chat/object/rooms_resource.rb', line 48

def enabled
  content_value("enabled")
end

#helped_room_idObject



102
103
104
# File 'lib/oksky/chat/object/rooms_resource.rb', line 102

def helped_room_id
  @src.dig("relationships", "helped_room", "data", "id")
end

#idObject



14
15
16
# File 'lib/oksky/chat/object/rooms_resource.rb', line 14

def id
  @src.dig("id")
end

#is_externalBoolean<Oksky::Chat::Event::Room>

Returns:

  • (Boolean<Oksky::Chat::Event::Room>)


78
79
80
# File 'lib/oksky/chat/object/rooms_resource.rb', line 78

def is_external
  content_value("is_external")
end

#is_privateString<Oksky::Chat::Event::Room>

Returns:

  • (String<Oksky::Chat::Event::Room>)


38
39
40
# File 'lib/oksky/chat/object/rooms_resource.rb', line 38

def is_private
  content_value("is_private")
end

#kindString<Oksky::Chat::Event::RoomKind::>

Returns:

  • (String<Oksky::Chat::Event::RoomKind::>)


24
25
26
27
28
29
30
# File 'lib/oksky/chat/object/rooms_resource.rb', line 24

def kind
  begin
    Oksky::Chat::Event::RoomsResourceKind.const_get(content_value("kind").split("_").map{|w| w[0] = w[0].capitalize; w}.join)
  rescue NameError => e
    Oksky::Chat::Event::RoomsResourceKind::Unsupport
  end
end

#nameString<Oksky::Chat::Event::Room>

Returns:

  • (String<Oksky::Chat::Event::Room>)


19
20
21
# File 'lib/oksky/chat/object/rooms_resource.rb', line 19

def name
  content_value('name')
end

#relationshipsObject



106
107
108
109
110
111
112
# File 'lib/oksky/chat/object/rooms_resource.rb', line 106

def relationships
  if exist_relationships?
    return @src['relationships']
  else
    {}
  end
end

#roomObject



82
83
84
85
86
87
88
# File 'lib/oksky/chat/object/rooms_resource.rb', line 82

def room
  if @src.has_key?('attributes')
    @src['attributes']
  else
    @src
  end
end

#room_codeTime<Oksky::Chat::Event::Room>

Returns:

  • (Time<Oksky::Chat::Event::Room>)


53
54
55
# File 'lib/oksky/chat/object/rooms_resource.rb', line 53

def room_code
  content_value("room_code")
end

#settingsHash<Oksky::Chat::Event::Room>

Returns:

  • (Hash<Oksky::Chat::Event::Room>)


43
44
45
# File 'lib/oksky/chat/object/rooms_resource.rb', line 43

def settings
  content_value("info")
end

#support_group_idObject



90
91
92
# File 'lib/oksky/chat/object/rooms_resource.rb', line 90

def support_group_id
  @src.dig("relationships", "relationships", "data", "id")
end

#unread_message_countString<Oksky::Chat::Event::Room>

Returns:

  • (String<Oksky::Chat::Event::Room>)


73
74
75
# File 'lib/oksky/chat/object/rooms_resource.rb', line 73

def unread_message_count
  content_value("unread_message_count")
end