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.



13428
13429
13430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13428

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13426
13427
13428
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13426

def value
  @value
end

Class Method Details

.ALLObject



13448
13449
13450
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13448

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



13433
13434
13435
13436
13437
13438
13439
13440
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13433

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



13456
13457
13458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13456

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

.enabledObject



13452
13453
13454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13452

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



13443
13444
13445
13446
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13443

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



13460
13461
13462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13460

def to_hash
  value
end