rocketchat 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac447ec59a2cd4858ce06737a597577f1536fb86
4
- data.tar.gz: b7d860d2d1118d6a2e694e90f6118aa061018434
3
+ metadata.gz: 63e5c3e6c2532784d89443021ab60e3cdcd7f6a9
4
+ data.tar.gz: bd1d984b6706dad200ca49dde43c56de337bb4b2
5
5
  SHA512:
6
- metadata.gz: 1bfd1e5f79ac35ad403164f11d88876873c709b1b6bfe660fe8fb7eb00e6114345ca62bac956528edbf0b96ffdd2cef517d53d40e7cafd9057978da3564e1cc2
7
- data.tar.gz: cf974f96c266e81049f977a42814477cfa2b7cf48ce63f42cac340f21fc3e8a7a1ac46ff692dda360859af4dc1ad1be839b66f9d9700717dc7a2ca78d530d40f
6
+ metadata.gz: c7d31791d785e2198e312c003a9260a75e2677b6485d7587915ee9cf7b526a54dd43ea8887a0a8e41816db597bf4bfc67cb4b293cad0de52d23085149c6a086b
7
+ data.tar.gz: 1c0168a638feef734657f0d6ee7190c8e10e42f19370902493618f9e314fca21bce52f593cde9c70fb68b97cd1b0ecefbd6aba0ba53b9c0559c9763e66a3db90
data/README.md CHANGED
@@ -35,7 +35,7 @@ This gem supports the following Rocket.Chat APIs (Tested against Rocket.Chat v0.
35
35
  * [/api/v1/logout](#authentication)
36
36
  * /api/v1/me
37
37
 
38
- ### Users
38
+ #### Users
39
39
  * [/api/v1/users.create](docs/users.md#userscreate)
40
40
  * [/api/v1/users.delete](docs/users.md#usersdelete)
41
41
  * [/api/v1/users.getPresence](docs/users.md#usersgetpresence)
@@ -44,6 +44,9 @@ This gem supports the following Rocket.Chat APIs (Tested against Rocket.Chat v0.
44
44
  * [/api/v1/users.setAvatar](docs/users.md#userssetavatar)
45
45
  * [/api/v1/users.update](docs/users.md#usersupdate)
46
46
 
47
+ #### Settings
48
+ * [/api/v1/settings/:_id](docs/settings.md#settingsget)
49
+
47
50
 
48
51
  ## Usage
49
52
 
@@ -74,6 +77,7 @@ session.logout
74
77
  For details of specific APIs:
75
78
 
76
79
  * [Users](docs/users.md)
80
+ * [Settings](docs/settings.md)
77
81
 
78
82
 
79
83
  ## Contributing
@@ -1,3 +1,3 @@
1
1
  module RocketChat
2
- VERSION = '0.0.8'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
@@ -0,0 +1,45 @@
1
+ module RocketChat
2
+ module Messages
3
+ #
4
+ # Rocket.Chat Settings messages
5
+ #
6
+ class Settings
7
+ #
8
+ # @param [Session] session Session
9
+ #
10
+ def initialize(session)
11
+ @session = session
12
+ end
13
+
14
+ #
15
+ # settings get REST API
16
+ # @param [String] id Setting id
17
+ # @return [various]
18
+ # @raise [HTTPError, StatusError]
19
+ #
20
+ def [](id)
21
+ response = session.request_json(
22
+ "/api/v1/settings/#{id}"
23
+ )
24
+
25
+ response['value'] if response['success']
26
+ end
27
+
28
+ def []=(id, value)
29
+ response = session.request_json(
30
+ "/api/v1/settings/#{id}",
31
+ method: :post,
32
+ body: {
33
+ value: value
34
+ }
35
+ )
36
+
37
+ value if response['success']
38
+ end
39
+
40
+ private
41
+
42
+ attr_reader :session
43
+ end
44
+ end
45
+ end
@@ -47,5 +47,13 @@ module RocketChat
47
47
  def users
48
48
  @users ||= RocketChat::Messages::User.new(self)
49
49
  end
50
+
51
+ #
52
+ # Settings messages proxy
53
+ # @return [Messages::Settings]
54
+ #
55
+ def settings
56
+ @settings ||= RocketChat::Messages::Settings.new(self)
57
+ end
50
58
  end
51
59
  end
data/lib/rocketchat.rb CHANGED
@@ -7,6 +7,7 @@ require 'rocket_chat/util'
7
7
  require 'rocket_chat/request_helper'
8
8
 
9
9
  require 'rocket_chat/messages/user'
10
+ require 'rocket_chat/messages/settings'
10
11
 
11
12
  require 'rocket_chat/server'
12
13
  require 'rocket_chat/session'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - int512
@@ -115,6 +115,7 @@ files:
115
115
  - lib/rocket_chat/error.rb
116
116
  - lib/rocket_chat/gem_version.rb
117
117
  - lib/rocket_chat/info.rb
118
+ - lib/rocket_chat/messages/settings.rb
118
119
  - lib/rocket_chat/messages/user.rb
119
120
  - lib/rocket_chat/presence_status.rb
120
121
  - lib/rocket_chat/request_helper.rb