Class: Io::Flow::V0::Models::PriceAccuracy

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ PriceAccuracy

Returns a new instance of PriceAccuracy.



18803
18804
18805
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18803

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18801
18802
18803
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18801

def value
  @value
end

Class Method Details

.ALLObject



18823
18824
18825
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18823

def PriceAccuracy.ALL
  @@all ||= [PriceAccuracy.calculated, PriceAccuracy.estimated_from_partial_destination]
end

.apply(value) ⇒ Object

Returns the instance of PriceAccuracy for this value, creating a new instance for an unknown value



18808
18809
18810
18811
18812
18813
18814
18815
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18808

def PriceAccuracy.apply(value)
  if value.instance_of?(PriceAccuracy)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || PriceAccuracy.new(value))
  end
end

.calculatedObject

The price shown is accurate and will not change unless information already provided also changes.



18829
18830
18831
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18829

def PriceAccuracy.calculated
  @@_calculated ||= PriceAccuracy.new('calculated')
end

.estimated_from_partial_destinationObject

The price shown is based on the best information provided; given a more precise address, the price may change.



18835
18836
18837
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18835

def PriceAccuracy.estimated_from_partial_destination
  @@_estimated_from_partial_destination ||= PriceAccuracy.new('estimated_from_partial_destination')
end

.from_string(value) ⇒ Object

Returns the instance of PriceAccuracy for this value, or nil if not found



18818
18819
18820
18821
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18818

def PriceAccuracy.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  PriceAccuracy.ALL.find { |v| v.value == value }
end

Instance Method Details

#to_hashObject



18839
18840
18841
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18839

def to_hash
  value
end