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.



15962
15963
15964
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15962

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15960
15961
15962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15960

def value
  @value
end

Class Method Details

.ALLObject



15982
15983
15984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15982

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



15967
15968
15969
15970
15971
15972
15973
15974
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15967

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



15998
15999
16000
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15998

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



15977
15978
15979
15980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15977

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

.hourObject



16002
16003
16004
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16002

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

.minuteObject



16006
16007
16008
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16006

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

.monthObject



15990
15991
15992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15990

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

.weekObject



15994
15995
15996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15994

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

.yearObject



15986
15987
15988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15986

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

Instance Method Details

#to_hashObject



16010
16011
16012
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16010

def to_hash
  value
end