Class: HubSpotSDK::Resources::Cms::SourceCode
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Cms::SourceCode
- Defined in:
- lib/hubspot_sdk/resources/cms/source_code.rb
Instance Method Summary collapse
- #create(path, environment:, file: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::AssetFileMetadata deprecated Deprecated.
-
#delete(path, environment:, request_options: {}) ⇒ nil
Deletes the file at the specified path in the specified environment.
-
#extract_async(path:, request_options: {}) ⇒ HubSpotSDK::Models::TaskLocator
Extract a zip file in the developer file system.
-
#get(path, environment:, request_options: {}) ⇒ StringIO
Downloads the byte contents of the file at the specified path in the specified environment.
-
#get_extraction_status(task_id, request_options: {}) ⇒ HubSpotSDK::Models::ActionResponse
Get the status of an extraction by the ‘taskId` returned from the initial `extract/async` request.
-
#get_metadata(path, environment:, properties: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::AssetFileMetadata
Gets the metadata object for the file at the specified path in the specified environment.
-
#initialize(client:) ⇒ SourceCode
constructor
private
A new instance of SourceCode.
-
#upsert(path, environment:, file: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::AssetFileMetadata
Upserts a file at the specified path in the specified environment.
-
#validate(path, environment:, file: nil, request_options: {}) ⇒ StringIO
Validates the file contents passed to the endpoint given a specified path and environment.
Constructor Details
#initialize(client:) ⇒ SourceCode
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SourceCode.
236 237 238 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 236 def initialize(client:) @client = client end |
Instance Method Details
#create(path, environment:, file: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::AssetFileMetadata
Creates a file at the specified path in the specified environment. Accepts multipart/form-data content type. Throws an error if a file already exists at the specified path.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 26 def create(path, params) parsed, = HubSpotSDK::Cms::SourceCodeCreateParams.dump_request(params) environment = parsed.delete(:environment) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["cms/source-code/2026-03/%1$s/content/%2$s", environment, path], headers: {"content-type" => "multipart/form-data"}, body: parsed, model: HubSpotSDK::Cms::AssetFileMetadata, options: ) end |
#delete(path, environment:, request_options: {}) ⇒ nil
Deletes the file at the specified path in the specified environment.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 53 def delete(path, params) parsed, = HubSpotSDK::Cms::SourceCodeDeleteParams.dump_request(params) environment = parsed.delete(:environment) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["cms/source-code/2026-03/%1$s/content/%2$s", environment, path], model: NilClass, options: ) end |
#extract_async(path:, request_options: {}) ⇒ HubSpotSDK::Models::TaskLocator
Extract a zip file in the developer file system. Extraction status can be checked with the ‘/extract/async/tasks/taskId/status` endpoint below.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 79 def extract_async(params) parsed, = HubSpotSDK::Cms::SourceCodeExtractAsyncParams.dump_request(params) @client.request( method: :post, path: "cms/source-code/2026-03/extract/async", body: parsed, model: HubSpotSDK::TaskLocator, options: ) end |
#get(path, environment:, request_options: {}) ⇒ StringIO
Downloads the byte contents of the file at the specified path in the specified environment.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 102 def get(path, params) parsed, = HubSpotSDK::Cms::SourceCodeGetParams.dump_request(params) environment = parsed.delete(:environment) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["cms/source-code/2026-03/%1$s/content/%2$s", environment, path], headers: {"accept" => "*/*"}, model: StringIO, options: ) end |
#get_extraction_status(task_id, request_options: {}) ⇒ HubSpotSDK::Models::ActionResponse
Get the status of an extraction by the ‘taskId` returned from the initial `extract/async` request.
128 129 130 131 132 133 134 135 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 128 def get_extraction_status(task_id, params = {}) @client.request( method: :get, path: ["cms/source-code/2026-03/extract/async/tasks/%1$s/status", task_id], model: HubSpotSDK::ActionResponse, options: params[:request_options] ) end |
#get_metadata(path, environment:, properties: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::AssetFileMetadata
Gets the metadata object for the file at the specified path in the specified environment.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 153 def (path, params) parsed, = HubSpotSDK::Cms::SourceCodeGetMetadataParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) environment = parsed.delete(:environment) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["cms/source-code/2026-03/%1$s/metadata/%2$s", environment, path], query: query, model: HubSpotSDK::Cms::AssetFileMetadata, options: ) end |
#upsert(path, environment:, file: nil, request_options: {}) ⇒ HubSpotSDK::Models::Cms::AssetFileMetadata
Upserts a file at the specified path in the specified environment. Accepts multipart/form-data content type.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 185 def upsert(path, params) parsed, = HubSpotSDK::Cms::SourceCodeUpsertParams.dump_request(params) environment = parsed.delete(:environment) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["cms/source-code/2026-03/%1$s/content/%2$s", environment, path], headers: {"content-type" => "multipart/form-data"}, body: parsed, model: HubSpotSDK::Cms::AssetFileMetadata, options: ) end |
#validate(path, environment:, file: nil, request_options: {}) ⇒ StringIO
Validates the file contents passed to the endpoint given a specified path and environment. Accepts multipart/form-data content type.
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/hubspot_sdk/resources/cms/source_code.rb', line 217 def validate(path, params) parsed, = HubSpotSDK::Cms::SourceCodeValidateParams.dump_request(params) environment = parsed.delete(:environment) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["cms/source-code/2026-03/%1$s/validate/%2$s", environment, path], headers: {"content-type" => "multipart/form-data", "accept" => "*/*"}, body: parsed, model: StringIO, options: ) end |