Class: Io::Flow::V0::Models::CostEstimateSource

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) ⇒ CostEstimateSource

Returns a new instance of CostEstimateSource.



18071
18072
18073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18071

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18069
18070
18071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18069

def value
  @value
end

Class Method Details

.ALLObject



18091
18092
18093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18091

def CostEstimateSource.ALL
  @@all ||= [CostEstimateSource.flow, CostEstimateSource.channel]
end

.apply(value) ⇒ Object

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



18076
18077
18078
18079
18080
18081
18082
18083
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18076

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

.channelObject

The channel partner calculated the estimated cost for the shipping label



18101
18102
18103
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18101

def CostEstimateSource.channel
  @@_channel ||= CostEstimateSource.new('channel')
end

.flowObject

Flow calculated the estimated cost for the shipping label



18096
18097
18098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18096

def CostEstimateSource.flow
  @@_flow ||= CostEstimateSource.new('flow')
end

.from_string(value) ⇒ Object

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



18086
18087
18088
18089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18086

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

Instance Method Details

#to_hashObject



18105
18106
18107
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18105

def to_hash
  value
end