Class: Io::Flow::V0::Models::TierAvailability

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

Returns a new instance of TierAvailability.



19742
19743
19744
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19742

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19740
19741
19742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19740

def value
  @value
end

Class Method Details

.ALLObject



19762
19763
19764
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19762

def TierAvailability.ALL
  @@all ||= [TierAvailability.always, TierAvailability.backup]
end

.alwaysObject

The tier will always be considered to be offered for a customer order shipment



19767
19768
19769
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19767

def TierAvailability.always
  @@_always ||= TierAvailability.new('always')
end

.apply(value) ⇒ Object

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



19747
19748
19749
19750
19751
19752
19753
19754
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19747

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

.backupObject

Indicates that a tier should only be offered as a shipping option when ‘always` tiers are not available



19773
19774
19775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19773

def TierAvailability.backup
  @@_backup ||= TierAvailability.new('backup')
end

.from_string(value) ⇒ Object

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



19757
19758
19759
19760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19757

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

Instance Method Details

#to_hashObject



19777
19778
19779
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19777

def to_hash
  value
end