class Riffer::Config::Pricing
@deprecated Set pricing in a catalog file instead (see docs/CATALOG.md). A catalog entryβs pricing wins over rates registered here.
Public Class Methods
Public Instance Methods
Source
# File lib/riffer/config/pricing.rb, line 35 def rates_for(model) @rates[model] end
Source
# File lib/riffer/config/pricing.rb, line 17 def set(models, input:, output:, cache_read: nil, cache_write: nil) Riffer::Deprecation.warn( id: :config_pricing, message: "config.pricing is deprecated and will be removed in a future version; move rates into a catalog " \ "file listed in config.catalog_files (see docs/CATALOG.md).", ) ids = models.is_a?(Array) ? models : [models] raise Riffer::ArgumentError, "at least one model id is required" if ids.empty? ids.each { |id| Riffer::Helpers::Validate.model_id(id, attribute: "pricing model id") } rates = Riffer::Catalog::Rates.new(input: input, output: output, cache_read: cache_read, cache_write: cache_write) ids.each { |id| @rates[id] = rates } end