Class: Io::Flow::V0::Models::UnitOfTime

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

Returns a new instance of UnitOfTime.



15895
15896
15897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15895

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15893
15894
15895
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15893

def value
  @value
end

Class Method Details

.ALLObject



15915
15916
15917
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15915

def UnitOfTime.ALL
  @@all ||= [UnitOfTime.year, UnitOfTime.month, UnitOfTime.week, UnitOfTime.day, UnitOfTime.hour, UnitOfTime.minute]
end

.apply(value) ⇒ Object

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



15900
15901
15902
15903
15904
15905
15906
15907
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15900

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

.dayObject



15931
15932
15933
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15931

def UnitOfTime.day
  @@_day ||= UnitOfTime.new('day')
end

.from_string(value) ⇒ Object

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



15910
15911
15912
15913
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15910

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

.hourObject



15935
15936
15937
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15935

def UnitOfTime.hour
  @@_hour ||= UnitOfTime.new('hour')
end

.minuteObject



15939
15940
15941
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15939

def UnitOfTime.minute
  @@_minute ||= UnitOfTime.new('minute')
end

.monthObject



15923
15924
15925
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15923

def UnitOfTime.month
  @@_month ||= UnitOfTime.new('month')
end

.weekObject



15927
15928
15929
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15927

def UnitOfTime.week
  @@_week ||= UnitOfTime.new('week')
end

.yearObject



15919
15920
15921
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15919

def UnitOfTime.year
  @@_year ||= UnitOfTime.new('year')
end

Instance Method Details

#to_hashObject



15943
15944
15945
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15943

def to_hash
  value
end