Class: Hubspot::Cms::SourceCode::ContentApi
- Inherits:
-
Object
- Object
- Hubspot::Cms::SourceCode::ContentApi
- Defined in:
- lib/hubspot/codegen/cms/source_code/api/content_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#archive(environment, path, opts = {}) ⇒ nil
Delete a file Deletes the file at the specified path in the specified environment.
-
#archive_with_http_info(environment, path, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete a file Deletes the file at the specified path in the specified environment.
-
#create(environment, path, opts = {}) ⇒ AssetFileMetadata
Create a file Creates a file at the specified path in the specified environment.
-
#create_or_update(environment, path, opts = {}) ⇒ AssetFileMetadata
Create or update a file Upserts a file at the specified path in the specified environment.
-
#create_or_update_with_http_info(environment, path, opts = {}) ⇒ Array<(AssetFileMetadata, Integer, Hash)>
Create or update a file Upserts a file at the specified path in the specified environment.
-
#create_with_http_info(environment, path, opts = {}) ⇒ Array<(AssetFileMetadata, Integer, Hash)>
Create a file Creates a file at the specified path in the specified environment.
-
#download(environment, path, opts = {}) ⇒ Error
Download a file Downloads the byte contents of the file at the specified path in the specified environment.
-
#download_with_http_info(environment, path, opts = {}) ⇒ Array<(Error, Integer, Hash)>
Download a file Downloads the byte contents of the file at the specified path in the specified environment.
-
#initialize(api_client = ApiClient.default) ⇒ ContentApi
constructor
A new instance of ContentApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ContentApi
Returns a new instance of ContentApi.
21 22 23 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 21 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
19 20 21 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 19 def api_client @api_client end |
Instance Method Details
#archive(environment, path, opts = {}) ⇒ nil
Delete a file Deletes the file at the specified path in the specified environment.
30 31 32 33 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 30 def archive(environment, path, opts = {}) archive_with_http_info(environment, path, opts) nil end |
#archive_with_http_info(environment, path, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete a file Deletes the file at the specified path in the specified environment.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 41 def archive_with_http_info(environment, path, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContentApi.archive ...' end # verify the required parameter 'environment' is set if @api_client.config.client_side_validation && environment.nil? fail ArgumentError, "Missing the required parameter 'environment' when calling ContentApi.archive" end # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? fail ArgumentError, "Missing the required parameter 'path' when calling ContentApi.archive" end pattern = Regexp.new(/.+/) if @api_client.config.client_side_validation && path !~ pattern fail ArgumentError, "invalid value for 'path' when calling ContentApi.archive, must conform to the pattern #{pattern}." end # resource path local_var_path = '/cms/v3/source-code/{environment}/content/{path}'.sub('{' + 'environment' + '}', CGI.escape(environment.to_s)).sub('{' + 'path' + '}', CGI.escape(path.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] = opts.merge( :operation => :"ContentApi.archive", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContentApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create(environment, path, opts = {}) ⇒ AssetFileMetadata
Create a file 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.
105 106 107 108 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 105 def create(environment, path, opts = {}) data, _status_code, _headers = create_with_http_info(environment, path, opts) data end |
#create_or_update(environment, path, opts = {}) ⇒ AssetFileMetadata
Create or update a file Upserts a file at the specified path in the specified environment. Accepts multipart/form-data content type.
187 188 189 190 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 187 def create_or_update(environment, path, opts = {}) data, _status_code, _headers = create_or_update_with_http_info(environment, path, opts) data end |
#create_or_update_with_http_info(environment, path, opts = {}) ⇒ Array<(AssetFileMetadata, Integer, Hash)>
Create or update a file Upserts a file at the specified path in the specified environment. Accepts multipart/form-data content type.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 199 def create_or_update_with_http_info(environment, path, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContentApi.create_or_update ...' end # verify the required parameter 'environment' is set if @api_client.config.client_side_validation && environment.nil? fail ArgumentError, "Missing the required parameter 'environment' when calling ContentApi.create_or_update" end # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? fail ArgumentError, "Missing the required parameter 'path' when calling ContentApi.create_or_update" end pattern = Regexp.new(/.+/) if @api_client.config.client_side_validation && path !~ pattern fail ArgumentError, "invalid value for 'path' when calling ContentApi.create_or_update, must conform to the pattern #{pattern}." end # resource path local_var_path = '/cms/v3/source-code/{environment}/content/{path}'.sub('{' + 'environment' + '}', CGI.escape(environment.to_s)).sub('{' + 'path' + '}', CGI.escape(path.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AssetFileMetadata' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] = opts.merge( :operation => :"ContentApi.create_or_update", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContentApi#create_or_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_with_http_info(environment, path, opts = {}) ⇒ Array<(AssetFileMetadata, Integer, Hash)>
Create a file 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.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 117 def create_with_http_info(environment, path, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContentApi.create ...' end # verify the required parameter 'environment' is set if @api_client.config.client_side_validation && environment.nil? fail ArgumentError, "Missing the required parameter 'environment' when calling ContentApi.create" end # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? fail ArgumentError, "Missing the required parameter 'path' when calling ContentApi.create" end pattern = Regexp.new(/.+/) if @api_client.config.client_side_validation && path !~ pattern fail ArgumentError, "invalid value for 'path' when calling ContentApi.create, must conform to the pattern #{pattern}." end # resource path local_var_path = '/cms/v3/source-code/{environment}/content/{path}'.sub('{' + 'environment' + '}', CGI.escape(environment.to_s)).sub('{' + 'path' + '}', CGI.escape(path.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['file'] = opts[:'file'] if !opts[:'file'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AssetFileMetadata' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] = opts.merge( :operation => :"ContentApi.create", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContentApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#download(environment, path, opts = {}) ⇒ Error
Download a file Downloads the byte contents of the file at the specified path in the specified environment.
268 269 270 271 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 268 def download(environment, path, opts = {}) data, _status_code, _headers = download_with_http_info(environment, path, opts) data end |
#download_with_http_info(environment, path, opts = {}) ⇒ Array<(Error, Integer, Hash)>
Download a file Downloads the byte contents of the file at the specified path in the specified environment.
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/hubspot/codegen/cms/source_code/api/content_api.rb', line 279 def download_with_http_info(environment, path, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContentApi.download ...' end # verify the required parameter 'environment' is set if @api_client.config.client_side_validation && environment.nil? fail ArgumentError, "Missing the required parameter 'environment' when calling ContentApi.download" end # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? fail ArgumentError, "Missing the required parameter 'path' when calling ContentApi.download" end pattern = Regexp.new(/.+/) if @api_client.config.client_side_validation && path !~ pattern fail ArgumentError, "invalid value for 'path' when calling ContentApi.download, must conform to the pattern #{pattern}." end # resource path local_var_path = '/cms/v3/source-code/{environment}/content/{path}'.sub('{' + 'environment' + '}', CGI.escape(environment.to_s)).sub('{' + 'path' + '}', CGI.escape(path.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Error' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] = opts.merge( :operation => :"ContentApi.download", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContentApi#download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |