basecamp-sdk 0.2.1
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 +7 -0
- data/.rubocop.yml +14 -0
- data/.yardopts +6 -0
- data/README.md +293 -0
- data/Rakefile +26 -0
- data/basecamp-sdk.gemspec +46 -0
- data/lib/basecamp/auth_strategy.rb +38 -0
- data/lib/basecamp/chain_hooks.rb +45 -0
- data/lib/basecamp/client.rb +428 -0
- data/lib/basecamp/config.rb +143 -0
- data/lib/basecamp/errors.rb +289 -0
- data/lib/basecamp/generated/metadata.json +2281 -0
- data/lib/basecamp/generated/services/attachments_service.rb +24 -0
- data/lib/basecamp/generated/services/boosts_service.rb +70 -0
- data/lib/basecamp/generated/services/campfires_service.rb +122 -0
- data/lib/basecamp/generated/services/card_columns_service.rb +103 -0
- data/lib/basecamp/generated/services/card_steps_service.rb +57 -0
- data/lib/basecamp/generated/services/card_tables_service.rb +20 -0
- data/lib/basecamp/generated/services/cards_service.rb +66 -0
- data/lib/basecamp/generated/services/checkins_service.rb +157 -0
- data/lib/basecamp/generated/services/client_approvals_service.rb +28 -0
- data/lib/basecamp/generated/services/client_correspondences_service.rb +28 -0
- data/lib/basecamp/generated/services/client_replies_service.rb +30 -0
- data/lib/basecamp/generated/services/client_visibility_service.rb +21 -0
- data/lib/basecamp/generated/services/comments_service.rb +49 -0
- data/lib/basecamp/generated/services/documents_service.rb +52 -0
- data/lib/basecamp/generated/services/events_service.rb +20 -0
- data/lib/basecamp/generated/services/forwards_service.rb +67 -0
- data/lib/basecamp/generated/services/lineup_service.rb +44 -0
- data/lib/basecamp/generated/services/message_boards_service.rb +20 -0
- data/lib/basecamp/generated/services/message_types_service.rb +59 -0
- data/lib/basecamp/generated/services/messages_service.rb +75 -0
- data/lib/basecamp/generated/services/people_service.rb +73 -0
- data/lib/basecamp/generated/services/projects_service.rb +63 -0
- data/lib/basecamp/generated/services/recordings_service.rb +64 -0
- data/lib/basecamp/generated/services/reports_service.rb +56 -0
- data/lib/basecamp/generated/services/schedules_service.rb +92 -0
- data/lib/basecamp/generated/services/search_service.rb +31 -0
- data/lib/basecamp/generated/services/subscriptions_service.rb +50 -0
- data/lib/basecamp/generated/services/templates_service.rb +82 -0
- data/lib/basecamp/generated/services/timeline_service.rb +20 -0
- data/lib/basecamp/generated/services/timesheets_service.rb +81 -0
- data/lib/basecamp/generated/services/todolist_groups_service.rb +41 -0
- data/lib/basecamp/generated/services/todolists_service.rb +53 -0
- data/lib/basecamp/generated/services/todos_service.rb +106 -0
- data/lib/basecamp/generated/services/todosets_service.rb +20 -0
- data/lib/basecamp/generated/services/tools_service.rb +80 -0
- data/lib/basecamp/generated/services/uploads_service.rb +61 -0
- data/lib/basecamp/generated/services/vaults_service.rb +49 -0
- data/lib/basecamp/generated/services/webhooks_service.rb +63 -0
- data/lib/basecamp/generated/types.rb +3196 -0
- data/lib/basecamp/hooks.rb +70 -0
- data/lib/basecamp/http.rb +440 -0
- data/lib/basecamp/logger_hooks.rb +46 -0
- data/lib/basecamp/noop_hooks.rb +9 -0
- data/lib/basecamp/oauth/discovery.rb +123 -0
- data/lib/basecamp/oauth/errors.rb +35 -0
- data/lib/basecamp/oauth/exchange.rb +291 -0
- data/lib/basecamp/oauth/pkce.rb +68 -0
- data/lib/basecamp/oauth/types.rb +133 -0
- data/lib/basecamp/oauth.rb +56 -0
- data/lib/basecamp/oauth_token_provider.rb +108 -0
- data/lib/basecamp/operation_info.rb +17 -0
- data/lib/basecamp/request_info.rb +10 -0
- data/lib/basecamp/request_result.rb +14 -0
- data/lib/basecamp/security.rb +112 -0
- data/lib/basecamp/services/attachments_service.rb +33 -0
- data/lib/basecamp/services/authorization_service.rb +47 -0
- data/lib/basecamp/services/base_service.rb +146 -0
- data/lib/basecamp/services/campfires_service.rb +141 -0
- data/lib/basecamp/services/card_columns_service.rb +106 -0
- data/lib/basecamp/services/card_steps_service.rb +86 -0
- data/lib/basecamp/services/card_tables_service.rb +23 -0
- data/lib/basecamp/services/cards_service.rb +93 -0
- data/lib/basecamp/services/checkins_service.rb +127 -0
- data/lib/basecamp/services/client_approvals_service.rb +33 -0
- data/lib/basecamp/services/client_correspondences_service.rb +33 -0
- data/lib/basecamp/services/client_replies_service.rb +35 -0
- data/lib/basecamp/services/comments_service.rb +63 -0
- data/lib/basecamp/services/documents_service.rb +74 -0
- data/lib/basecamp/services/events_service.rb +27 -0
- data/lib/basecamp/services/forwards_service.rb +80 -0
- data/lib/basecamp/services/lineup_service.rb +67 -0
- data/lib/basecamp/services/message_boards_service.rb +24 -0
- data/lib/basecamp/services/message_types_service.rb +79 -0
- data/lib/basecamp/services/messages_service.rb +133 -0
- data/lib/basecamp/services/people_service.rb +73 -0
- data/lib/basecamp/services/projects_service.rb +67 -0
- data/lib/basecamp/services/recordings_service.rb +127 -0
- data/lib/basecamp/services/reports_service.rb +80 -0
- data/lib/basecamp/services/schedules_service.rb +156 -0
- data/lib/basecamp/services/search_service.rb +36 -0
- data/lib/basecamp/services/subscriptions_service.rb +67 -0
- data/lib/basecamp/services/templates_service.rb +96 -0
- data/lib/basecamp/services/timeline_service.rb +62 -0
- data/lib/basecamp/services/timesheet_service.rb +68 -0
- data/lib/basecamp/services/todolist_groups_service.rb +100 -0
- data/lib/basecamp/services/todolists_service.rb +104 -0
- data/lib/basecamp/services/todos_service.rb +156 -0
- data/lib/basecamp/services/todosets_service.rb +23 -0
- data/lib/basecamp/services/tools_service.rb +89 -0
- data/lib/basecamp/services/uploads_service.rb +84 -0
- data/lib/basecamp/services/vaults_service.rb +84 -0
- data/lib/basecamp/services/webhooks_service.rb +88 -0
- data/lib/basecamp/static_token_provider.rb +24 -0
- data/lib/basecamp/token_provider.rb +42 -0
- data/lib/basecamp/version.rb +6 -0
- data/lib/basecamp/webhooks/event.rb +52 -0
- data/lib/basecamp/webhooks/rack_middleware.rb +49 -0
- data/lib/basecamp/webhooks/receiver.rb +161 -0
- data/lib/basecamp/webhooks/verify.rb +36 -0
- data/lib/basecamp.rb +107 -0
- data/scripts/generate-metadata.rb +106 -0
- data/scripts/generate-services.rb +778 -0
- data/scripts/generate-types.rb +191 -0
- metadata +316 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Reports operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class ReportsService < BaseService
|
|
9
|
+
|
|
10
|
+
# Get account-wide activity feed (progress report)
|
|
11
|
+
# @return [Enumerator<Hash>] paginated results
|
|
12
|
+
def progress()
|
|
13
|
+
wrap_paginated(service: "reports", operation: "progress", is_mutation: false) do
|
|
14
|
+
paginate("/reports/progress.json")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Get upcoming schedule entries within a date window
|
|
19
|
+
# @param window_starts_on [String, nil] window starts on
|
|
20
|
+
# @param window_ends_on [String, nil] window ends on
|
|
21
|
+
# @return [Hash] response data
|
|
22
|
+
def upcoming(window_starts_on: nil, window_ends_on: nil)
|
|
23
|
+
with_operation(service: "reports", operation: "upcoming", is_mutation: false) do
|
|
24
|
+
http_get("/reports/schedules/upcoming.json", params: compact_params(window_starts_on: window_starts_on, window_ends_on: window_ends_on)).json
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Get todos assigned to a specific person
|
|
29
|
+
# @param person_id [Integer] person id ID
|
|
30
|
+
# @param group_by [String, nil] Group by "bucket" or "date"
|
|
31
|
+
# @return [Hash] response data
|
|
32
|
+
def assigned(person_id:, group_by: nil)
|
|
33
|
+
with_operation(service: "reports", operation: "assigned", is_mutation: false, resource_id: person_id) do
|
|
34
|
+
http_get("/reports/todos/assigned/#{person_id}", params: compact_params(group_by: group_by)).json
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get overdue todos grouped by lateness
|
|
39
|
+
# @return [Hash] response data
|
|
40
|
+
def overdue()
|
|
41
|
+
with_operation(service: "reports", operation: "overdue", is_mutation: false) do
|
|
42
|
+
http_get("/reports/todos/overdue.json").json
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Get a person's activity timeline
|
|
47
|
+
# @param person_id [Integer] person id ID
|
|
48
|
+
# @return [Hash] response data
|
|
49
|
+
def person_progress(person_id:)
|
|
50
|
+
with_operation(service: "reports", operation: "person_progress", is_mutation: false, resource_id: person_id) do
|
|
51
|
+
http_get("/reports/users/progress/#{person_id}").json
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Schedules operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class SchedulesService < BaseService
|
|
9
|
+
|
|
10
|
+
# Get a single schedule entry by id.
|
|
11
|
+
# @param entry_id [Integer] entry id ID
|
|
12
|
+
# @return [Hash] response data
|
|
13
|
+
def get_entry(entry_id:)
|
|
14
|
+
with_operation(service: "schedules", operation: "get_entry", is_mutation: false, resource_id: entry_id) do
|
|
15
|
+
http_get("/schedule_entries/#{entry_id}").json
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Update an existing schedule entry
|
|
20
|
+
# @param entry_id [Integer] entry id ID
|
|
21
|
+
# @param summary [String, nil] summary
|
|
22
|
+
# @param starts_at [String, nil] starts at (RFC3339 (e.g., 2024-12-15T09:00:00Z))
|
|
23
|
+
# @param ends_at [String, nil] ends at (RFC3339 (e.g., 2024-12-15T09:00:00Z))
|
|
24
|
+
# @param description [String, nil] description
|
|
25
|
+
# @param participant_ids [Array, nil] participant ids
|
|
26
|
+
# @param all_day [Boolean, nil] all day
|
|
27
|
+
# @param notify [Boolean, nil] notify
|
|
28
|
+
# @return [Hash] response data
|
|
29
|
+
def update_entry(entry_id:, summary: nil, starts_at: nil, ends_at: nil, description: nil, participant_ids: nil, all_day: nil, notify: nil)
|
|
30
|
+
with_operation(service: "schedules", operation: "update_entry", is_mutation: true, resource_id: entry_id) do
|
|
31
|
+
http_put("/schedule_entries/#{entry_id}", 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)).json
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Get a specific occurrence of a recurring schedule entry
|
|
36
|
+
# @param entry_id [Integer] entry id ID
|
|
37
|
+
# @param date [String] date ID
|
|
38
|
+
# @return [Hash] response data
|
|
39
|
+
def get_entry_occurrence(entry_id:, date:)
|
|
40
|
+
with_operation(service: "schedules", operation: "get_entry_occurrence", is_mutation: false, resource_id: date) do
|
|
41
|
+
http_get("/schedule_entries/#{entry_id}/occurrences/#{date}").json
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Get a schedule
|
|
46
|
+
# @param schedule_id [Integer] schedule id ID
|
|
47
|
+
# @return [Hash] response data
|
|
48
|
+
def get(schedule_id:)
|
|
49
|
+
with_operation(service: "schedules", operation: "get", is_mutation: false, resource_id: schedule_id) do
|
|
50
|
+
http_get("/schedules/#{schedule_id}").json
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Update schedule settings
|
|
55
|
+
# @param schedule_id [Integer] schedule id ID
|
|
56
|
+
# @param include_due_assignments [Boolean] include due assignments
|
|
57
|
+
# @return [Hash] response data
|
|
58
|
+
def update_settings(schedule_id:, include_due_assignments:)
|
|
59
|
+
with_operation(service: "schedules", operation: "update_settings", is_mutation: true, resource_id: schedule_id) do
|
|
60
|
+
http_put("/schedules/#{schedule_id}", body: compact_params(include_due_assignments: include_due_assignments)).json
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# List entries on a schedule
|
|
65
|
+
# @param schedule_id [Integer] schedule id ID
|
|
66
|
+
# @param status [String, nil] active|archived|trashed
|
|
67
|
+
# @return [Enumerator<Hash>] paginated results
|
|
68
|
+
def list_entries(schedule_id:, status: nil)
|
|
69
|
+
wrap_paginated(service: "schedules", operation: "list_entries", is_mutation: false, resource_id: schedule_id) do
|
|
70
|
+
params = compact_params(status: status)
|
|
71
|
+
paginate("/schedules/#{schedule_id}/entries.json", params: params)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Create a new schedule entry
|
|
76
|
+
# @param schedule_id [Integer] schedule id ID
|
|
77
|
+
# @param summary [String] summary
|
|
78
|
+
# @param starts_at [String] starts at (RFC3339 (e.g., 2024-12-15T09:00:00Z))
|
|
79
|
+
# @param ends_at [String] ends at (RFC3339 (e.g., 2024-12-15T09:00:00Z))
|
|
80
|
+
# @param description [String, nil] description
|
|
81
|
+
# @param participant_ids [Array, nil] participant ids
|
|
82
|
+
# @param all_day [Boolean, nil] all day
|
|
83
|
+
# @param notify [Boolean, nil] notify
|
|
84
|
+
# @return [Hash] response data
|
|
85
|
+
def create_entry(schedule_id:, summary:, starts_at:, ends_at:, description: nil, participant_ids: nil, all_day: nil, notify: nil)
|
|
86
|
+
with_operation(service: "schedules", operation: "create_entry", is_mutation: true, resource_id: schedule_id) do
|
|
87
|
+
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)).json
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Search operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class SearchService < BaseService
|
|
9
|
+
|
|
10
|
+
# Search for content across the account
|
|
11
|
+
# @param query [String] query
|
|
12
|
+
# @param sort [String, nil] created_at|updated_at
|
|
13
|
+
# @param page [Integer, nil] page
|
|
14
|
+
# @return [Enumerator<Hash>] paginated results
|
|
15
|
+
def search(query:, sort: nil, page: nil)
|
|
16
|
+
wrap_paginated(service: "search", operation: "search", is_mutation: false) do
|
|
17
|
+
params = compact_params(query: query, sort: sort, page: page)
|
|
18
|
+
paginate("/search.json", params: params)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Get search metadata (available filter options)
|
|
23
|
+
# @return [Hash] response data
|
|
24
|
+
def metadata()
|
|
25
|
+
with_operation(service: "search", operation: "metadata", is_mutation: false) do
|
|
26
|
+
http_get("/searches/metadata.json").json
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Subscriptions operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class SubscriptionsService < BaseService
|
|
9
|
+
|
|
10
|
+
# Get subscription information for a recording
|
|
11
|
+
# @param recording_id [Integer] recording id ID
|
|
12
|
+
# @return [Hash] response data
|
|
13
|
+
def get(recording_id:)
|
|
14
|
+
with_operation(service: "subscriptions", operation: "get", is_mutation: false, resource_id: recording_id) do
|
|
15
|
+
http_get("/recordings/#{recording_id}/subscription.json").json
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Subscribe the current user to a recording
|
|
20
|
+
# @param recording_id [Integer] recording id ID
|
|
21
|
+
# @return [Hash] response data
|
|
22
|
+
def subscribe(recording_id:)
|
|
23
|
+
with_operation(service: "subscriptions", operation: "subscribe", is_mutation: true, resource_id: recording_id) do
|
|
24
|
+
http_post("/recordings/#{recording_id}/subscription.json").json
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Update subscriptions by adding or removing specific users
|
|
29
|
+
# @param recording_id [Integer] recording id ID
|
|
30
|
+
# @param subscriptions [Array, nil] subscriptions
|
|
31
|
+
# @param unsubscriptions [Array, nil] unsubscriptions
|
|
32
|
+
# @return [Hash] response data
|
|
33
|
+
def update(recording_id:, subscriptions: nil, unsubscriptions: nil)
|
|
34
|
+
with_operation(service: "subscriptions", operation: "update", is_mutation: true, resource_id: recording_id) do
|
|
35
|
+
http_put("/recordings/#{recording_id}/subscription.json", body: compact_params(subscriptions: subscriptions, unsubscriptions: unsubscriptions)).json
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Unsubscribe the current user from a recording
|
|
40
|
+
# @param recording_id [Integer] recording id ID
|
|
41
|
+
# @return [void]
|
|
42
|
+
def unsubscribe(recording_id:)
|
|
43
|
+
with_operation(service: "subscriptions", operation: "unsubscribe", is_mutation: true, resource_id: recording_id) do
|
|
44
|
+
http_delete("/recordings/#{recording_id}/subscription.json")
|
|
45
|
+
nil
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Templates operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class TemplatesService < BaseService
|
|
9
|
+
|
|
10
|
+
# List all templates visible to the current user
|
|
11
|
+
# @param status [String, nil] active|archived|trashed
|
|
12
|
+
# @return [Enumerator<Hash>] paginated results
|
|
13
|
+
def list(status: nil)
|
|
14
|
+
wrap_paginated(service: "templates", operation: "list", is_mutation: false) do
|
|
15
|
+
params = compact_params(status: status)
|
|
16
|
+
paginate("/templates.json", params: params)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Create a new template
|
|
21
|
+
# @param name [String] name
|
|
22
|
+
# @param description [String, nil] description
|
|
23
|
+
# @return [Hash] response data
|
|
24
|
+
def create(name:, description: nil)
|
|
25
|
+
with_operation(service: "templates", operation: "create", is_mutation: true) do
|
|
26
|
+
http_post("/templates.json", body: compact_params(name: name, description: description)).json
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Get a single template by id
|
|
31
|
+
# @param template_id [Integer] template id ID
|
|
32
|
+
# @return [Hash] response data
|
|
33
|
+
def get(template_id:)
|
|
34
|
+
with_operation(service: "templates", operation: "get", is_mutation: false, resource_id: template_id) do
|
|
35
|
+
http_get("/templates/#{template_id}").json
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Update an existing template
|
|
40
|
+
# @param template_id [Integer] template id ID
|
|
41
|
+
# @param name [String, nil] name
|
|
42
|
+
# @param description [String, nil] description
|
|
43
|
+
# @return [Hash] response data
|
|
44
|
+
def update(template_id:, name: nil, description: nil)
|
|
45
|
+
with_operation(service: "templates", operation: "update", is_mutation: true, resource_id: template_id) do
|
|
46
|
+
http_put("/templates/#{template_id}", body: compact_params(name: name, description: description)).json
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Delete a template (trash it)
|
|
51
|
+
# @param template_id [Integer] template id ID
|
|
52
|
+
# @return [void]
|
|
53
|
+
def delete(template_id:)
|
|
54
|
+
with_operation(service: "templates", operation: "delete", is_mutation: true, resource_id: template_id) do
|
|
55
|
+
http_delete("/templates/#{template_id}")
|
|
56
|
+
nil
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Create a project from a template (asynchronous)
|
|
61
|
+
# @param template_id [Integer] template id ID
|
|
62
|
+
# @param name [String] name
|
|
63
|
+
# @param description [String, nil] description
|
|
64
|
+
# @return [Hash] response data
|
|
65
|
+
def create_project(template_id:, name:, description: nil)
|
|
66
|
+
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(name: name, description: description)).json
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Get the status of a project construction
|
|
72
|
+
# @param template_id [Integer] template id ID
|
|
73
|
+
# @param construction_id [Integer] construction id ID
|
|
74
|
+
# @return [Hash] response data
|
|
75
|
+
def get_construction(template_id:, construction_id:)
|
|
76
|
+
with_operation(service: "templates", operation: "get_construction", is_mutation: false, resource_id: construction_id) do
|
|
77
|
+
http_get("/templates/#{template_id}/project_constructions/#{construction_id}").json
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Timeline operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class TimelineService < BaseService
|
|
9
|
+
|
|
10
|
+
# Get project timeline
|
|
11
|
+
# @param project_id [Integer] project id ID
|
|
12
|
+
# @return [Enumerator<Hash>] paginated results
|
|
13
|
+
def get_project_timeline(project_id:)
|
|
14
|
+
wrap_paginated(service: "timeline", operation: "get_project_timeline", is_mutation: false, project_id: project_id) do
|
|
15
|
+
paginate("/projects/#{project_id}/timeline.json")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Timesheets operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class TimesheetsService < BaseService
|
|
9
|
+
|
|
10
|
+
# Get timesheet for a specific project
|
|
11
|
+
# @param project_id [Integer] project id ID
|
|
12
|
+
# @param from [String, nil] from
|
|
13
|
+
# @param to [String, nil] to
|
|
14
|
+
# @param person_id [Integer, nil] person id
|
|
15
|
+
# @return [Hash] response data
|
|
16
|
+
def for_project(project_id:, from: nil, to: nil, person_id: nil)
|
|
17
|
+
with_operation(service: "timesheets", operation: "for_project", is_mutation: false, project_id: project_id) do
|
|
18
|
+
http_get("/projects/#{project_id}/timesheet.json", params: compact_params(from: from, to: to, person_id: person_id)).json
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Get timesheet for a specific recording
|
|
23
|
+
# @param recording_id [Integer] recording id ID
|
|
24
|
+
# @param from [String, nil] from
|
|
25
|
+
# @param to [String, nil] to
|
|
26
|
+
# @param person_id [Integer, nil] person id
|
|
27
|
+
# @return [Hash] response data
|
|
28
|
+
def for_recording(recording_id:, from: nil, to: nil, person_id: nil)
|
|
29
|
+
with_operation(service: "timesheets", operation: "for_recording", is_mutation: false, resource_id: recording_id) do
|
|
30
|
+
http_get("/recordings/#{recording_id}/timesheet.json", params: compact_params(from: from, to: to, person_id: person_id)).json
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Create a timesheet entry on a recording
|
|
35
|
+
# @param recording_id [Integer] recording id ID
|
|
36
|
+
# @param date [String] date
|
|
37
|
+
# @param hours [String] hours
|
|
38
|
+
# @param description [String, nil] description
|
|
39
|
+
# @param person_id [Integer, nil] person id
|
|
40
|
+
# @return [Hash] response data
|
|
41
|
+
def create(recording_id:, date:, hours:, description: nil, person_id: nil)
|
|
42
|
+
with_operation(service: "timesheets", operation: "create", is_mutation: true, resource_id: recording_id) do
|
|
43
|
+
http_post("/recordings/#{recording_id}/timesheet/entries.json", body: compact_params(date: date, hours: hours, description: description, person_id: person_id)).json
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get account-wide timesheet report
|
|
48
|
+
# @param from [String, nil] from
|
|
49
|
+
# @param to [String, nil] to
|
|
50
|
+
# @param person_id [Integer, nil] person id
|
|
51
|
+
# @return [Hash] response data
|
|
52
|
+
def report(from: nil, to: nil, person_id: nil)
|
|
53
|
+
with_operation(service: "timesheets", operation: "report", is_mutation: false) do
|
|
54
|
+
http_get("/reports/timesheet.json", params: compact_params(from: from, to: to, person_id: person_id)).json
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Get a single timesheet entry
|
|
59
|
+
# @param entry_id [Integer] entry id ID
|
|
60
|
+
# @return [Hash] response data
|
|
61
|
+
def get(entry_id:)
|
|
62
|
+
with_operation(service: "timesheets", operation: "get", is_mutation: false, resource_id: entry_id) do
|
|
63
|
+
http_get("/timesheet_entries/#{entry_id}").json
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Update a timesheet entry
|
|
68
|
+
# @param entry_id [Integer] entry id ID
|
|
69
|
+
# @param date [String, nil] date
|
|
70
|
+
# @param hours [String, nil] hours
|
|
71
|
+
# @param description [String, nil] description
|
|
72
|
+
# @param person_id [Integer, nil] person id
|
|
73
|
+
# @return [Hash] response data
|
|
74
|
+
def update(entry_id:, date: nil, hours: nil, description: nil, person_id: nil)
|
|
75
|
+
with_operation(service: "timesheets", operation: "update", is_mutation: true, resource_id: entry_id) do
|
|
76
|
+
http_put("/timesheet_entries/#{entry_id}", body: compact_params(date: date, hours: hours, description: description, person_id: person_id)).json
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for TodolistGroups operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class TodolistGroupsService < BaseService
|
|
9
|
+
|
|
10
|
+
# Reposition a todolist group
|
|
11
|
+
# @param group_id [Integer] group id ID
|
|
12
|
+
# @param position [Integer] position
|
|
13
|
+
# @return [void]
|
|
14
|
+
def reposition(group_id:, position:)
|
|
15
|
+
with_operation(service: "todolistgroups", operation: "reposition", is_mutation: true, resource_id: group_id) do
|
|
16
|
+
http_put("/todolists/#{group_id}/position.json", body: compact_params(position: position))
|
|
17
|
+
nil
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# List groups in a todolist
|
|
22
|
+
# @param todolist_id [Integer] todolist id ID
|
|
23
|
+
# @return [Enumerator<Hash>] paginated results
|
|
24
|
+
def list(todolist_id:)
|
|
25
|
+
wrap_paginated(service: "todolistgroups", operation: "list", is_mutation: false, resource_id: todolist_id) do
|
|
26
|
+
paginate("/todolists/#{todolist_id}/groups.json")
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Create a new group in a todolist
|
|
31
|
+
# @param todolist_id [Integer] todolist id ID
|
|
32
|
+
# @param name [String] name
|
|
33
|
+
# @return [Hash] response data
|
|
34
|
+
def create(todolist_id:, name:)
|
|
35
|
+
with_operation(service: "todolistgroups", operation: "create", is_mutation: true, resource_id: todolist_id) do
|
|
36
|
+
http_post("/todolists/#{todolist_id}/groups.json", body: compact_params(name: name)).json
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Todolists operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class TodolistsService < BaseService
|
|
9
|
+
|
|
10
|
+
# Get a single todolist or todolist group by id
|
|
11
|
+
# @param id [Integer] id ID
|
|
12
|
+
# @return [Hash] response data
|
|
13
|
+
def get(id:)
|
|
14
|
+
with_operation(service: "todolists", operation: "get", is_mutation: false, resource_id: id) do
|
|
15
|
+
http_get("/todolists/#{id}").json
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Update an existing todolist or todolist group
|
|
20
|
+
# @param id [Integer] id ID
|
|
21
|
+
# @param name [String, nil] Name (required for both Todolist and TodolistGroup)
|
|
22
|
+
# @param description [String, nil] Description (Todolist only, ignored for groups)
|
|
23
|
+
# @return [Hash] response data
|
|
24
|
+
def update(id:, name: nil, description: nil)
|
|
25
|
+
with_operation(service: "todolists", operation: "update", is_mutation: true, resource_id: id) do
|
|
26
|
+
http_put("/todolists/#{id}", body: compact_params(name: name, description: description)).json
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# List todolists in a todoset
|
|
31
|
+
# @param todoset_id [Integer] todoset id ID
|
|
32
|
+
# @param status [String, nil] active|archived|trashed
|
|
33
|
+
# @return [Enumerator<Hash>] paginated results
|
|
34
|
+
def list(todoset_id:, status: nil)
|
|
35
|
+
wrap_paginated(service: "todolists", operation: "list", is_mutation: false, resource_id: todoset_id) do
|
|
36
|
+
params = compact_params(status: status)
|
|
37
|
+
paginate("/todosets/#{todoset_id}/todolists.json", params: params)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Create a new todolist in a todoset
|
|
42
|
+
# @param todoset_id [Integer] todoset id ID
|
|
43
|
+
# @param name [String] name
|
|
44
|
+
# @param description [String, nil] description
|
|
45
|
+
# @return [Hash] response data
|
|
46
|
+
def create(todoset_id:, name:, description: nil)
|
|
47
|
+
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
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Todos operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class TodosService < BaseService
|
|
9
|
+
|
|
10
|
+
# List todos in a todolist
|
|
11
|
+
# @param todolist_id [Integer] todolist id ID
|
|
12
|
+
# @param status [String, nil] active|archived|trashed
|
|
13
|
+
# @param completed [Boolean, nil] completed
|
|
14
|
+
# @return [Enumerator<Hash>] paginated results
|
|
15
|
+
def list(todolist_id:, status: nil, completed: nil)
|
|
16
|
+
wrap_paginated(service: "todos", operation: "list", is_mutation: false, resource_id: todolist_id) do
|
|
17
|
+
params = compact_params(status: status, completed: completed)
|
|
18
|
+
paginate("/todolists/#{todolist_id}/todos.json", params: params)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Create a new todo in a todolist
|
|
23
|
+
# @param todolist_id [Integer] todolist id ID
|
|
24
|
+
# @param content [String] content
|
|
25
|
+
# @param description [String, nil] description
|
|
26
|
+
# @param assignee_ids [Array, nil] assignee ids
|
|
27
|
+
# @param completion_subscriber_ids [Array, nil] completion subscriber ids
|
|
28
|
+
# @param notify [Boolean, nil] notify
|
|
29
|
+
# @param due_on [String, nil] due on (YYYY-MM-DD)
|
|
30
|
+
# @param starts_on [String, nil] starts on (YYYY-MM-DD)
|
|
31
|
+
# @return [Hash] response data
|
|
32
|
+
def create(todolist_id:, content:, description: nil, assignee_ids: nil, completion_subscriber_ids: nil, notify: nil, due_on: nil, starts_on: nil)
|
|
33
|
+
with_operation(service: "todos", operation: "create", is_mutation: true, resource_id: todolist_id) do
|
|
34
|
+
http_post("/todolists/#{todolist_id}/todos.json", 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
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get a single todo by id
|
|
39
|
+
# @param todo_id [Integer] todo id ID
|
|
40
|
+
# @return [Hash] response data
|
|
41
|
+
def get(todo_id:)
|
|
42
|
+
with_operation(service: "todos", operation: "get", is_mutation: false, resource_id: todo_id) do
|
|
43
|
+
http_get("/todos/#{todo_id}").json
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Update an existing todo
|
|
48
|
+
# @param todo_id [Integer] todo id ID
|
|
49
|
+
# @param content [String, nil] content
|
|
50
|
+
# @param description [String, nil] description
|
|
51
|
+
# @param assignee_ids [Array, nil] assignee ids
|
|
52
|
+
# @param completion_subscriber_ids [Array, nil] completion subscriber ids
|
|
53
|
+
# @param notify [Boolean, nil] notify
|
|
54
|
+
# @param due_on [String, nil] due on (YYYY-MM-DD)
|
|
55
|
+
# @param starts_on [String, nil] starts on (YYYY-MM-DD)
|
|
56
|
+
# @return [Hash] response data
|
|
57
|
+
def update(todo_id:, content: nil, description: nil, assignee_ids: nil, completion_subscriber_ids: nil, notify: nil, due_on: nil, starts_on: nil)
|
|
58
|
+
with_operation(service: "todos", operation: "update", is_mutation: true, resource_id: todo_id) do
|
|
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
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Trash a todo (returns 204 No Content)
|
|
64
|
+
# @param todo_id [Integer] todo id ID
|
|
65
|
+
# @return [void]
|
|
66
|
+
def trash(todo_id:)
|
|
67
|
+
with_operation(service: "todos", operation: "trash", is_mutation: true, resource_id: todo_id) do
|
|
68
|
+
http_delete("/todos/#{todo_id}")
|
|
69
|
+
nil
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Mark a todo as complete
|
|
74
|
+
# @param todo_id [Integer] todo id ID
|
|
75
|
+
# @return [void]
|
|
76
|
+
def complete(todo_id:)
|
|
77
|
+
with_operation(service: "todos", operation: "complete", is_mutation: true, resource_id: todo_id) do
|
|
78
|
+
http_post("/todos/#{todo_id}/completion.json")
|
|
79
|
+
nil
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Mark a todo as incomplete
|
|
84
|
+
# @param todo_id [Integer] todo id ID
|
|
85
|
+
# @return [void]
|
|
86
|
+
def uncomplete(todo_id:)
|
|
87
|
+
with_operation(service: "todos", operation: "uncomplete", is_mutation: true, resource_id: todo_id) do
|
|
88
|
+
http_delete("/todos/#{todo_id}/completion.json")
|
|
89
|
+
nil
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Reposition a todo within its todolist
|
|
94
|
+
# @param todo_id [Integer] todo id ID
|
|
95
|
+
# @param position [Integer] position
|
|
96
|
+
# @param parent_id [Integer, nil] Optional todolist ID to move the todo to a different parent
|
|
97
|
+
# @return [void]
|
|
98
|
+
def reposition(todo_id:, position:, parent_id: nil)
|
|
99
|
+
with_operation(service: "todos", operation: "reposition", is_mutation: true, resource_id: todo_id) do
|
|
100
|
+
http_put("/todos/#{todo_id}/position.json", body: compact_params(position: position, parent_id: parent_id))
|
|
101
|
+
nil
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Basecamp
|
|
4
|
+
module Services
|
|
5
|
+
# Service for Todosets operations
|
|
6
|
+
#
|
|
7
|
+
# @generated from OpenAPI spec
|
|
8
|
+
class TodosetsService < BaseService
|
|
9
|
+
|
|
10
|
+
# Get a todoset (container for todolists in a project)
|
|
11
|
+
# @param todoset_id [Integer] todoset id ID
|
|
12
|
+
# @return [Hash] response data
|
|
13
|
+
def get(todoset_id:)
|
|
14
|
+
with_operation(service: "todosets", operation: "get", is_mutation: false, resource_id: todoset_id) do
|
|
15
|
+
http_get("/todosets/#{todoset_id}").json
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|