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.



25114
25115
25116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25114

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



25112
25113
25114
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25112

def value
  @value
end

Class Method Details

.ALLObject



25134
25135
25136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25134

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



25119
25120
25121
25122
25123
25124
25125
25126
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25119

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.



25140
25141
25142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25140

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.



25146
25147
25148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25146

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



25129
25130
25131
25132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25129

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



25150
25151
25152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25150

def to_hash
  value
end