Class: Mural::Client::Rooms
- Inherits:
-
Object
- Object
- Mural::Client::Rooms
- Extended by:
- Forwardable
- Defined in:
- lib/mural/client/rooms.rb
Instance Method Summary collapse
- #create(params) ⇒ Object
- #create_folder(room_id, name:, parent_id: nil) ⇒ Object
- #destroy(room_id) ⇒ Object
- #destroy_folder(room_id, folder_id) ⇒ Object
-
#initialize(client) ⇒ Rooms
constructor
A new instance of Rooms.
- #list(workspace_id, next_page: nil) ⇒ Object
- #list_folders(room_id, next_page: nil) ⇒ Object
- #list_open(workspace_id, next_page: nil) ⇒ Object
- #retrieve(room_id) ⇒ Object
- #update(room_id, params) ⇒ Object
Constructor Details
#initialize(client) ⇒ Rooms
Returns a new instance of Rooms.
10 11 12 |
# File 'lib/mural/client/rooms.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#create(params) ⇒ Object
15 16 17 18 19 |
# File 'lib/mural/client/rooms.rb', line 15 def create(params) json = post('/api/public/v1/rooms', params.encode) Mural::Room.decode(json['value']) end |
#create_folder(room_id, name:, parent_id: nil) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/mural/client/rooms.rb', line 34 def create_folder(room_id, name:, parent_id: nil) json = post( "/api/public/v1/rooms/#{room_id}/folders", { name: name, parentId: parent_id } ) ::Mural::RoomFolder.decode(json['value']) end |
#destroy(room_id) ⇒ Object
29 30 31 |
# File 'lib/mural/client/rooms.rb', line 29 def destroy(room_id) delete("/api/public/v1/rooms/#{room_id}") end |
#destroy_folder(room_id, folder_id) ⇒ Object
58 59 60 |
# File 'lib/mural/client/rooms.rb', line 58 def destroy_folder(room_id, folder_id) delete("/api/public/v1/rooms/#{room_id}/folders/#{folder_id}") end |
#list(workspace_id, next_page: nil) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/mural/client/rooms.rb', line 70 def list(workspace_id, next_page: nil) json = get( "/api/public/v1/workspaces/#{workspace_id}/rooms", { next: next_page } ) rooms = json['value'].map { |json_room| Mural::Room.decode(json_room) } [rooms, json['next']] end |
#list_folders(room_id, next_page: nil) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mural/client/rooms.rb', line 44 def list_folders(room_id, next_page: nil) json = get( "/api/public/v1/rooms/#{room_id}/folders", { next: next_page } ) folders = json['value'].map do |json_folder| ::Mural::RoomFolder.decode(json_folder) end [folders, json['next']] end |
#list_open(workspace_id, next_page: nil) ⇒ Object
81 82 83 84 85 86 87 88 89 |
# File 'lib/mural/client/rooms.rb', line 81 def list_open(workspace_id, next_page: nil) json = get( "/api/public/v1/workspaces/#{workspace_id}/rooms/open", { next: next_page } ) rooms = json['value'].map { |json_room| Mural::Room.decode(json_room) } [rooms, json['next']] end |
#retrieve(room_id) ⇒ Object
63 64 65 66 67 |
# File 'lib/mural/client/rooms.rb', line 63 def retrieve(room_id) json = get("/api/public/v1/rooms/#{room_id}") Mural::Room.decode(json['value']) end |
#update(room_id, params) ⇒ Object
22 23 24 25 26 |
# File 'lib/mural/client/rooms.rb', line 22 def update(room_id, params) json = patch("/api/public/v1/rooms/#{room_id}", params.encode) Mural::Room.decode(json['value']) end |