Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ Metrics/AbcSize:

Style/RegexpLiteral:
EnforcedStyle: percent_r

Style/ArrayIntersect:
Exclude:
- 'lib/mindee/pdf/pdf_tools.rb'
2 changes: 1 addition & 1 deletion lib/mindee/input/base_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def self.load_from_hash(params: {})
# @param [Array] form_data Array of form fields
# @return [Array]
def append_form_data(form_data)
form_data.push(['file_alias', @file_alias]) if @file_alias
form_data.push(['alias', @file_alias]) if @file_alias
webhook_ids = @webhook_ids || []
form_data.push(['webhook_ids', webhook_ids.join(',')]) unless @webhook_ids.nil? || webhook_ids.empty?
form_data
Expand Down
1 change: 0 additions & 1 deletion lib/mindee/v2/http/mindee_api_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def enqueue(input_source, params)
[['file', file_data, file_metadata]] # : Array[Array[untyped]]
end
form_data.push(['model_id', params.model_id])
form_data.push ['file_alias', params.file_alias] if params.file_alias
if params.is_a?(V2::Product::Extraction::Params::ExtractionParameters)
form_data = enqueue_form_options(form_data, params)
end
Comment thread
sebastianMindee marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.slug
# @param [String, nil] file_alias File alias, if applicable.
# @param [Array<String>, nil] webhook_ids
# @param [String, nil] text_context
# @param [Hash, PollingOptions, nil] polling_options
# @param [Hash, Input::PollingOptions, nil] polling_options
# @param [Boolean, nil] close_file
# @param [DataSchemaField, String, Hash nil] data_schema
def initialize(
Expand Down
6 changes: 3 additions & 3 deletions sig/mindee/input/base_parameters.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ module Mindee
String,
?file_alias: String?,
?webhook_ids: Array[String]?,
?polling_options: Hash[Symbol | String, untyped] | PollingOptions?,
?polling_options: Hash[Symbol | String, untyped] | PollingOptions | nil,
?close_file: bool?
) -> void

def append_form_data: (Array[Array[untyped]]) -> Array[Array[untyped]]
def validate_async_params: () -> void
def polling_options=: (Hash[Symbol | String, untyped] | PollingOptions?) -> PollingOptions
def polling_options=: (Hash[Symbol | String, untyped] | PollingOptions | nil) -> PollingOptions

private

def get_clean_polling_options: (Hash[String | Symbol, untyped] | PollingOptions?) -> PollingOptions
def get_clean_polling_options: (Hash[String | Symbol, untyped] | PollingOptions | nil) -> PollingOptions
end
end
end
4 changes: 2 additions & 2 deletions sig/mindee/v2/client.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ module Mindee

def enqueue: [T] (HTTP::_ProductClass[T] product, Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | Input::BaseParameters params) -> V2::Parsing::JobResponse

def enqueue_and_get_result: [T] (HTTP::_ProductClass[T] product, Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | Input::BaseParameters params, ?Hash[String | Symbol, untyped] | Input::PollingOptions?) -> T
def enqueue_and_get_result: [T] (HTTP::_ProductClass[T] product, Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | Input::BaseParameters params, ?Hash[String | Symbol, untyped] | Input::PollingOptions | nil) -> T

def search_models: (String?, String?) -> Mindee::V2::Parsing::Search::SearchResponse

def validate_async_params: (Integer | Float, Integer | Float, Integer) -> void

def normalize_parameters: (singleton(Input::BaseParameters) param_class, Hash[String | Symbol, untyped] | Input::BaseParameters params, ?polling_options: Hash[String | Symbol, untyped] | Input::PollingOptions?) -> Input::BaseParameters
def normalize_parameters: (singleton(Input::BaseParameters) param_class, Hash[String | Symbol, untyped] | Input::BaseParameters params, ?polling_options: Hash[String | Symbol, untyped] | Input::PollingOptions | nil) -> Input::BaseParameters
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Mindee
String,
?file_alias: String?,
?webhook_ids: Array[String]?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions | nil,
?close_file: bool?
) -> void
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Mindee
String,
?file_alias: String?,
?webhook_ids: Array[String]?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions | nil,
?close_file: bool?
) -> void
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Mindee
?file_alias: String?,
?text_context: String?,
?webhook_ids: Array[String]?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions | nil,
?close_file: bool?,
?data_schema: V2::Product::Extraction::Params::DataSchema|String|Hash[Symbol | String, untyped]?
) -> void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Mindee
String,
?file_alias: String?,
?webhook_ids: Array[String]?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions | nil,
?close_file: bool?
) -> void
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Mindee
String,
?file_alias: String?,
?webhook_ids: Array[String]?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions?,
?polling_options: Hash[Symbol | String, untyped] | Input::PollingOptions | nil,
?close_file: bool?
) -> void
end
Expand Down
1 change: 1 addition & 0 deletions spec/v2/client_v2_integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
response = client.enqueue_and_get_result(Mindee::V2::Product::Extraction::Extraction, input, inference_params)
expect(response).not_to be_nil
expect(response.inference).not_to be_nil
expect(response.inference.file.file_alias).to eq('rb_integration_test')
end

it 'parses a filled single-page image successfully' do
Expand Down
Loading