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.



12981
12982
12983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12981

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12979
12980
12981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12979

def value
  @value
end

Class Method Details

.ALLObject



13001
13002
13003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13001

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



12986
12987
12988
12989
12990
12991
12992
12993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12986

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



13017
13018
13019
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13017

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



12996
12997
12998
12999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12996

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

.hourObject



13021
13022
13023
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13021

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

.minuteObject



13025
13026
13027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13025

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

.monthObject



13009
13010
13011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13009

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

.weekObject



13013
13014
13015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13013

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

.yearObject



13005
13006
13007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13005

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

Instance Method Details

#to_hashObject



13029
13030
13031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13029

def to_hash
  value
end