Class: Exa::Services::Websets::UploadImport
- Inherits:
-
Object
- Object
- Exa::Services::Websets::UploadImport
- Defined in:
- lib/exa/services/websets/import_upload.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(connection, file_path:, **params) ⇒ UploadImport
constructor
A new instance of UploadImport.
Constructor Details
#initialize(connection, file_path:, **params) ⇒ UploadImport
Returns a new instance of UploadImport.
9 10 11 12 13 |
# File 'lib/exa/services/websets/import_upload.rb', line 9 def initialize(connection, file_path:, **params) @connection = connection @file_path = file_path @params = params end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/exa/services/websets/import_upload.rb', line 15 def call validate_file! # Infer file size file_size = File.size(@file_path) # Create import with inferred size import = CreateImport.new(@connection, size: file_size, **@params).call # Upload file to the upload URL upload_file(import.upload_url) # Return the import resource import end |