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.



27583
27584
27585
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27583

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



27581
27582
27583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27581

def value
  @value
end

Class Method Details

.ALLObject



27603
27604
27605
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27603

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

.alwaysObject

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



27608
27609
27610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27608

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



27588
27589
27590
27591
27592
27593
27594
27595
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27588

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



27614
27615
27616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27614

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



27598
27599
27600
27601
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27598

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



27618
27619
27620
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27618

def to_hash
  value
end