Class: Io::Flow::V0::Models::AppliedPromotionType

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

Returns a new instance of AppliedPromotionType.



5639
5640
5641
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5639

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5637
5638
5639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5637

def value
  @value
end

Class Method Details

.ALLObject



5659
5660
5661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5659

def AppliedPromotionType.ALL
  @@all ||= [AppliedPromotionType.free_shipping]
end

.apply(value) ⇒ Object

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



5644
5645
5646
5647
5648
5649
5650
5651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5644

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

.free_shippingObject



5663
5664
5665
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5663

def AppliedPromotionType.free_shipping
  @@_free_shipping ||= AppliedPromotionType.new('free_shipping')
end

.from_string(value) ⇒ Object

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



5654
5655
5656
5657
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5654

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

Instance Method Details

#to_hashObject



5667
5668
5669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5667

def to_hash
  value
end