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.



7308
7309
7310
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7308

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7306
7307
7308
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7306

def value
  @value
end

Class Method Details

.ALLObject



7328
7329
7330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7328

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



7313
7314
7315
7316
7317
7318
7319
7320
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7313

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



7336
7337
7338
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7336

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

.enabledObject



7332
7333
7334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7332

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



7323
7324
7325
7326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7323

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



7340
7341
7342
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7340

def to_hash
  value
end