Class: Mural::Client::Murals
- Inherits:
-
Object
- Object
- Mural::Client::Murals
- Extended by:
- Forwardable
- Defined in:
- lib/mural/client/murals.rb
Instance Method Summary collapse
- #access_information(mural_id, mural_state:) ⇒ Object
- #create(create_params) ⇒ Object
- #destroy(mural_id) ⇒ Object
- #duplicate(mural_id, duplicate_params) ⇒ Object
- #export(mural_id, download_format: 'pdf') ⇒ Object
- #export_url(mural_id, export_id) ⇒ Object
- #for_room(room_id, folder_id: nil, status: nil, sort_by: nil, next_page: nil) ⇒ Object
- #for_workspace(workspace_id, status: nil, sort_by: nil, next_page: nil) ⇒ Object
-
#initialize(client) ⇒ Murals
constructor
A new instance of Murals.
- #recently_opened_in_workspace(workspace_id, next_page: nil) ⇒ Object
- #reset_visitor_link(mural_id) ⇒ Object
- #retrieve(mural_id) ⇒ Object
- #update(mural_id, update_params) ⇒ Object
Constructor Details
#initialize(client) ⇒ Murals
Returns a new instance of Murals.
10 11 12 |
# File 'lib/mural/client/murals.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#access_information(mural_id, mural_state:) ⇒ Object
120 121 122 123 124 125 126 127 |
# File 'lib/mural/client/murals.rb', line 120 def access_information(mural_id, mural_state:) json = post( "/api/public/v1/murals/#{mural_id}/access-info", { muralState: mural_state } ) ::Mural::MuralBoard::AccessInformation.decode(json['value']) end |
#create(create_params) ⇒ Object
22 23 24 25 26 |
# File 'lib/mural/client/murals.rb', line 22 def create(create_params) json = post('/api/public/v1/murals', create_params.encode) ::Mural::MuralBoard.decode(json['value']) end |
#destroy(mural_id) ⇒ Object
36 37 38 |
# File 'lib/mural/client/murals.rb', line 36 def destroy(mural_id) delete("/api/public/v1/murals/#{mural_id}") end |
#duplicate(mural_id, duplicate_params) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/mural/client/murals.rb', line 58 def duplicate(mural_id, duplicate_params) json = post( "/api/public/v1/murals/#{mural_id}/duplicate", duplicate_params.encode ) ::Mural::MuralBoard.decode(json['value']) end |
#export(mural_id, download_format: 'pdf') ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/mural/client/murals.rb', line 41 def export(mural_id, download_format: 'pdf') json = post( "/api/public/v1/murals/#{mural_id}/export", { downloadFormat: download_format } ) json.dig('value', 'exportId') end |
#export_url(mural_id, export_id) ⇒ Object
51 52 53 54 55 |
# File 'lib/mural/client/murals.rb', line 51 def export_url(mural_id, export_id) json = get("/api/public/v1/murals/#{mural_id}/exports/#{export_id}") ::Mural::MuralExport.decode(json['value']) end |
#for_room(room_id, folder_id: nil, status: nil, sort_by: nil, next_page: nil) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/mural/client/murals.rb', line 95 def for_room( # rubocop:disable Metrics/MethodLength room_id, folder_id: nil, status: nil, sort_by: nil, next_page: nil ) json = get( "/api/public/v1/rooms/#{room_id}/murals", { folderId: folder_id, status: status, sortBy: sort_by, next: next_page } ) murals = json['value'].map do |json_mural| ::Mural::MuralBoard.decode(json_mural) end [murals, json['next']] end |
#for_workspace(workspace_id, status: nil, sort_by: nil, next_page: nil) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/mural/client/murals.rb', line 67 def for_workspace(workspace_id, status: nil, sort_by: nil, next_page: nil) json = get( "/api/public/v1/workspaces/#{workspace_id}/murals", { status: status, sortBy: sort_by, next: next_page } ) murals = json['value'].map do |json_mural| ::Mural::MuralBoard.decode(json_mural) end [murals, json['next']] end |
#recently_opened_in_workspace(workspace_id, next_page: nil) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/mural/client/murals.rb', line 81 def recently_opened_in_workspace(workspace_id, next_page: nil) json = get( "/api/public/v1/workspaces/#{workspace_id}/murals/recent", { next: next_page } ) murals = json['value'].map do |json_mural| ::Mural::MuralBoard.decode(json_mural) end [murals, json['next']] end |
#reset_visitor_link(mural_id) ⇒ Object
130 131 132 133 134 135 |
# File 'lib/mural/client/murals.rb', line 130 def reset_visitor_link(mural_id) json = post("/api/public/v1/murals/#{mural_id}/visitor-settings/reset-link") ::Mural::MuralBoard::VisitorsSettings.decode(json['value']) end |
#retrieve(mural_id) ⇒ Object
15 16 17 18 19 |
# File 'lib/mural/client/murals.rb', line 15 def retrieve(mural_id) json = get("/api/public/v1/murals/#{mural_id}") ::Mural::MuralBoard.decode(json['value']) end |
#update(mural_id, update_params) ⇒ Object
29 30 31 32 33 |
# File 'lib/mural/client/murals.rb', line 29 def update(mural_id, update_params) json = patch("/api/public/v1/murals/#{mural_id}", update_params.encode) ::Mural::MuralBoard.decode(json['value']) end |