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.



18904
18905
18906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18904

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18902
18903
18904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18902

def value
  @value
end

Class Method Details

.activeObject



18928
18929
18930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18928

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

.ALLObject



18924
18925
18926
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18924

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



18909
18910
18911
18912
18913
18914
18915
18916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18909

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



18936
18937
18938
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18936

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



18919
18920
18921
18922
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18919

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

.scheduledObject



18932
18933
18934
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18932

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

Instance Method Details

#to_hashObject



18940
18941
18942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18940

def to_hash
  value
end