Class: Vangrail::ScoreProviders::Transport

Inherits:
Object
  • Object
show all
Defined in:
lib/vangrail/score_provider.rb

Overview

Shared request and response bounds for every optional transport.

Direct Known Subclasses

Command, Endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reader_id:, model_id:, feature_schema:, max_input_bytes: DEFAULT_MAX_INPUT_BYTES, max_output_bytes: DEFAULT_MAX_OUTPUT_BYTES) ⇒ Transport

Returns a new instance of Transport.

Raises:

  • (ArgumentError)


57
58
59
60
61
62
63
64
65
66
# File 'lib/vangrail/score_provider.rb', line 57

def initialize(reader_id:, model_id:, feature_schema:,
               max_input_bytes: DEFAULT_MAX_INPUT_BYTES,
               max_output_bytes: DEFAULT_MAX_OUTPUT_BYTES)
  @reader_id = reader_id.to_s.freeze
  @model_id = model_id.to_s.freeze
  @feature_schema = Array(feature_schema).map(&:to_s).freeze
  @max_input_bytes = positive_integer(max_input_bytes, 'max_input_bytes')
  @max_output_bytes = positive_integer(max_output_bytes, 'max_output_bytes')
  raise ArgumentError, 'feature_schema is required' if @feature_schema.empty?
end

Instance Attribute Details

#feature_schemaObject (readonly)

Returns the value of attribute feature_schema.



54
55
56
# File 'lib/vangrail/score_provider.rb', line 54

def feature_schema
  @feature_schema
end

#max_input_bytesObject (readonly)

Returns the value of attribute max_input_bytes.



54
55
56
# File 'lib/vangrail/score_provider.rb', line 54

def max_input_bytes
  @max_input_bytes
end

#max_output_bytesObject (readonly)

Returns the value of attribute max_output_bytes.



54
55
56
# File 'lib/vangrail/score_provider.rb', line 54

def max_output_bytes
  @max_output_bytes
end

#model_idObject (readonly)

Returns the value of attribute model_id.



54
55
56
# File 'lib/vangrail/score_provider.rb', line 54

def model_id
  @model_id
end

#reader_idObject (readonly)

Returns the value of attribute reader_id.



54
55
56
# File 'lib/vangrail/score_provider.rb', line 54

def reader_id
  @reader_id
end