Class: Io::Flow::V0::Models::DeliveryWindowComponentSource

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

Returns a new instance of DeliveryWindowComponentSource.



9568
9569
9570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9568

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9566
9567
9568
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9566

def value
  @value
end

Class Method Details

.ALLObject



9588
9589
9590
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9588

def DeliveryWindowComponentSource.ALL
  @@all ||= [DeliveryWindowComponentSource.flow, DeliveryWindowComponentSource.organization, DeliveryWindowComponentSource.carrier, DeliveryWindowComponentSource.center, DeliveryWindowComponentSource.mixed]
end

.apply(value) ⇒ Object

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



9573
9574
9575
9576
9577
9578
9579
9580
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9573

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

.carrierObject



9600
9601
9602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9600

def DeliveryWindowComponentSource.carrier
  @@_carrier ||= DeliveryWindowComponentSource.new('carrier')
end

.centerObject



9604
9605
9606
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9604

def DeliveryWindowComponentSource.center
  @@_center ||= DeliveryWindowComponentSource.new('center')
end

.flowObject



9592
9593
9594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9592

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

.from_string(value) ⇒ Object

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



9583
9584
9585
9586
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9583

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

.mixedObject

A delivery estimate may be a combination of multiple sources



9609
9610
9611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9609

def DeliveryWindowComponentSource.mixed
  @@_mixed ||= DeliveryWindowComponentSource.new('mixed')
end

.organizationObject



9596
9597
9598
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9596

def DeliveryWindowComponentSource.organization
  @@_organization ||= DeliveryWindowComponentSource.new('organization')
end

Instance Method Details

#to_hashObject



9613
9614
9615
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9613

def to_hash
  value
end