Class: Io::Flow::V0::Models::DiscountRuleStatus

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

Returns a new instance of DiscountRuleStatus.



14776
14777
14778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14776

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14774
14775
14776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14774

def value
  @value
end

Class Method Details

.activeObject



14800
14801
14802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14800

def DiscountRuleStatus.active
  @@_active ||= DiscountRuleStatus.new('active')
end

.ALLObject



14796
14797
14798
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14796

def DiscountRuleStatus.ALL
  @@all ||= [DiscountRuleStatus.active, DiscountRuleStatus.scheduled, DiscountRuleStatus.expired]
end

.apply(value) ⇒ Object

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



14781
14782
14783
14784
14785
14786
14787
14788
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14781

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

.expiredObject



14808
14809
14810
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14808

def DiscountRuleStatus.expired
  @@_expired ||= DiscountRuleStatus.new('expired')
end

.from_string(value) ⇒ Object

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



14791
14792
14793
14794
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14791

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

.scheduledObject



14804
14805
14806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14804

def DiscountRuleStatus.scheduled
  @@_scheduled ||= DiscountRuleStatus.new('scheduled')
end

Instance Method Details

#to_hashObject



14812
14813
14814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14812

def to_hash
  value
end