Class: Io::Flow::V0::Models::LocalizedPriceKey
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LocalizedPriceKey
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .ALL ⇒ Object
-
.apply(value) ⇒ Object
Returns the instance of LocalizedPriceKey for this value, creating a new instance for an unknown value.
- .discount ⇒ Object
- .duty ⇒ Object
-
.from_string(value) ⇒ Object
Returns the instance of LocalizedPriceKey for this value, or nil if not found.
-
.price ⇒ Object
The calculated price, taking into account pricing settings.
- .shipping ⇒ Object
- .subtotal ⇒ Object
- .total ⇒ Object
- .vat ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ LocalizedPriceKey
constructor
A new instance of LocalizedPriceKey.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ LocalizedPriceKey
Returns a new instance of LocalizedPriceKey.
4822 4823 4824 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4822 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4820 4821 4822 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4820 def value @value end |
Class Method Details
.ALL ⇒ Object
4842 4843 4844 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4842 def LocalizedPriceKey.ALL @@all ||= [LocalizedPriceKey.price, LocalizedPriceKey.subtotal, LocalizedPriceKey.vat, LocalizedPriceKey.duty, LocalizedPriceKey.discount, LocalizedPriceKey.shipping, LocalizedPriceKey.total] end |
.apply(value) ⇒ Object
Returns the instance of LocalizedPriceKey for this value, creating a new instance for an unknown value
4827 4828 4829 4830 4831 4832 4833 4834 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4827 def LocalizedPriceKey.apply(value) if value.instance_of?(LocalizedPriceKey) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || LocalizedPriceKey.new(value)) end end |
.discount ⇒ Object
4866 4867 4868 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4866 def LocalizedPriceKey.discount @@_discount ||= LocalizedPriceKey.new('discount') end |
.duty ⇒ Object
4862 4863 4864 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4862 def LocalizedPriceKey.duty @@_duty ||= LocalizedPriceKey.new('duty') end |
.from_string(value) ⇒ Object
Returns the instance of LocalizedPriceKey for this value, or nil if not found
4837 4838 4839 4840 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4837 def LocalizedPriceKey.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) LocalizedPriceKey.ALL.find { |v| v.value == value } end |
.price ⇒ Object
The calculated price, taking into account pricing settings. For example, if vat is set to be included in the price, this value will be equal to subtotal + vat, rounded per the settings. This is the price you should lead with when displaying to consumers
4850 4851 4852 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4850 def LocalizedPriceKey.price @@_price ||= LocalizedPriceKey.new('price') end |
.shipping ⇒ Object
4870 4871 4872 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4870 def LocalizedPriceKey.shipping @@_shipping ||= LocalizedPriceKey.new('shipping') end |
.subtotal ⇒ Object
4854 4855 4856 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4854 def LocalizedPriceKey.subtotal @@_subtotal ||= LocalizedPriceKey.new('subtotal') end |
.total ⇒ Object
4874 4875 4876 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4874 def LocalizedPriceKey.total @@_total ||= LocalizedPriceKey.new('total') end |
.vat ⇒ Object
4858 4859 4860 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4858 def LocalizedPriceKey.vat @@_vat ||= LocalizedPriceKey.new('vat') end |
Instance Method Details
#to_hash ⇒ Object
4878 4879 4880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4878 def to_hash value end |