Class: Io::Flow::V0::Models::AvailabilityStatus

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

Returns a new instance of AvailabilityStatus.



9481
9482
9483
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9481

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9479
9480
9481
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9479

def value
  @value
end

Class Method Details

.ALLObject



9501
9502
9503
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9501

def AvailabilityStatus.ALL
  @@all ||= [AvailabilityStatus.enabled, AvailabilityStatus.disabled]
end

.apply(value) ⇒ Object

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



9486
9487
9488
9489
9490
9491
9492
9493
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9486

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

.disabledObject



9509
9510
9511
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9509

def AvailabilityStatus.disabled
  @@_disabled ||= AvailabilityStatus.new('disabled')
end

.enabledObject



9505
9506
9507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9505

def AvailabilityStatus.enabled
  @@_enabled ||= AvailabilityStatus.new('enabled')
end

.from_string(value) ⇒ Object

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



9496
9497
9498
9499
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9496

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

Instance Method Details

#to_hashObject



9513
9514
9515
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9513

def to_hash
  value
end