Class: Io::Flow::V0::Models::TrackingNumberType

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

Returns a new instance of TrackingNumberType.



15686
15687
15688
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15686

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15684
15685
15686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15684

def value
  @value
end

Class Method Details

.ALLObject



15706
15707
15708
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15706

def TrackingNumberType.ALL
  @@all ||= [TrackingNumberType.flow, TrackingNumberType.carrier]
end

.apply(value) ⇒ Object

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



15691
15692
15693
15694
15695
15696
15697
15698
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15691

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

.carrierObject



15714
15715
15716
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15714

def TrackingNumberType.carrier
  @@_carrier ||= TrackingNumberType.new('carrier')
end

.flowObject



15710
15711
15712
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15710

def TrackingNumberType.flow
  @@_flow ||= TrackingNumberType.new('flow')
end

.from_string(value) ⇒ Object

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



15701
15702
15703
15704
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15701

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

Instance Method Details

#to_hashObject



15718
15719
15720
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15718

def to_hash
  value
end