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.



10948
10949
10950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10948

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10946
10947
10948
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10946

def value
  @value
end

Class Method Details

.ALLObject



10968
10969
10970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10968

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



10953
10954
10955
10956
10957
10958
10959
10960
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10953

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



10984
10985
10986
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10984

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



10963
10964
10965
10966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10963

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

.hourObject



10988
10989
10990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10988

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

.minuteObject



10992
10993
10994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10992

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

.monthObject



10976
10977
10978
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10976

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

.weekObject



10980
10981
10982
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10980

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

.yearObject



10972
10973
10974
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10972

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

Instance Method Details

#to_hashObject



10996
10997
10998
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10996

def to_hash
  value
end