basecamp-sdk 0.7.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +65 -1
- data/basecamp-sdk.gemspec +2 -3
- data/lib/basecamp/client.rb +5 -0
- data/lib/basecamp/generated/metadata.json +100 -33
- data/lib/basecamp/generated/services/base_service.rb +13 -0
- data/lib/basecamp/generated/services/campfires_service.rb +15 -3
- data/lib/basecamp/generated/services/card_columns_service.rb +26 -23
- data/lib/basecamp/generated/services/checkins_service.rb +5 -4
- data/lib/basecamp/generated/services/client_approvals_service.rb +1 -1
- data/lib/basecamp/generated/services/client_correspondences_service.rb +1 -1
- data/lib/basecamp/generated/services/documents_service.rb +3 -2
- data/lib/basecamp/generated/services/forwards_service.rb +1 -1
- data/lib/basecamp/generated/services/gauges_service.rb +4 -4
- data/lib/basecamp/generated/services/messages_service.rb +4 -3
- data/lib/basecamp/generated/services/my_assignments_service.rb +1 -1
- data/lib/basecamp/generated/services/my_notifications_service.rb +1 -1
- data/lib/basecamp/generated/services/people_service.rb +2 -2
- data/lib/basecamp/generated/services/projects_service.rb +2 -2
- data/lib/basecamp/generated/services/recordings_service.rb +1 -1
- data/lib/basecamp/generated/services/reports_service.rb +3 -3
- data/lib/basecamp/generated/services/schedules_service.rb +5 -4
- data/lib/basecamp/generated/services/search_service.rb +14 -3
- data/lib/basecamp/generated/services/templates_service.rb +4 -5
- data/lib/basecamp/generated/services/timesheets_service.rb +3 -3
- data/lib/basecamp/generated/services/todolists_service.rb +15 -3
- data/lib/basecamp/generated/services/todos_service.rb +5 -5
- data/lib/basecamp/generated/services/tools_service.rb +7 -6
- data/lib/basecamp/generated/services/uploads_service.rb +20 -2
- data/lib/basecamp/generated/services/webhooks_service.rb +2 -2
- data/lib/basecamp/generated/services/wormholes_service.rb +44 -0
- data/lib/basecamp/generated/types.rb +284 -64
- data/lib/basecamp/http.rb +86 -15
- data/lib/basecamp/oauth/config.rb +20 -5
- data/lib/basecamp/oauth/discovery.rb +134 -64
- data/lib/basecamp/oauth/discovery_result.rb +33 -0
- data/lib/basecamp/oauth/discovery_selection_error.rb +30 -0
- data/lib/basecamp/oauth/fetcher.rb +204 -0
- data/lib/basecamp/oauth/protected_resource_metadata.rb +22 -0
- data/lib/basecamp/oauth/resource.rb +95 -0
- data/lib/basecamp/oauth.rb +173 -0
- data/lib/basecamp/security.rb +83 -0
- data/lib/basecamp/services/authorization_service.rb +45 -0
- data/lib/basecamp/services/todos_extensions.rb +121 -0
- data/lib/basecamp/version.rb +2 -2
- data/lib/basecamp.rb +6 -0
- data/scripts/generate-services.rb +61 -13
- data/scripts/generate-types.rb +33 -1
- metadata +14 -21
- data/lib/basecamp/generated/services/authorization_service.rb +0 -47
|
@@ -12,7 +12,7 @@ module Basecamp
|
|
|
12
12
|
# @return [Hash] response data
|
|
13
13
|
def get_my_notifications(page: nil)
|
|
14
14
|
with_operation(service: "mynotifications", operation: "get_my_notifications", is_mutation: false) do
|
|
15
|
-
http_get("/my/readings.json", params:
|
|
15
|
+
http_get("/my/readings.json", params: compact_query_params(page: page)).json
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ module Basecamp
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# Update the current user's preferences
|
|
27
|
-
# @param person [
|
|
27
|
+
# @param person [Hash] person
|
|
28
28
|
# @return [Hash] response data
|
|
29
29
|
def update_my_preferences(person:)
|
|
30
30
|
with_operation(service: "people", operation: "update_my_preferences", is_mutation: true) do
|
|
@@ -85,7 +85,7 @@ module Basecamp
|
|
|
85
85
|
|
|
86
86
|
# Enable or replace out of office for a person.
|
|
87
87
|
# @param person_id [Integer] person id ID
|
|
88
|
-
# @param out_of_office [
|
|
88
|
+
# @param out_of_office [Hash] out of office
|
|
89
89
|
# @return [Hash] response data
|
|
90
90
|
def enable_out_of_office(person_id:, out_of_office:)
|
|
91
91
|
with_operation(service: "people", operation: "enable_out_of_office", is_mutation: true, resource_id: person_id) do
|
|
@@ -12,7 +12,7 @@ module Basecamp
|
|
|
12
12
|
# @return [Enumerator<Hash>] paginated results
|
|
13
13
|
def list(status: nil)
|
|
14
14
|
wrap_paginated(service: "projects", operation: "list", is_mutation: false) do
|
|
15
|
-
params =
|
|
15
|
+
params = compact_query_params(status: status)
|
|
16
16
|
paginate("/projects.json", params: params)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -41,7 +41,7 @@ module Basecamp
|
|
|
41
41
|
# @param name [String] name
|
|
42
42
|
# @param description [String, nil] description
|
|
43
43
|
# @param admissions [String, nil] invite|employee|team
|
|
44
|
-
# @param schedule_attributes [
|
|
44
|
+
# @param schedule_attributes [Hash, nil] schedule attributes
|
|
45
45
|
# @return [Hash] response data
|
|
46
46
|
def update(project_id:, name:, description: nil, admissions: nil, schedule_attributes: nil)
|
|
47
47
|
with_operation(service: "projects", operation: "update", is_mutation: true, project_id: project_id) do
|
|
@@ -16,7 +16,7 @@ module Basecamp
|
|
|
16
16
|
# @return [Enumerator<Hash>] paginated results
|
|
17
17
|
def list(type:, bucket: nil, status: nil, sort: nil, direction: nil)
|
|
18
18
|
wrap_paginated(service: "recordings", operation: "list", is_mutation: false) do
|
|
19
|
-
params =
|
|
19
|
+
params = compact_query_params(type: type, bucket: bucket, status: status, sort: sort, direction: direction)
|
|
20
20
|
paginate("/projects/recordings.json", params: params)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -15,13 +15,13 @@ module Basecamp
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
# Get upcoming schedule entries within a date window
|
|
18
|
+
# Get upcoming schedule entries and assignable items within a date window.
|
|
19
19
|
# @param window_starts_on [String, nil] window starts on
|
|
20
20
|
# @param window_ends_on [String, nil] window ends on
|
|
21
21
|
# @return [Hash] response data
|
|
22
22
|
def upcoming(window_starts_on: nil, window_ends_on: nil)
|
|
23
23
|
with_operation(service: "reports", operation: "upcoming", is_mutation: false) do
|
|
24
|
-
http_get("/reports/schedules/upcoming.json", params:
|
|
24
|
+
http_get("/reports/schedules/upcoming.json", params: compact_query_params(window_starts_on: window_starts_on, window_ends_on: window_ends_on)).json
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -31,7 +31,7 @@ module Basecamp
|
|
|
31
31
|
# @return [Hash] response data
|
|
32
32
|
def assigned(person_id:, group_by: nil)
|
|
33
33
|
with_operation(service: "reports", operation: "assigned", is_mutation: false, resource_id: person_id) do
|
|
34
|
-
http_get("/reports/todos/assigned/#{person_id}", params:
|
|
34
|
+
http_get("/reports/todos/assigned/#{person_id}", params: compact_query_params(group_by: group_by)).json
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -37,7 +37,7 @@ module Basecamp
|
|
|
37
37
|
# @param date [String] date ID
|
|
38
38
|
# @return [Hash] response data
|
|
39
39
|
def get_entry_occurrence(entry_id:, date:)
|
|
40
|
-
with_operation(service: "schedules", operation: "get_entry_occurrence", is_mutation: false, resource_id:
|
|
40
|
+
with_operation(service: "schedules", operation: "get_entry_occurrence", is_mutation: false, resource_id: entry_id) do
|
|
41
41
|
http_get("/schedule_entries/#{entry_id}/occurrences/#{date}").json
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -67,7 +67,7 @@ module Basecamp
|
|
|
67
67
|
# @return [Enumerator<Hash>] paginated results
|
|
68
68
|
def list_entries(schedule_id:, status: nil)
|
|
69
69
|
wrap_paginated(service: "schedules", operation: "list_entries", is_mutation: false, resource_id: schedule_id) do
|
|
70
|
-
params =
|
|
70
|
+
params = compact_query_params(status: status)
|
|
71
71
|
paginate("/schedules/#{schedule_id}/entries.json", params: params)
|
|
72
72
|
end
|
|
73
73
|
end
|
|
@@ -82,10 +82,11 @@ module Basecamp
|
|
|
82
82
|
# @param all_day [Boolean, nil] all day
|
|
83
83
|
# @param notify [Boolean, nil] notify
|
|
84
84
|
# @param subscriptions [Array, nil] subscriptions
|
|
85
|
+
# @param visible_to_clients [Boolean, nil] visible to clients
|
|
85
86
|
# @return [Hash] response data
|
|
86
|
-
def create_entry(schedule_id:, summary:, starts_at:, ends_at:, description: nil, participant_ids: nil, all_day: nil, notify: nil, subscriptions: nil)
|
|
87
|
+
def create_entry(schedule_id:, summary:, starts_at:, ends_at:, description: nil, participant_ids: nil, all_day: nil, notify: nil, subscriptions: nil, visible_to_clients: nil)
|
|
87
88
|
with_operation(service: "schedules", operation: "create_entry", is_mutation: true, resource_id: schedule_id) do
|
|
88
|
-
http_post("/schedules/#{schedule_id}/entries.json", body: compact_params(summary: summary, starts_at: starts_at, ends_at: ends_at, description: description, participant_ids: participant_ids, all_day: all_day, notify: notify, subscriptions: subscriptions)).json
|
|
89
|
+
http_post("/schedules/#{schedule_id}/entries.json", body: compact_params(summary: summary, starts_at: starts_at, ends_at: ends_at, description: description, participant_ids: participant_ids, all_day: all_day, notify: notify, subscriptions: subscriptions, visible_to_clients: visible_to_clients)).json
|
|
89
90
|
end
|
|
90
91
|
end
|
|
91
92
|
end
|
|
@@ -9,11 +9,22 @@ module Basecamp
|
|
|
9
9
|
|
|
10
10
|
# Search for content across the account
|
|
11
11
|
# @param q [String] q
|
|
12
|
-
# @param
|
|
12
|
+
# @param type_names [Array, nil] Recording types to include. Use `key` values from the metadata
|
|
13
|
+
# endpoint's `recording_search_types`. Available since Basecamp 5.
|
|
14
|
+
# @param bucket_ids [Array, nil] Project IDs to filter by. Available since Basecamp 5.
|
|
15
|
+
# @param creator_ids [Array, nil] Creator person IDs to filter by. Available since Basecamp 5.
|
|
16
|
+
# @param file_type [String, nil] Filter attachments by type. Use `key` values from the metadata
|
|
17
|
+
# endpoint's `file_search_types`.
|
|
18
|
+
# @param exclude_chat [Boolean, nil] Set to true to exclude chat results.
|
|
19
|
+
# @param since [String, nil] last_7_days|last_30_days|last_90_days|last_12_months|forever
|
|
20
|
+
# @param sort [String, nil] best_match|recency
|
|
21
|
+
# @param type [String, nil] Deprecated: prefer type_names[].
|
|
22
|
+
# @param bucket_id [Integer, nil] Deprecated: prefer bucket_ids[].
|
|
23
|
+
# @param creator_id [Integer, nil] Deprecated: prefer creator_ids[].
|
|
13
24
|
# @return [Enumerator<Hash>] paginated results
|
|
14
|
-
def search(q:, sort: nil)
|
|
25
|
+
def search(q:, type_names: nil, bucket_ids: nil, creator_ids: nil, file_type: nil, exclude_chat: nil, since: nil, sort: nil, type: nil, bucket_id: nil, creator_id: nil)
|
|
15
26
|
wrap_paginated(service: "search", operation: "search", is_mutation: false) do
|
|
16
|
-
params =
|
|
27
|
+
params = compact_query_params(q: q, type_names: type_names, bucket_ids: bucket_ids, creator_ids: creator_ids, file_type: file_type, exclude_chat: exclude_chat, since: since, sort: sort, type: type, bucket_id: bucket_id, creator_id: creator_id)
|
|
17
28
|
paginate("/search.json", params: params)
|
|
18
29
|
end
|
|
19
30
|
end
|
|
@@ -12,7 +12,7 @@ module Basecamp
|
|
|
12
12
|
# @return [Enumerator<Hash>] paginated results
|
|
13
13
|
def list(status: nil)
|
|
14
14
|
wrap_paginated(service: "templates", operation: "list", is_mutation: false) do
|
|
15
|
-
params =
|
|
15
|
+
params = compact_query_params(status: status)
|
|
16
16
|
paginate("/templates.json", params: params)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -59,12 +59,11 @@ module Basecamp
|
|
|
59
59
|
|
|
60
60
|
# Create a project from a template (asynchronous)
|
|
61
61
|
# @param template_id [Integer] template id ID
|
|
62
|
-
# @param
|
|
63
|
-
# @param description [String, nil] description
|
|
62
|
+
# @param project [Hash] project
|
|
64
63
|
# @return [Hash] response data
|
|
65
|
-
def create_project(template_id:,
|
|
64
|
+
def create_project(template_id:, project:)
|
|
66
65
|
with_operation(service: "templates", operation: "create_project", is_mutation: true, resource_id: template_id) do
|
|
67
|
-
http_post("/templates/#{template_id}/project_constructions.json", body: compact_params(
|
|
66
|
+
http_post("/templates/#{template_id}/project_constructions.json", body: compact_params(project: project)).json
|
|
68
67
|
end
|
|
69
68
|
end
|
|
70
69
|
|
|
@@ -15,7 +15,7 @@ module Basecamp
|
|
|
15
15
|
# @return [Enumerator<Hash>] paginated results
|
|
16
16
|
def for_project(project_id:, from: nil, to: nil, person_id: nil)
|
|
17
17
|
wrap_paginated(service: "timesheets", operation: "for_project", is_mutation: false, project_id: project_id) do
|
|
18
|
-
params =
|
|
18
|
+
params = compact_query_params(from: from, to: to, person_id: person_id)
|
|
19
19
|
paginate("/projects/#{project_id}/timesheet.json", params: params)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -28,7 +28,7 @@ module Basecamp
|
|
|
28
28
|
# @return [Enumerator<Hash>] paginated results
|
|
29
29
|
def for_recording(recording_id:, from: nil, to: nil, person_id: nil)
|
|
30
30
|
wrap_paginated(service: "timesheets", operation: "for_recording", is_mutation: false, resource_id: recording_id) do
|
|
31
|
-
params =
|
|
31
|
+
params = compact_query_params(from: from, to: to, person_id: person_id)
|
|
32
32
|
paginate("/recordings/#{recording_id}/timesheet.json", params: params)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -53,7 +53,7 @@ module Basecamp
|
|
|
53
53
|
# @return [Hash] response data
|
|
54
54
|
def report(from: nil, to: nil, person_id: nil)
|
|
55
55
|
with_operation(service: "timesheets", operation: "report", is_mutation: false) do
|
|
56
|
-
http_get("/reports/timesheet.json", params:
|
|
56
|
+
http_get("/reports/timesheet.json", params: compact_query_params(from: from, to: to, person_id: person_id)).json
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -27,13 +27,24 @@ module Basecamp
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
# Reposition a to-do list within its to-do set.
|
|
31
|
+
# @param todolist_id [Integer] todolist id ID
|
|
32
|
+
# @param position [Integer] position
|
|
33
|
+
# @return [void]
|
|
34
|
+
def reposition(todolist_id:, position:)
|
|
35
|
+
with_operation(service: "todolists", operation: "reposition", is_mutation: true, resource_id: todolist_id) do
|
|
36
|
+
http_put("/todosets/todolists/#{todolist_id}/position.json", body: compact_params(position: position))
|
|
37
|
+
nil
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
30
41
|
# List todolists in a todoset
|
|
31
42
|
# @param todoset_id [Integer] todoset id ID
|
|
32
43
|
# @param status [String, nil] active|archived|trashed
|
|
33
44
|
# @return [Enumerator<Hash>] paginated results
|
|
34
45
|
def list(todoset_id:, status: nil)
|
|
35
46
|
wrap_paginated(service: "todolists", operation: "list", is_mutation: false, resource_id: todoset_id) do
|
|
36
|
-
params =
|
|
47
|
+
params = compact_query_params(status: status)
|
|
37
48
|
paginate("/todosets/#{todoset_id}/todolists.json", params: params)
|
|
38
49
|
end
|
|
39
50
|
end
|
|
@@ -42,10 +53,11 @@ module Basecamp
|
|
|
42
53
|
# @param todoset_id [Integer] todoset id ID
|
|
43
54
|
# @param name [String] name
|
|
44
55
|
# @param description [String, nil] description
|
|
56
|
+
# @param visible_to_clients [Boolean, nil] visible to clients
|
|
45
57
|
# @return [Hash] response data
|
|
46
|
-
def create(todoset_id:, name:, description: nil)
|
|
58
|
+
def create(todoset_id:, name:, description: nil, visible_to_clients: nil)
|
|
47
59
|
with_operation(service: "todolists", operation: "create", is_mutation: true, resource_id: todoset_id) do
|
|
48
|
-
http_post("/todosets/#{todoset_id}/todolists.json", body: compact_params(name: name, description: description)).json
|
|
60
|
+
http_post("/todosets/#{todoset_id}/todolists.json", body: compact_params(name: name, description: description, visible_to_clients: visible_to_clients)).json
|
|
49
61
|
end
|
|
50
62
|
end
|
|
51
63
|
end
|
|
@@ -14,7 +14,7 @@ module Basecamp
|
|
|
14
14
|
# @return [Enumerator<Hash>] paginated results
|
|
15
15
|
def list(todolist_id:, status: nil, completed: nil)
|
|
16
16
|
wrap_paginated(service: "todos", operation: "list", is_mutation: false, resource_id: todolist_id) do
|
|
17
|
-
params =
|
|
17
|
+
params = compact_query_params(status: status, completed: completed)
|
|
18
18
|
paginate("/todolists/#{todolist_id}/todos.json", params: params)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -44,9 +44,9 @@ module Basecamp
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
#
|
|
47
|
+
# Replace a todo with a new complete representation.
|
|
48
48
|
# @param todo_id [Integer] todo id ID
|
|
49
|
-
# @param content [String
|
|
49
|
+
# @param content [String] content
|
|
50
50
|
# @param description [String, nil] description
|
|
51
51
|
# @param assignee_ids [Array, nil] assignee ids
|
|
52
52
|
# @param completion_subscriber_ids [Array, nil] completion subscriber ids
|
|
@@ -54,8 +54,8 @@ module Basecamp
|
|
|
54
54
|
# @param due_on [String, nil] due on (YYYY-MM-DD)
|
|
55
55
|
# @param starts_on [String, nil] starts on (YYYY-MM-DD)
|
|
56
56
|
# @return [Hash] response data
|
|
57
|
-
def
|
|
58
|
-
with_operation(service: "todos", operation: "
|
|
57
|
+
def replace(todo_id:, content:, description: nil, assignee_ids: nil, completion_subscriber_ids: nil, notify: nil, due_on: nil, starts_on: nil)
|
|
58
|
+
with_operation(service: "todos", operation: "replace", is_mutation: true, resource_id: todo_id) do
|
|
59
59
|
http_put("/todos/#{todo_id}", body: compact_params(content: content, description: description, assignee_ids: assignee_ids, completion_subscriber_ids: completion_subscriber_ids, notify: notify, due_on: due_on, starts_on: starts_on)).json
|
|
60
60
|
end
|
|
61
61
|
end
|
|
@@ -7,13 +7,14 @@ module Basecamp
|
|
|
7
7
|
# @generated from OpenAPI spec
|
|
8
8
|
class ToolsService < BaseService
|
|
9
9
|
|
|
10
|
-
#
|
|
11
|
-
# @param
|
|
12
|
-
# @param
|
|
10
|
+
# Create a tool in a project dock
|
|
11
|
+
# @param bucket_id [Integer] bucket id ID
|
|
12
|
+
# @param tool_type [String] Tool type to add to the project dock. Values: Chat::Transcript|Inbox|Kanban::Board|Message::Board|Questionnaire|Schedule|Todoset|Vault.
|
|
13
|
+
# @param title [String, nil] Title for the new tool. When omitted, Basecamp assigns the next available default title for the tool type.
|
|
13
14
|
# @return [Hash] response data
|
|
14
|
-
def
|
|
15
|
-
with_operation(service: "tools", operation: "
|
|
16
|
-
http_post("/dock/tools.json", body: compact_params(
|
|
15
|
+
def create(bucket_id:, tool_type:, title: nil)
|
|
16
|
+
with_operation(service: "tools", operation: "create", is_mutation: true, project_id: bucket_id) do
|
|
17
|
+
http_post("/buckets/#{bucket_id}/dock/tools.json", body: compact_params(tool_type: tool_type, title: title)).json
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
|
|
@@ -51,10 +51,28 @@ module Basecamp
|
|
|
51
51
|
# @param description [String, nil] description
|
|
52
52
|
# @param base_name [String, nil] base name
|
|
53
53
|
# @param subscriptions [Array, nil] subscriptions
|
|
54
|
+
# @param visible_to_clients [Boolean, nil] visible to clients
|
|
54
55
|
# @return [Hash] response data
|
|
55
|
-
def create(vault_id:, attachable_sgid:, description: nil, base_name: nil, subscriptions: nil)
|
|
56
|
+
def create(vault_id:, attachable_sgid:, description: nil, base_name: nil, subscriptions: nil, visible_to_clients: nil)
|
|
56
57
|
with_operation(service: "uploads", operation: "create", is_mutation: true, resource_id: vault_id) do
|
|
57
|
-
http_post("/vaults/#{vault_id}/uploads.json", body: compact_params(attachable_sgid: attachable_sgid, description: description, base_name: base_name, subscriptions: subscriptions)).json
|
|
58
|
+
http_post("/vaults/#{vault_id}/uploads.json", body: compact_params(attachable_sgid: attachable_sgid, description: description, base_name: base_name, subscriptions: subscriptions, visible_to_clients: visible_to_clients)).json
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Download an upload's file content in one call.
|
|
63
|
+
# Fetches upload metadata, then delegates to the AccountClient download
|
|
64
|
+
# primitive so the auth'd-hop + 302-follow flow lives in one place.
|
|
65
|
+
# @param upload_id [Integer] upload id ID
|
|
66
|
+
# @return [Basecamp::DownloadResult]
|
|
67
|
+
def download(upload_id:)
|
|
68
|
+
with_operation(service: "uploads", operation: "download", is_mutation: false, resource_id: upload_id) do
|
|
69
|
+
upload = get(upload_id: upload_id)
|
|
70
|
+
url = upload["download_url"]
|
|
71
|
+
raise UsageError.new("upload #{upload_id} has no download_url") if url.nil? || url.empty?
|
|
72
|
+
|
|
73
|
+
result = @client.download_url(url)
|
|
74
|
+
filename = upload["filename"]
|
|
75
|
+
filename.to_s.empty? ? result : result.with(filename: filename)
|
|
58
76
|
end
|
|
59
77
|
end
|
|
60
78
|
end
|
|
@@ -11,7 +11,7 @@ module Basecamp
|
|
|
11
11
|
# @param bucket_id [Integer] bucket id ID
|
|
12
12
|
# @return [Enumerator<Hash>] paginated results
|
|
13
13
|
def list(bucket_id:)
|
|
14
|
-
wrap_paginated(service: "webhooks", operation: "list", is_mutation: false,
|
|
14
|
+
wrap_paginated(service: "webhooks", operation: "list", is_mutation: false, project_id: bucket_id) do
|
|
15
15
|
paginate("/buckets/#{bucket_id}/webhooks.json")
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -23,7 +23,7 @@ module Basecamp
|
|
|
23
23
|
# @param active [Boolean, nil] active
|
|
24
24
|
# @return [Hash] response data
|
|
25
25
|
def create(bucket_id:, payload_url:, types:, active: nil)
|
|
26
|
-
with_operation(service: "webhooks", operation: "create", is_mutation: true,
|
|
26
|
+
with_operation(service: "webhooks", operation: "create", is_mutation: true, project_id: bucket_id) do
|
|
27
27
|
http_post("/buckets/#{bucket_id}/webhooks.json", body: compact_params(payload_url: payload_url, types: types, active: active)).json
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Wormholes operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class WormholesService < BaseService
|
|
9
|
+
|
|
10
|
+
# Update a wormhole's destination column
|
|
11
|
+
# @param bucket_id [Integer] bucket id ID
|
|
12
|
+
# @param wormhole_id [Integer] wormhole id ID
|
|
13
|
+
# @param destination_recording_id [Integer] Id of the new destination column (on another accessible card table).
|
|
14
|
+
# @return [Hash] response data
|
|
15
|
+
def update(bucket_id:, wormhole_id:, destination_recording_id:)
|
|
16
|
+
with_operation(service: "wormholes", operation: "update", is_mutation: true, project_id: bucket_id, resource_id: wormhole_id) do
|
|
17
|
+
http_put("/buckets/#{bucket_id}/card_tables/wormholes/#{wormhole_id}", body: compact_params(destination_recording_id: destination_recording_id)).json
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Delete a wormhole
|
|
22
|
+
# @param bucket_id [Integer] bucket id ID
|
|
23
|
+
# @param wormhole_id [Integer] wormhole id ID
|
|
24
|
+
# @return [void]
|
|
25
|
+
def delete(bucket_id:, wormhole_id:)
|
|
26
|
+
with_operation(service: "wormholes", operation: "delete", is_mutation: true, project_id: bucket_id, resource_id: wormhole_id) do
|
|
27
|
+
http_delete("/buckets/#{bucket_id}/card_tables/wormholes/#{wormhole_id}")
|
|
28
|
+
nil
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Create a wormhole linking this card table to a column on another card table.
|
|
33
|
+
# @param bucket_id [Integer] bucket id ID
|
|
34
|
+
# @param card_table_id [Integer] card table id ID
|
|
35
|
+
# @param destination_recording_id [Integer] Id of the destination column (on another accessible card table) to link to.
|
|
36
|
+
# @return [Hash] response data
|
|
37
|
+
def create(bucket_id:, card_table_id:, destination_recording_id:)
|
|
38
|
+
with_operation(service: "wormholes", operation: "create", is_mutation: true, project_id: bucket_id, resource_id: card_table_id) do
|
|
39
|
+
http_post("/buckets/#{bucket_id}/card_tables/#{card_table_id}/wormholes.json", body: compact_params(destination_recording_id: destination_recording_id)).json
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|