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.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +14 -0
  3. data/.yardopts +6 -0
  4. data/README.md +293 -0
  5. data/Rakefile +26 -0
  6. data/basecamp-sdk.gemspec +46 -0
  7. data/lib/basecamp/auth_strategy.rb +38 -0
  8. data/lib/basecamp/chain_hooks.rb +45 -0
  9. data/lib/basecamp/client.rb +428 -0
  10. data/lib/basecamp/config.rb +143 -0
  11. data/lib/basecamp/errors.rb +289 -0
  12. data/lib/basecamp/generated/metadata.json +2281 -0
  13. data/lib/basecamp/generated/services/attachments_service.rb +24 -0
  14. data/lib/basecamp/generated/services/boosts_service.rb +70 -0
  15. data/lib/basecamp/generated/services/campfires_service.rb +122 -0
  16. data/lib/basecamp/generated/services/card_columns_service.rb +103 -0
  17. data/lib/basecamp/generated/services/card_steps_service.rb +57 -0
  18. data/lib/basecamp/generated/services/card_tables_service.rb +20 -0
  19. data/lib/basecamp/generated/services/cards_service.rb +66 -0
  20. data/lib/basecamp/generated/services/checkins_service.rb +157 -0
  21. data/lib/basecamp/generated/services/client_approvals_service.rb +28 -0
  22. data/lib/basecamp/generated/services/client_correspondences_service.rb +28 -0
  23. data/lib/basecamp/generated/services/client_replies_service.rb +30 -0
  24. data/lib/basecamp/generated/services/client_visibility_service.rb +21 -0
  25. data/lib/basecamp/generated/services/comments_service.rb +49 -0
  26. data/lib/basecamp/generated/services/documents_service.rb +52 -0
  27. data/lib/basecamp/generated/services/events_service.rb +20 -0
  28. data/lib/basecamp/generated/services/forwards_service.rb +67 -0
  29. data/lib/basecamp/generated/services/lineup_service.rb +44 -0
  30. data/lib/basecamp/generated/services/message_boards_service.rb +20 -0
  31. data/lib/basecamp/generated/services/message_types_service.rb +59 -0
  32. data/lib/basecamp/generated/services/messages_service.rb +75 -0
  33. data/lib/basecamp/generated/services/people_service.rb +73 -0
  34. data/lib/basecamp/generated/services/projects_service.rb +63 -0
  35. data/lib/basecamp/generated/services/recordings_service.rb +64 -0
  36. data/lib/basecamp/generated/services/reports_service.rb +56 -0
  37. data/lib/basecamp/generated/services/schedules_service.rb +92 -0
  38. data/lib/basecamp/generated/services/search_service.rb +31 -0
  39. data/lib/basecamp/generated/services/subscriptions_service.rb +50 -0
  40. data/lib/basecamp/generated/services/templates_service.rb +82 -0
  41. data/lib/basecamp/generated/services/timeline_service.rb +20 -0
  42. data/lib/basecamp/generated/services/timesheets_service.rb +81 -0
  43. data/lib/basecamp/generated/services/todolist_groups_service.rb +41 -0
  44. data/lib/basecamp/generated/services/todolists_service.rb +53 -0
  45. data/lib/basecamp/generated/services/todos_service.rb +106 -0
  46. data/lib/basecamp/generated/services/todosets_service.rb +20 -0
  47. data/lib/basecamp/generated/services/tools_service.rb +80 -0
  48. data/lib/basecamp/generated/services/uploads_service.rb +61 -0
  49. data/lib/basecamp/generated/services/vaults_service.rb +49 -0
  50. data/lib/basecamp/generated/services/webhooks_service.rb +63 -0
  51. data/lib/basecamp/generated/types.rb +3196 -0
  52. data/lib/basecamp/hooks.rb +70 -0
  53. data/lib/basecamp/http.rb +440 -0
  54. data/lib/basecamp/logger_hooks.rb +46 -0
  55. data/lib/basecamp/noop_hooks.rb +9 -0
  56. data/lib/basecamp/oauth/discovery.rb +123 -0
  57. data/lib/basecamp/oauth/errors.rb +35 -0
  58. data/lib/basecamp/oauth/exchange.rb +291 -0
  59. data/lib/basecamp/oauth/pkce.rb +68 -0
  60. data/lib/basecamp/oauth/types.rb +133 -0
  61. data/lib/basecamp/oauth.rb +56 -0
  62. data/lib/basecamp/oauth_token_provider.rb +108 -0
  63. data/lib/basecamp/operation_info.rb +17 -0
  64. data/lib/basecamp/request_info.rb +10 -0
  65. data/lib/basecamp/request_result.rb +14 -0
  66. data/lib/basecamp/security.rb +112 -0
  67. data/lib/basecamp/services/attachments_service.rb +33 -0
  68. data/lib/basecamp/services/authorization_service.rb +47 -0
  69. data/lib/basecamp/services/base_service.rb +146 -0
  70. data/lib/basecamp/services/campfires_service.rb +141 -0
  71. data/lib/basecamp/services/card_columns_service.rb +106 -0
  72. data/lib/basecamp/services/card_steps_service.rb +86 -0
  73. data/lib/basecamp/services/card_tables_service.rb +23 -0
  74. data/lib/basecamp/services/cards_service.rb +93 -0
  75. data/lib/basecamp/services/checkins_service.rb +127 -0
  76. data/lib/basecamp/services/client_approvals_service.rb +33 -0
  77. data/lib/basecamp/services/client_correspondences_service.rb +33 -0
  78. data/lib/basecamp/services/client_replies_service.rb +35 -0
  79. data/lib/basecamp/services/comments_service.rb +63 -0
  80. data/lib/basecamp/services/documents_service.rb +74 -0
  81. data/lib/basecamp/services/events_service.rb +27 -0
  82. data/lib/basecamp/services/forwards_service.rb +80 -0
  83. data/lib/basecamp/services/lineup_service.rb +67 -0
  84. data/lib/basecamp/services/message_boards_service.rb +24 -0
  85. data/lib/basecamp/services/message_types_service.rb +79 -0
  86. data/lib/basecamp/services/messages_service.rb +133 -0
  87. data/lib/basecamp/services/people_service.rb +73 -0
  88. data/lib/basecamp/services/projects_service.rb +67 -0
  89. data/lib/basecamp/services/recordings_service.rb +127 -0
  90. data/lib/basecamp/services/reports_service.rb +80 -0
  91. data/lib/basecamp/services/schedules_service.rb +156 -0
  92. data/lib/basecamp/services/search_service.rb +36 -0
  93. data/lib/basecamp/services/subscriptions_service.rb +67 -0
  94. data/lib/basecamp/services/templates_service.rb +96 -0
  95. data/lib/basecamp/services/timeline_service.rb +62 -0
  96. data/lib/basecamp/services/timesheet_service.rb +68 -0
  97. data/lib/basecamp/services/todolist_groups_service.rb +100 -0
  98. data/lib/basecamp/services/todolists_service.rb +104 -0
  99. data/lib/basecamp/services/todos_service.rb +156 -0
  100. data/lib/basecamp/services/todosets_service.rb +23 -0
  101. data/lib/basecamp/services/tools_service.rb +89 -0
  102. data/lib/basecamp/services/uploads_service.rb +84 -0
  103. data/lib/basecamp/services/vaults_service.rb +84 -0
  104. data/lib/basecamp/services/webhooks_service.rb +88 -0
  105. data/lib/basecamp/static_token_provider.rb +24 -0
  106. data/lib/basecamp/token_provider.rb +42 -0
  107. data/lib/basecamp/version.rb +6 -0
  108. data/lib/basecamp/webhooks/event.rb +52 -0
  109. data/lib/basecamp/webhooks/rack_middleware.rb +49 -0
  110. data/lib/basecamp/webhooks/receiver.rb +161 -0
  111. data/lib/basecamp/webhooks/verify.rb +36 -0
  112. data/lib/basecamp.rb +107 -0
  113. data/scripts/generate-metadata.rb +106 -0
  114. data/scripts/generate-services.rb +778 -0
  115. data/scripts/generate-types.rb +191 -0
  116. metadata +316 -0
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "uri"
4
+
5
+ module Basecamp
6
+ module Services
7
+ # Service for Attachments operations
8
+ #
9
+ # @generated from OpenAPI spec
10
+ class AttachmentsService < BaseService
11
+
12
+ # Create an attachment (upload a file for embedding)
13
+ # @param data [String] Binary file data to upload
14
+ # @param content_type [String] MIME type of the file (e.g., "application/pdf", "image/png")
15
+ # @param name [String] name
16
+ # @return [Hash] response data
17
+ def create(data:, content_type:, name:)
18
+ with_operation(service: "attachments", operation: "create", is_mutation: true) do
19
+ http_post_raw("/attachments.json?name=#{URI.encode_www_form_component(name.to_s)}", body: data, content_type: content_type).json
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for Boosts operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class BoostsService < BaseService
9
+
10
+ # Get a single boost
11
+ # @param boost_id [Integer] boost id ID
12
+ # @return [Hash] response data
13
+ def get_boost(boost_id:)
14
+ with_operation(service: "boosts", operation: "get_boost", is_mutation: false, resource_id: boost_id) do
15
+ http_get("/boosts/#{boost_id}").json
16
+ end
17
+ end
18
+
19
+ # Delete a boost
20
+ # @param boost_id [Integer] boost id ID
21
+ # @return [void]
22
+ def delete_boost(boost_id:)
23
+ with_operation(service: "boosts", operation: "delete_boost", is_mutation: true, resource_id: boost_id) do
24
+ http_delete("/boosts/#{boost_id}")
25
+ nil
26
+ end
27
+ end
28
+
29
+ # List boosts on a recording
30
+ # @param recording_id [Integer] recording id ID
31
+ # @return [Enumerator<Hash>] paginated results
32
+ def list_recording_boosts(recording_id:)
33
+ wrap_paginated(service: "boosts", operation: "list_recording_boosts", is_mutation: false, resource_id: recording_id) do
34
+ paginate("/recordings/#{recording_id}/boosts.json")
35
+ end
36
+ end
37
+
38
+ # Create a boost on a recording
39
+ # @param recording_id [Integer] recording id ID
40
+ # @param content [String] content
41
+ # @return [Hash] response data
42
+ def create_recording_boost(recording_id:, content:)
43
+ with_operation(service: "boosts", operation: "create_recording_boost", is_mutation: true, resource_id: recording_id) do
44
+ http_post("/recordings/#{recording_id}/boosts.json", body: compact_params(content: content)).json
45
+ end
46
+ end
47
+
48
+ # List boosts on a specific event within a recording
49
+ # @param recording_id [Integer] recording id ID
50
+ # @param event_id [Integer] event id ID
51
+ # @return [Enumerator<Hash>] paginated results
52
+ def list_event_boosts(recording_id:, event_id:)
53
+ wrap_paginated(service: "boosts", operation: "list_event_boosts", is_mutation: false, resource_id: event_id) do
54
+ paginate("/recordings/#{recording_id}/events/#{event_id}/boosts.json")
55
+ end
56
+ end
57
+
58
+ # Create a boost on a specific event within a recording
59
+ # @param recording_id [Integer] recording id ID
60
+ # @param event_id [Integer] event id ID
61
+ # @param content [String] content
62
+ # @return [Hash] response data
63
+ def create_event_boost(recording_id:, event_id:, content:)
64
+ with_operation(service: "boosts", operation: "create_event_boost", is_mutation: true, resource_id: event_id) do
65
+ http_post("/recordings/#{recording_id}/events/#{event_id}/boosts.json", body: compact_params(content: content)).json
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,122 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for Campfires operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class CampfiresService < BaseService
9
+
10
+ # List all campfires across the account
11
+ # @return [Enumerator<Hash>] paginated results
12
+ def list()
13
+ wrap_paginated(service: "campfires", operation: "list", is_mutation: false) do
14
+ paginate("/chats.json")
15
+ end
16
+ end
17
+
18
+ # Get a campfire by ID
19
+ # @param campfire_id [Integer] campfire id ID
20
+ # @return [Hash] response data
21
+ def get(campfire_id:)
22
+ with_operation(service: "campfires", operation: "get", is_mutation: false, resource_id: campfire_id) do
23
+ http_get("/chats/#{campfire_id}").json
24
+ end
25
+ end
26
+
27
+ # List all chatbots for a campfire
28
+ # @param campfire_id [Integer] campfire id ID
29
+ # @return [Enumerator<Hash>] paginated results
30
+ def list_chatbots(campfire_id:)
31
+ wrap_paginated(service: "campfires", operation: "list_chatbots", is_mutation: false, resource_id: campfire_id) do
32
+ paginate("/chats/#{campfire_id}/integrations.json")
33
+ end
34
+ end
35
+
36
+ # Create a new chatbot for a campfire
37
+ # @param campfire_id [Integer] campfire id ID
38
+ # @param service_name [String] service name
39
+ # @param command_url [String, nil] command url
40
+ # @return [Hash] response data
41
+ def create_chatbot(campfire_id:, service_name:, command_url: nil)
42
+ with_operation(service: "campfires", operation: "create_chatbot", is_mutation: true, resource_id: campfire_id) do
43
+ http_post("/chats/#{campfire_id}/integrations.json", body: compact_params(service_name: service_name, command_url: command_url)).json
44
+ end
45
+ end
46
+
47
+ # Get a chatbot by ID
48
+ # @param campfire_id [Integer] campfire id ID
49
+ # @param chatbot_id [Integer] chatbot id ID
50
+ # @return [Hash] response data
51
+ def get_chatbot(campfire_id:, chatbot_id:)
52
+ with_operation(service: "campfires", operation: "get_chatbot", is_mutation: false, resource_id: chatbot_id) do
53
+ http_get("/chats/#{campfire_id}/integrations/#{chatbot_id}").json
54
+ end
55
+ end
56
+
57
+ # Update an existing chatbot
58
+ # @param campfire_id [Integer] campfire id ID
59
+ # @param chatbot_id [Integer] chatbot id ID
60
+ # @param service_name [String] service name
61
+ # @param command_url [String, nil] command url
62
+ # @return [Hash] response data
63
+ def update_chatbot(campfire_id:, chatbot_id:, service_name:, command_url: nil)
64
+ with_operation(service: "campfires", operation: "update_chatbot", is_mutation: true, resource_id: chatbot_id) do
65
+ http_put("/chats/#{campfire_id}/integrations/#{chatbot_id}", body: compact_params(service_name: service_name, command_url: command_url)).json
66
+ end
67
+ end
68
+
69
+ # Delete a chatbot
70
+ # @param campfire_id [Integer] campfire id ID
71
+ # @param chatbot_id [Integer] chatbot id ID
72
+ # @return [void]
73
+ def delete_chatbot(campfire_id:, chatbot_id:)
74
+ with_operation(service: "campfires", operation: "delete_chatbot", is_mutation: true, resource_id: chatbot_id) do
75
+ http_delete("/chats/#{campfire_id}/integrations/#{chatbot_id}")
76
+ nil
77
+ end
78
+ end
79
+
80
+ # List all lines (messages) in a campfire
81
+ # @param campfire_id [Integer] campfire id ID
82
+ # @return [Enumerator<Hash>] paginated results
83
+ def list_lines(campfire_id:)
84
+ wrap_paginated(service: "campfires", operation: "list_lines", is_mutation: false, resource_id: campfire_id) do
85
+ paginate("/chats/#{campfire_id}/lines.json")
86
+ end
87
+ end
88
+
89
+ # Create a new line (message) in a campfire
90
+ # @param campfire_id [Integer] campfire id ID
91
+ # @param content [String] content
92
+ # @param content_type [String, nil] content type
93
+ # @return [Hash] response data
94
+ def create_line(campfire_id:, content:, content_type: nil)
95
+ with_operation(service: "campfires", operation: "create_line", is_mutation: true, resource_id: campfire_id) do
96
+ http_post("/chats/#{campfire_id}/lines.json", body: compact_params(content: content, content_type: content_type)).json
97
+ end
98
+ end
99
+
100
+ # Get a campfire line by ID
101
+ # @param campfire_id [Integer] campfire id ID
102
+ # @param line_id [Integer] line id ID
103
+ # @return [Hash] response data
104
+ def get_line(campfire_id:, line_id:)
105
+ with_operation(service: "campfires", operation: "get_line", is_mutation: false, resource_id: line_id) do
106
+ http_get("/chats/#{campfire_id}/lines/#{line_id}").json
107
+ end
108
+ end
109
+
110
+ # Delete a campfire line
111
+ # @param campfire_id [Integer] campfire id ID
112
+ # @param line_id [Integer] line id ID
113
+ # @return [void]
114
+ def delete_line(campfire_id:, line_id:)
115
+ with_operation(service: "campfires", operation: "delete_line", is_mutation: true, resource_id: line_id) do
116
+ http_delete("/chats/#{campfire_id}/lines/#{line_id}")
117
+ nil
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for CardColumns operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class CardColumnsService < BaseService
9
+
10
+ # Get a card column by ID
11
+ # @param column_id [Integer] column id ID
12
+ # @return [Hash] response data
13
+ def get(column_id:)
14
+ with_operation(service: "cardcolumns", operation: "get", is_mutation: false, resource_id: column_id) do
15
+ http_get("/card_tables/columns/#{column_id}").json
16
+ end
17
+ end
18
+
19
+ # Update an existing column
20
+ # @param column_id [Integer] column id ID
21
+ # @param title [String, nil] title
22
+ # @param description [String, nil] description
23
+ # @return [Hash] response data
24
+ def update(column_id:, title: nil, description: nil)
25
+ with_operation(service: "cardcolumns", operation: "update", is_mutation: true, resource_id: column_id) do
26
+ http_put("/card_tables/columns/#{column_id}", body: compact_params(title: title, description: description)).json
27
+ end
28
+ end
29
+
30
+ # Set the color of a column
31
+ # @param column_id [Integer] column id ID
32
+ # @param color [String] Valid colors: white, red, orange, yellow, green, blue, aqua, purple, gray, pink, brown
33
+ # @return [Hash] response data
34
+ def set_color(column_id:, color:)
35
+ with_operation(service: "cardcolumns", operation: "set_color", is_mutation: true, resource_id: column_id) do
36
+ http_put("/card_tables/columns/#{column_id}/color.json", body: compact_params(color: color)).json
37
+ end
38
+ end
39
+
40
+ # Enable on-hold section in a column
41
+ # @param column_id [Integer] column id ID
42
+ # @return [Hash] response data
43
+ def enable_on_hold(column_id:)
44
+ with_operation(service: "cardcolumns", operation: "enable_on_hold", is_mutation: true, resource_id: column_id) do
45
+ http_post("/card_tables/columns/#{column_id}/on_hold.json").json
46
+ end
47
+ end
48
+
49
+ # Disable on-hold section in a column
50
+ # @param column_id [Integer] column id ID
51
+ # @return [Hash] response data
52
+ def disable_on_hold(column_id:)
53
+ with_operation(service: "cardcolumns", operation: "disable_on_hold", is_mutation: true, resource_id: column_id) do
54
+ http_delete("/card_tables/columns/#{column_id}/on_hold.json").json
55
+ end
56
+ end
57
+
58
+ # Subscribe to a card column (watch for changes)
59
+ # @param column_id [Integer] column id ID
60
+ # @return [void]
61
+ def subscribe_to_column(column_id:)
62
+ with_operation(service: "cardcolumns", operation: "subscribe_to_column", is_mutation: true, resource_id: column_id) do
63
+ http_post("/card_tables/lists/#{column_id}/subscription.json")
64
+ nil
65
+ end
66
+ end
67
+
68
+ # Unsubscribe from a card column (stop watching for changes)
69
+ # @param column_id [Integer] column id ID
70
+ # @return [void]
71
+ def unsubscribe_from_column(column_id:)
72
+ with_operation(service: "cardcolumns", operation: "unsubscribe_from_column", is_mutation: true, resource_id: column_id) do
73
+ http_delete("/card_tables/lists/#{column_id}/subscription.json")
74
+ nil
75
+ end
76
+ end
77
+
78
+ # Create a column in a card table
79
+ # @param card_table_id [Integer] card table id ID
80
+ # @param title [String] title
81
+ # @param description [String, nil] description
82
+ # @return [Hash] response data
83
+ def create(card_table_id:, title:, description: nil)
84
+ with_operation(service: "cardcolumns", operation: "create", is_mutation: true, resource_id: card_table_id) do
85
+ http_post("/card_tables/#{card_table_id}/columns.json", body: compact_params(title: title, description: description)).json
86
+ end
87
+ end
88
+
89
+ # Move a column within a card table
90
+ # @param card_table_id [Integer] card table id ID
91
+ # @param source_id [Integer] source id
92
+ # @param target_id [Integer] target id
93
+ # @param position [Integer, nil] position
94
+ # @return [void]
95
+ def move(card_table_id:, source_id:, target_id:, position: nil)
96
+ with_operation(service: "cardcolumns", operation: "move", is_mutation: true, resource_id: card_table_id) do
97
+ http_post("/card_tables/#{card_table_id}/moves.json", body: compact_params(source_id: source_id, target_id: target_id, position: position))
98
+ nil
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for CardSteps operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class CardStepsService < BaseService
9
+
10
+ # Reposition a step within a card
11
+ # @param card_id [Integer] card id ID
12
+ # @param source_id [Integer] source id
13
+ # @param position [Integer] 0-indexed position
14
+ # @return [void]
15
+ def reposition(card_id:, source_id:, position:)
16
+ with_operation(service: "cardsteps", operation: "reposition", is_mutation: true, resource_id: card_id) do
17
+ http_post("/card_tables/cards/#{card_id}/positions.json", body: compact_params(source_id: source_id, position: position))
18
+ nil
19
+ end
20
+ end
21
+
22
+ # Create a step on a card
23
+ # @param card_id [Integer] card id ID
24
+ # @param title [String] title
25
+ # @param due_on [String, nil] due on (YYYY-MM-DD)
26
+ # @param assignees [Array, nil] assignees
27
+ # @return [Hash] response data
28
+ def create(card_id:, title:, due_on: nil, assignees: nil)
29
+ with_operation(service: "cardsteps", operation: "create", is_mutation: true, resource_id: card_id) do
30
+ http_post("/card_tables/cards/#{card_id}/steps.json", body: compact_params(title: title, due_on: due_on, assignees: assignees)).json
31
+ end
32
+ end
33
+
34
+ # Update an existing step
35
+ # @param step_id [Integer] step id ID
36
+ # @param title [String, nil] title
37
+ # @param due_on [String, nil] due on (YYYY-MM-DD)
38
+ # @param assignees [Array, nil] assignees
39
+ # @return [Hash] response data
40
+ def update(step_id:, title: nil, due_on: nil, assignees: nil)
41
+ with_operation(service: "cardsteps", operation: "update", is_mutation: true, resource_id: step_id) do
42
+ http_put("/card_tables/steps/#{step_id}", body: compact_params(title: title, due_on: due_on, assignees: assignees)).json
43
+ end
44
+ end
45
+
46
+ # Set card step completion status (PUT with completion: "on" to complete, "" to uncomplete)
47
+ # @param step_id [Integer] step id ID
48
+ # @param completion [String] Set to "on" to complete the step, "" (empty) to uncomplete
49
+ # @return [Hash] response data
50
+ def set_completion(step_id:, completion:)
51
+ with_operation(service: "cardsteps", operation: "set_completion", is_mutation: true, resource_id: step_id) do
52
+ http_put("/card_tables/steps/#{step_id}/completions.json", body: compact_params(completion: completion)).json
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for CardTables operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class CardTablesService < BaseService
9
+
10
+ # Get a card table by ID
11
+ # @param card_table_id [Integer] card table id ID
12
+ # @return [Hash] response data
13
+ def get(card_table_id:)
14
+ with_operation(service: "cardtables", operation: "get", is_mutation: false, resource_id: card_table_id) do
15
+ http_get("/card_tables/#{card_table_id}").json
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for Cards operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class CardsService < BaseService
9
+
10
+ # Get a card by ID
11
+ # @param card_id [Integer] card id ID
12
+ # @return [Hash] response data
13
+ def get(card_id:)
14
+ with_operation(service: "cards", operation: "get", is_mutation: false, resource_id: card_id) do
15
+ http_get("/card_tables/cards/#{card_id}").json
16
+ end
17
+ end
18
+
19
+ # Update an existing card
20
+ # @param card_id [Integer] card id ID
21
+ # @param title [String, nil] title
22
+ # @param content [String, nil] content
23
+ # @param due_on [String, nil] due on (YYYY-MM-DD)
24
+ # @param assignee_ids [Array, nil] assignee ids
25
+ # @return [Hash] response data
26
+ def update(card_id:, title: nil, content: nil, due_on: nil, assignee_ids: nil)
27
+ with_operation(service: "cards", operation: "update", is_mutation: true, resource_id: card_id) do
28
+ http_put("/card_tables/cards/#{card_id}", body: compact_params(title: title, content: content, due_on: due_on, assignee_ids: assignee_ids)).json
29
+ end
30
+ end
31
+
32
+ # Move a card to a different column
33
+ # @param card_id [Integer] card id ID
34
+ # @param column_id [Integer] column id
35
+ # @return [void]
36
+ def move(card_id:, column_id:)
37
+ with_operation(service: "cards", operation: "move", is_mutation: true, resource_id: card_id) do
38
+ http_post("/card_tables/cards/#{card_id}/moves.json", body: compact_params(column_id: column_id))
39
+ nil
40
+ end
41
+ end
42
+
43
+ # List cards in a column
44
+ # @param column_id [Integer] column id ID
45
+ # @return [Enumerator<Hash>] paginated results
46
+ def list(column_id:)
47
+ wrap_paginated(service: "cards", operation: "list", is_mutation: false, resource_id: column_id) do
48
+ paginate("/card_tables/lists/#{column_id}/cards.json")
49
+ end
50
+ end
51
+
52
+ # Create a card in a column
53
+ # @param column_id [Integer] column id ID
54
+ # @param title [String] title
55
+ # @param content [String, nil] content
56
+ # @param due_on [String, nil] due on (YYYY-MM-DD)
57
+ # @param notify [Boolean, nil] notify
58
+ # @return [Hash] response data
59
+ def create(column_id:, title:, content: nil, due_on: nil, notify: nil)
60
+ with_operation(service: "cards", operation: "create", is_mutation: true, resource_id: column_id) do
61
+ http_post("/card_tables/lists/#{column_id}/cards.json", body: compact_params(title: title, content: content, due_on: due_on, notify: notify)).json
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,157 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for Checkins operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class CheckinsService < BaseService
9
+
10
+ # Get pending check-in reminders for the current user
11
+ # @return [Enumerator<Hash>] paginated results
12
+ def reminders()
13
+ wrap_paginated(service: "checkins", operation: "reminders", is_mutation: false) do
14
+ paginate("/my/question_reminders.json")
15
+ end
16
+ end
17
+
18
+ # Get a single answer by id
19
+ # @param answer_id [Integer] answer id ID
20
+ # @return [Hash] response data
21
+ def get_answer(answer_id:)
22
+ with_operation(service: "checkins", operation: "get_answer", is_mutation: false, resource_id: answer_id) do
23
+ http_get("/question_answers/#{answer_id}").json
24
+ end
25
+ end
26
+
27
+ # Update an existing answer
28
+ # @param answer_id [Integer] answer id ID
29
+ # @param content [String] content
30
+ # @return [void]
31
+ def update_answer(answer_id:, content:)
32
+ with_operation(service: "checkins", operation: "update_answer", is_mutation: true, resource_id: answer_id) do
33
+ http_put("/question_answers/#{answer_id}", body: compact_params(content: content))
34
+ nil
35
+ end
36
+ end
37
+
38
+ # Get a questionnaire (automatic check-ins container) by id
39
+ # @param questionnaire_id [Integer] questionnaire id ID
40
+ # @return [Hash] response data
41
+ def get_questionnaire(questionnaire_id:)
42
+ with_operation(service: "checkins", operation: "get_questionnaire", is_mutation: false, resource_id: questionnaire_id) do
43
+ http_get("/questionnaires/#{questionnaire_id}").json
44
+ end
45
+ end
46
+
47
+ # List all questions in a questionnaire
48
+ # @param questionnaire_id [Integer] questionnaire id ID
49
+ # @return [Enumerator<Hash>] paginated results
50
+ def list_questions(questionnaire_id:)
51
+ wrap_paginated(service: "checkins", operation: "list_questions", is_mutation: false, resource_id: questionnaire_id) do
52
+ paginate("/questionnaires/#{questionnaire_id}/questions.json")
53
+ end
54
+ end
55
+
56
+ # Create a new question in a questionnaire
57
+ # @param questionnaire_id [Integer] questionnaire id ID
58
+ # @param title [String] title
59
+ # @param schedule [String] schedule
60
+ # @return [Hash] response data
61
+ def create_question(questionnaire_id:, title:, schedule:)
62
+ with_operation(service: "checkins", operation: "create_question", is_mutation: true, resource_id: questionnaire_id) do
63
+ http_post("/questionnaires/#{questionnaire_id}/questions.json", body: compact_params(title: title, schedule: schedule)).json
64
+ end
65
+ end
66
+
67
+ # Get a single question by id
68
+ # @param question_id [Integer] question id ID
69
+ # @return [Hash] response data
70
+ def get_question(question_id:)
71
+ with_operation(service: "checkins", operation: "get_question", is_mutation: false, resource_id: question_id) do
72
+ http_get("/questions/#{question_id}").json
73
+ end
74
+ end
75
+
76
+ # Update an existing question
77
+ # @param question_id [Integer] question id ID
78
+ # @param title [String, nil] title
79
+ # @param schedule [String, nil] schedule
80
+ # @param paused [Boolean, nil] paused
81
+ # @return [Hash] response data
82
+ def update_question(question_id:, title: nil, schedule: nil, paused: nil)
83
+ with_operation(service: "checkins", operation: "update_question", is_mutation: true, resource_id: question_id) do
84
+ http_put("/questions/#{question_id}", body: compact_params(title: title, schedule: schedule, paused: paused)).json
85
+ end
86
+ end
87
+
88
+ # List all answers for a question
89
+ # @param question_id [Integer] question id ID
90
+ # @return [Enumerator<Hash>] paginated results
91
+ def list_answers(question_id:)
92
+ wrap_paginated(service: "checkins", operation: "list_answers", is_mutation: false, resource_id: question_id) do
93
+ paginate("/questions/#{question_id}/answers.json")
94
+ end
95
+ end
96
+
97
+ # Create a new answer for a question
98
+ # @param question_id [Integer] question id ID
99
+ # @param content [String] content
100
+ # @param group_on [String, nil] group on (YYYY-MM-DD)
101
+ # @return [Hash] response data
102
+ def create_answer(question_id:, content:, group_on: nil)
103
+ with_operation(service: "checkins", operation: "create_answer", is_mutation: true, resource_id: question_id) do
104
+ http_post("/questions/#{question_id}/answers.json", body: compact_params(content: content, group_on: group_on)).json
105
+ end
106
+ end
107
+
108
+ # List all people who have answered a question (answerers)
109
+ # @param question_id [Integer] question id ID
110
+ # @return [Enumerator<Hash>] paginated results
111
+ def answerers(question_id:)
112
+ wrap_paginated(service: "checkins", operation: "answerers", is_mutation: false, resource_id: question_id) do
113
+ paginate("/questions/#{question_id}/answers/by.json")
114
+ end
115
+ end
116
+
117
+ # Get all answers from a specific person for a question
118
+ # @param question_id [Integer] question id ID
119
+ # @param person_id [Integer] person id ID
120
+ # @return [Enumerator<Hash>] paginated results
121
+ def by_person(question_id:, person_id:)
122
+ wrap_paginated(service: "checkins", operation: "by_person", is_mutation: false, resource_id: person_id) do
123
+ paginate("/questions/#{question_id}/answers/by/#{person_id}")
124
+ end
125
+ end
126
+
127
+ # Update notification settings for a check-in question
128
+ # @param question_id [Integer] question id ID
129
+ # @param notify_on_answer [Boolean, nil] Notify when someone answers
130
+ # @param digest_include_unanswered [Boolean, nil] Include unanswered in digest
131
+ # @return [Hash] response data
132
+ def update_notification_settings(question_id:, notify_on_answer: nil, digest_include_unanswered: nil)
133
+ with_operation(service: "checkins", operation: "update_notification_settings", is_mutation: true, resource_id: question_id) do
134
+ http_put("/questions/#{question_id}/notification_settings.json", body: compact_params(notify_on_answer: notify_on_answer, digest_include_unanswered: digest_include_unanswered)).json
135
+ end
136
+ end
137
+
138
+ # Pause a check-in question (stops sending reminders)
139
+ # @param question_id [Integer] question id ID
140
+ # @return [Hash] response data
141
+ def pause(question_id:)
142
+ with_operation(service: "checkins", operation: "pause", is_mutation: true, resource_id: question_id) do
143
+ http_post("/questions/#{question_id}/pause.json").json
144
+ end
145
+ end
146
+
147
+ # Resume a paused check-in question (resumes sending reminders)
148
+ # @param question_id [Integer] question id ID
149
+ # @return [Hash] response data
150
+ def resume(question_id:)
151
+ with_operation(service: "checkins", operation: "resume", is_mutation: true, resource_id: question_id) do
152
+ http_delete("/questions/#{question_id}/pause.json").json
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Basecamp
4
+ module Services
5
+ # Service for ClientApprovals operations
6
+ #
7
+ # @generated from OpenAPI spec
8
+ class ClientApprovalsService < BaseService
9
+
10
+ # List all client approvals in a project
11
+ # @return [Enumerator<Hash>] paginated results
12
+ def list()
13
+ wrap_paginated(service: "clientapprovals", operation: "list", is_mutation: false) do
14
+ paginate("/client/approvals.json")
15
+ end
16
+ end
17
+
18
+ # Get a single client approval by id
19
+ # @param approval_id [Integer] approval id ID
20
+ # @return [Hash] response data
21
+ def get(approval_id:)
22
+ with_operation(service: "clientapprovals", operation: "get", is_mutation: false, resource_id: approval_id) do
23
+ http_get("/client/approvals/#{approval_id}").json
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end