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.



14312
14313
14314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14312

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14310
14311
14312
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14310

def value
  @value
end

Class Method Details

.activeObject



14336
14337
14338
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14336

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

.ALLObject



14332
14333
14334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14332

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



14317
14318
14319
14320
14321
14322
14323
14324
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14317

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



14344
14345
14346
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14344

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



14327
14328
14329
14330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14327

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

.scheduledObject



14340
14341
14342
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14340

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

Instance Method Details

#to_hashObject



14348
14349
14350
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14348

def to_hash
  value
end