Module: Mural::Client::MuralContent::Files

Included in:
Mural::Client::MuralContent
Defined in:
lib/mural/client/mural_content/files.rb

Instance Method Summary collapse

Instance Method Details

#create_file(mural_id, params) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/mural/client/mural_content/files.rb', line 8

def create_file(mural_id, params)
  json = post(
    "/api/public/v1/murals/#{mural_id}/widgets/file",
    params.encode
  )

  Mural::Widget.decode(json['value'])
end

#list_files(mural_id, next_page: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/mural/client/mural_content/files.rb', line 18

def list_files(mural_id, next_page: nil)
  json = get(
    "/api/public/v1/murals/#{mural_id}/widgets/files",
    { next: next_page }
  )

  files = json['value'].map { |f| Mural::Widget.decode(f) }
  [files, json['next']]
end

#update_file(mural_id, widget_id:, update_file_params:) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/mural/client/mural_content/files.rb', line 29

def update_file(mural_id, widget_id:, update_file_params:)
  json = patch(
    "/api/public/v1/murals/#{mural_id}/widgets/file/#{widget_id}",
    update_file_params.encode
  )

  Mural::Widget.decode(json['value'])
end