Class: Mural::Client::Templates
- Inherits:
-
Object
- Object
- Mural::Client::Templates
- Extended by:
- Forwardable
- Defined in:
- lib/mural/client/templates.rb
Instance Method Summary collapse
- #create_custom(title:, mural_id:, description: nil) ⇒ Object
- #create_mural(template_id, title:, room_id:, folder_id: nil) ⇒ Object
- #default_templates(next_page: nil) ⇒ Object
- #destroy(template_id) ⇒ Object
- #for_workspace(workspace_id, next_page: nil, without_default: true) ⇒ Object
-
#initialize(client) ⇒ Templates
constructor
A new instance of Templates.
- #recent_for_workspace(workspace_id, next_page: nil, without_default: true) ⇒ Object
Constructor Details
#initialize(client) ⇒ Templates
10 11 12 |
# File 'lib/mural/client/templates.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#create_custom(title:, mural_id:, description: nil) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/mural/client/templates.rb', line 24 def create_custom(title:, mural_id:, description: nil) json = post( '/api/public/v1/templates', { title: title, muralId: mural_id, description: description } ) Mural::Template.decode(json['value']) end |
#create_mural(template_id, title:, room_id:, folder_id: nil) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/mural/client/templates.rb', line 39 def create_mural(template_id, title:, room_id:, folder_id: nil) json = post( "/api/public/v1/templates/#{template_id}/murals", { title: title, roomId: room_id, folderId: folder_id } ) Mural::MuralBoard.decode(json['value']) end |
#default_templates(next_page: nil) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/mural/client/templates.rb', line 15 def default_templates(next_page: nil) json = get('/api/public/v1/templates', { next: next_page }) templates = json['value'].map { |tpl| Mural::Template.decode(tpl) } [templates, json['next']] end |
#destroy(template_id) ⇒ Object
34 35 36 |
# File 'lib/mural/client/templates.rb', line 34 def destroy(template_id) delete("/api/public/v1/templates/#{template_id}") end |
#for_workspace(workspace_id, next_page: nil, without_default: true) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/mural/client/templates.rb', line 49 def for_workspace(workspace_id, next_page: nil, without_default: true) json = get( "/api/public/v1/workspaces/#{workspace_id}/templates", { next: next_page, withoutDefault: without_default } ) templates = json['value'].map { |tpl| Mural::Template.decode(tpl) } [templates, json['next']] end |
#recent_for_workspace(workspace_id, next_page: nil, without_default: true) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/mural/client/templates.rb', line 61 def recent_for_workspace( workspace_id, next_page: nil, without_default: true ) json = get( "/api/public/v1/workspaces/#{workspace_id}/templates/recent", { next: next_page, withoutDefault: without_default } ) templates = json['value'].map { |tpl| Mural::Template.decode(tpl) } [templates, json['next']] end |