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.



14044
14045
14046
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14044

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14042
14043
14044
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14042

def value
  @value
end

Class Method Details

.activeObject



14068
14069
14070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14068

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

.ALLObject



14064
14065
14066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14064

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



14049
14050
14051
14052
14053
14054
14055
14056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14049

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



14076
14077
14078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14076

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



14059
14060
14061
14062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14059

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

.scheduledObject



14072
14073
14074
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14072

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

Instance Method Details

#to_hashObject



14080
14081
14082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14080

def to_hash
  value
end