Class: FreightKit::Price
Overview
Class representing a price.
Instance Attribute Summary collapse
-
#blame ⇒ Symbol
Where did the cost come from?.
-
#cents ⇒ Integer
The price in cents.
-
#description ⇒ String
Description.
-
#objects ⇒ Array
Array of objects that the price applies to.
Method Summary
Methods inherited from Model
Constructor Details
This class inherits a constructor from FreightKit::Model
Instance Attribute Details
#blame ⇒ Symbol
Where did the cost come from?
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/freight_kit/models/price.rb', line 22 class Price < Model attr_accessor :description, :objects attr_writer :blame, :cents def blame return @blame if %i[api library tariff].include?(@blame) raise 'blame must be one of :api, :library, :tariff' end def cents return @cents if @cents.is_a?(Integer) raise 'cents must be an `Integer`' end end |
#cents ⇒ Integer
The price in cents.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/freight_kit/models/price.rb', line 22 class Price < Model attr_accessor :description, :objects attr_writer :blame, :cents def blame return @blame if %i[api library tariff].include?(@blame) raise 'blame must be one of :api, :library, :tariff' end def cents return @cents if @cents.is_a?(Integer) raise 'cents must be an `Integer`' end end |
#description ⇒ String
Description.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/freight_kit/models/price.rb', line 22 class Price < Model attr_accessor :description, :objects attr_writer :blame, :cents def blame return @blame if %i[api library tariff].include?(@blame) raise 'blame must be one of :api, :library, :tariff' end def cents return @cents if @cents.is_a?(Integer) raise 'cents must be an `Integer`' end end |
#objects ⇒ Array
Array of objects that the price applies to.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/freight_kit/models/price.rb', line 22 class Price < Model attr_accessor :description, :objects attr_writer :blame, :cents def blame return @blame if %i[api library tariff].include?(@blame) raise 'blame must be one of :api, :library, :tariff' end def cents return @cents if @cents.is_a?(Integer) raise 'cents must be an `Integer`' end end |