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(bucket_id:, 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(bucket_id:, 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(bucket_id:, campfire_id:, chatbot_id:) ⇒ Hash
Get a chatbot by ID.
-
#get_line(campfire_id:, line_id:) ⇒ Hash
Get a campfire line by ID.
-
#list(page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List all campfires across the account.
-
#list_chatbots(bucket_id:, campfire_id:, max_items: nil) ⇒ ListEnumerator<Hash>
List all chatbots for a campfire.
-
#list_lines(campfire_id:, sort: nil, direction: nil, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List all lines (messages) in a campfire.
-
#list_uploads(campfire_id:, sort: nil, direction: nil, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List uploaded files in a campfire.
-
#update_chatbot(bucket_id:, 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(bucket_id:, campfire_id:, service_name:, command_url: nil) ⇒ Hash
Create a new chatbot for a campfire
29 30 31 32 33 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 29 def create_chatbot(bucket_id:, campfire_id:, service_name:, command_url: nil) with_operation(service: "campfires", operation: "create_chatbot", is_mutation: true, project_id: bucket_id, resource_id: campfire_id) do http_post("/buckets/#{bucket_id}/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
110 111 112 113 114 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 110 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
169 170 171 172 173 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 169 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(bucket_id:, campfire_id:, chatbot_id:) ⇒ void
This method returns an undefined value.
Delete a chatbot
64 65 66 67 68 69 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 64 def delete_chatbot(bucket_id:, campfire_id:, chatbot_id:) with_operation(service: "campfires", operation: "delete_chatbot", is_mutation: true, project_id: bucket_id, resource_id: chatbot_id) do http_delete("/buckets/#{bucket_id}/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.
142 143 144 145 146 147 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 142 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
85 86 87 88 89 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 85 def get(campfire_id:) with_operation(service: "campfires", operation: "get", is_mutation: false, resource_id: campfire_id) do http_get("/chats/#{campfire_id}", operation: "GetCampfire").json end end |
#get_chatbot(bucket_id:, campfire_id:, chatbot_id:) ⇒ Hash
Get a chatbot by ID
40 41 42 43 44 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 40 def get_chatbot(bucket_id:, campfire_id:, chatbot_id:) with_operation(service: "campfires", operation: "get_chatbot", is_mutation: false, project_id: bucket_id, resource_id: chatbot_id) do http_get("/buckets/#{bucket_id}/chats/#{campfire_id}/integrations/#{chatbot_id}", operation: "GetChatbot").json end end |
#get_line(campfire_id:, line_id:) ⇒ Hash
Get a campfire line by ID
120 121 122 123 124 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 120 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}", operation: "GetCampfireLine").json end end |
#list(page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List all campfires across the account
75 76 77 78 79 80 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 75 def list(page: nil, max_items: nil) wrap_paginated(service: "campfires", operation: "list", is_mutation: false) do params = compact_query_params(page: page) paginate("/chats.json", params: params, operation: "ListCampfires", max_items: max_items) end end |
#list_chatbots(bucket_id:, campfire_id:, max_items: nil) ⇒ ListEnumerator<Hash>
List all chatbots for a campfire
17 18 19 20 21 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 17 def list_chatbots(bucket_id:, campfire_id:, max_items: nil) wrap_paginated(service: "campfires", operation: "list_chatbots", is_mutation: false, project_id: bucket_id, resource_id: campfire_id) do paginate("/buckets/#{bucket_id}/chats/#{campfire_id}/integrations.json", operation: "ListChatbots", max_items: max_items) end end |
#list_lines(campfire_id:, sort: nil, direction: nil, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List all lines (messages) in a campfire
98 99 100 101 102 103 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 98 def list_lines(campfire_id:, sort: nil, direction: nil, page: nil, max_items: nil) wrap_paginated(service: "campfires", operation: "list_lines", is_mutation: false, resource_id: campfire_id) do params = compact_query_params(sort: sort, direction: direction, page: page) paginate("/chats/#{campfire_id}/lines.json", params: params, operation: "ListCampfireLines", max_items: max_items) end end |
#list_uploads(campfire_id:, sort: nil, direction: nil, page: nil, max_items: nil) ⇒ ListEnumerator<Hash>
List uploaded files in a campfire
156 157 158 159 160 161 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 156 def list_uploads(campfire_id:, sort: nil, direction: nil, page: nil, max_items: nil) wrap_paginated(service: "campfires", operation: "list_uploads", is_mutation: false, resource_id: campfire_id) do params = compact_query_params(sort: sort, direction: direction, page: page) paginate("/chats/#{campfire_id}/uploads.json", params: params, operation: "ListCampfireUploads", max_items: max_items) end end |
#update_chatbot(bucket_id:, campfire_id:, chatbot_id:, service_name:, command_url: nil) ⇒ Hash
Update an existing chatbot
53 54 55 56 57 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 53 def update_chatbot(bucket_id:, campfire_id:, chatbot_id:, service_name:, command_url: nil) with_operation(service: "campfires", operation: "update_chatbot", is_mutation: true, project_id: bucket_id, resource_id: chatbot_id) do http_put("/buckets/#{bucket_id}/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).
131 132 133 134 135 136 |
# File 'lib/basecamp/generated/services/campfires_service.rb', line 131 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 |