Class: Moov::Models::Components::VolumeRange

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Crystalline::MetadataFields
Defined in:
lib/moov/models/components/volumerange.rb

Overview

Defines the volume ranges for tiered pricing models.

Instance Method Summary collapse

Methods included from Crystalline::MetadataFields

#field, #fields, included, #marshal_single, #to_dict, #to_json

Constructor Details

#initialize(from_value:, flat_amount:, per_unit_amount:, to_value: nil) ⇒ VolumeRange

Returns a new instance of VolumeRange.



25
26
27
28
29
30
# File 'lib/moov/models/components/volumerange.rb', line 25

def initialize(from_value:, flat_amount:, per_unit_amount:, to_value: nil)
  @from_value = from_value
  @flat_amount = flat_amount
  @per_unit_amount = per_unit_amount
  @to_value = to_value
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/moov/models/components/volumerange.rb', line 33

def ==(other)
  return false unless other.is_a? self.class
  return false unless @from_value == other.from_value
  return false unless @flat_amount == other.flat_amount
  return false unless @per_unit_amount == other.per_unit_amount
  return false unless @to_value == other.to_value
  true
end