Class: Basecamp::Services::CampfiresService
- Inherits:
-
BaseService
- Object
- BaseService
- Basecamp::Services::CampfiresService
- Defined in:
- lib/basecamp/generated/services/campfires_service.rb
Overview
Service for Campfires operations
Instance Method Summary collapse
-
#create_chatbot(campfire_id:, service_name:, command_url: nil) ⇒ Hash
Create a new chatbot for a campfire.
-
#create_line(campfire_id:, content:, content_type: nil) ⇒ Hash
Create a new line (message) in a campfire.
-
#create_upload(campfire_id:, data:, content_type:, name:) ⇒ Hash
Upload a file to a campfire.
-
#delete_chatbot(campfire_id:, chatbot_id:) ⇒ void
Delete a chatbot.
-
#delete_line(campfire_id:, line_id:) ⇒ void
Delete a campfire line; allowed for the line's creator or an admin.
-
#get(campfire_id:) ⇒ Hash
Get a campfire by ID.
-
#get_chatbot(campfire_id:, chatbot_id:) ⇒ Hash
Get a chatbot by ID.
-
#get_line(campfire_id:, line_id:) ⇒ Hash
Get a campfire line by ID.
-
#list ⇒ Enumerator<Hash>
List all campfires across the account.
-
#list_chatbots(campfire_id:) ⇒ Enumerator<Hash>
List all chatbots for a campfire.
-
#list_lines(campfire_id:, sort: nil, direction: nil) ⇒ Enumerator<Hash>
List all lines (messages) in a campfire.
-
#list_uploads(campfire_id:, sort: nil, direction: nil) ⇒ Enumerator<Hash>
List uploaded files in a campfire.
-
#update_chatbot(campfire_id:, chatbot_id:, service_name:, command_url: nil) ⇒ Hash
Update an existing chatbot.
-
#update_line(campfire_id:, line_id:, content:) ⇒ void
Update an existing campfire line; the content is always treated as rich text (HTML).
Constructor Details
This class inherits a constructor from Basecamp::Services::BaseService
Instance Method Details
#create_chatbot(campfire_id:, service_name:, command_url: nil) ⇒ Hash
Create a new chatbot for a campfire
43 44 45 46 47 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 43 def create_chatbot(campfire_id:, service_name:, command_url: nil) with_operation(service: "campfires", operation: "create_chatbot", is_mutation: true, resource_id: campfire_id) do http_post("/chats/#{campfire_id}/integrations.json", body: compact_params(service_name: service_name, command_url: command_url)).json end end |
#create_line(campfire_id:, content:, content_type: nil) ⇒ Hash
Create a new line (message) in a campfire
99 100 101 102 103 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 99 def create_line(campfire_id:, content:, content_type: nil) with_operation(service: "campfires", operation: "create_line", is_mutation: true, resource_id: campfire_id) do http_post("/chats/#{campfire_id}/lines.json", body: compact_params(content: content, content_type: content_type)).json end end |
#create_upload(campfire_id:, data:, content_type:, name:) ⇒ Hash
Upload a file to a campfire
156 157 158 159 160 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 156 def create_upload(campfire_id:, data:, content_type:, name:) with_operation(service: "campfires", operation: "create_upload", is_mutation: true, resource_id: campfire_id) do http_post_raw("/chats/#{campfire_id}/uploads.json?name=#{URI.encode_www_form_component(name.to_s)}", body: data, content_type: content_type).json end end |
#delete_chatbot(campfire_id:, chatbot_id:) ⇒ void
This method returns an undefined value.
Delete a chatbot
75 76 77 78 79 80 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 75 def delete_chatbot(campfire_id:, chatbot_id:) with_operation(service: "campfires", operation: "delete_chatbot", is_mutation: true, resource_id: chatbot_id) do http_delete("/chats/#{campfire_id}/integrations/#{chatbot_id}") nil end end |
#delete_line(campfire_id:, line_id:) ⇒ void
This method returns an undefined value.
Delete a campfire line; allowed for the line's creator or an admin.
131 132 133 134 135 136 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 131 def delete_line(campfire_id:, line_id:) with_operation(service: "campfires", operation: "delete_line", is_mutation: true, resource_id: line_id) do http_delete("/chats/#{campfire_id}/lines/#{line_id}") nil end end |
#get(campfire_id:) ⇒ Hash
Get a campfire by ID
23 24 25 26 27 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 23 def get(campfire_id:) with_operation(service: "campfires", operation: "get", is_mutation: false, resource_id: campfire_id) do http_get("/chats/#{campfire_id}").json end end |
#get_chatbot(campfire_id:, chatbot_id:) ⇒ Hash
Get a chatbot by ID
53 54 55 56 57 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 53 def get_chatbot(campfire_id:, chatbot_id:) with_operation(service: "campfires", operation: "get_chatbot", is_mutation: false, resource_id: chatbot_id) do http_get("/chats/#{campfire_id}/integrations/#{chatbot_id}").json end end |
#get_line(campfire_id:, line_id:) ⇒ Hash
Get a campfire line by ID
109 110 111 112 113 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 109 def get_line(campfire_id:, line_id:) with_operation(service: "campfires", operation: "get_line", is_mutation: false, resource_id: line_id) do http_get("/chats/#{campfire_id}/lines/#{line_id}").json end end |
#list ⇒ Enumerator<Hash>
List all campfires across the account
14 15 16 17 18 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 14 def list() wrap_paginated(service: "campfires", operation: "list", is_mutation: false) do paginate("/chats.json") end end |
#list_chatbots(campfire_id:) ⇒ Enumerator<Hash>
List all chatbots for a campfire
32 33 34 35 36 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 32 def list_chatbots(campfire_id:) wrap_paginated(service: "campfires", operation: "list_chatbots", is_mutation: false, resource_id: campfire_id) do paginate("/chats/#{campfire_id}/integrations.json") end end |
#list_lines(campfire_id:, sort: nil, direction: nil) ⇒ Enumerator<Hash>
List all lines (messages) in a campfire
87 88 89 90 91 92 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 87 def list_lines(campfire_id:, sort: nil, direction: nil) wrap_paginated(service: "campfires", operation: "list_lines", is_mutation: false, resource_id: campfire_id) do params = compact_query_params(sort: sort, direction: direction) paginate("/chats/#{campfire_id}/lines.json", params: params) end end |
#list_uploads(campfire_id:, sort: nil, direction: nil) ⇒ Enumerator<Hash>
List uploaded files in a campfire
143 144 145 146 147 148 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 143 def list_uploads(campfire_id:, sort: nil, direction: nil) wrap_paginated(service: "campfires", operation: "list_uploads", is_mutation: false, resource_id: campfire_id) do params = compact_query_params(sort: sort, direction: direction) paginate("/chats/#{campfire_id}/uploads.json", params: params) end end |
#update_chatbot(campfire_id:, chatbot_id:, service_name:, command_url: nil) ⇒ Hash
Update an existing chatbot
65 66 67 68 69 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 65 def update_chatbot(campfire_id:, chatbot_id:, service_name:, command_url: nil) with_operation(service: "campfires", operation: "update_chatbot", is_mutation: true, resource_id: chatbot_id) do http_put("/chats/#{campfire_id}/integrations/#{chatbot_id}", body: compact_params(service_name: service_name, command_url: command_url)).json end end |
#update_line(campfire_id:, line_id:, content:) ⇒ void
This method returns an undefined value.
Update an existing campfire line; the content is always treated as rich text (HTML).
120 121 122 123 124 125 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 120 def update_line(campfire_id:, line_id:, content:) with_operation(service: "campfires", operation: "update_line", is_mutation: true, resource_id: line_id) do http_put("/chats/#{campfire_id}/lines/#{line_id}", body: compact_params(content: content)) nil end end |