Class: RocketChat::Messages::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/rocket_chat/messages/settings.rb

Overview

Rocket.Chat Settings messages

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ Settings

Returns a new instance of Settings.

Parameters:



12
13
14
# File 'lib/rocket_chat/messages/settings.rb', line 12

def initialize(session)
  @session = session
end

Instance Method Details

#[](id) ⇒ various

settings get REST API

Parameters:

  • id (String)

    Setting id

Returns:

  • (various)

Raises:



22
23
24
25
26
27
28
# File 'lib/rocket_chat/messages/settings.rb', line 22

def [](id)
  response = session.request_json(
    "/api/v1/settings/#{id}"
  )

  response['value'] if response['success']
end

#[]=(id, value) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rocket_chat/messages/settings.rb', line 30

def []=(id, value)
  response = session.request_json(
    "/api/v1/settings/#{id}",
    method: :post,
    body: {
      value: value
    }
  )

  value if response['success']
end