Class: Mural::Client::Search
- Inherits:
-
Object
- Object
- Mural::Client::Search
- Extended by:
- Forwardable
- Defined in:
- lib/mural/client/search.rb
Instance Method Summary collapse
-
#initialize(client) ⇒ Search
constructor
A new instance of Search.
- #murals(query, workspace_id:, next_page: nil, room_id: nil) ⇒ Object
- #rooms(query, workspace_id:, next_page: nil) ⇒ Object
- #templates(query, workspace_id:, next_page: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ Search
Returns a new instance of Search.
10 11 12 |
# File 'lib/mural/client/search.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#murals(query, workspace_id:, next_page: nil, room_id: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mural/client/search.rb', line 15 def murals(query, workspace_id:, next_page: nil, room_id: nil) json = get( "/api/public/v1/search/#{workspace_id}/murals", { next: next_page, q: query, roomId: room_id } ) murals = json['value'].map do |hit| Mural::SearchMuralResult.decode(hit) end [murals, json['next']] end |
#rooms(query, workspace_id:, next_page: nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/mural/client/search.rb', line 29 def rooms(query, workspace_id:, next_page: nil) json = get( "/api/public/v1/search/#{workspace_id}/rooms", { next: next_page, q: query } ) rooms = json['value'].map { |hit| Mural::SearchRoomResult.decode(hit) } [rooms, json['next']] end |
#templates(query, workspace_id:, next_page: nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mural/client/search.rb', line 41 def templates(query, workspace_id:, next_page: nil) json = get( "/api/public/v1/search/#{workspace_id}/templates", { next: next_page, q: query } ) templates = json['value'].map do |hit| Mural::SearchTemplateResult.decode(hit) end [templates, json['next']] end |