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.



16922
16923
16924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16922

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16920
16921
16922
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16920

def value
  @value
end

Class Method Details

.ALLObject



16942
16943
16944
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16942

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



16927
16928
16929
16930
16931
16932
16933
16934
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16927

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



16958
16959
16960
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16958

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



16937
16938
16939
16940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16937

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

.hourObject



16962
16963
16964
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16962

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

.minuteObject



16966
16967
16968
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16966

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

.monthObject



16950
16951
16952
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16950

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

.weekObject



16954
16955
16956
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16954

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

.yearObject



16946
16947
16948
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16946

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

Instance Method Details

#to_hashObject



16970
16971
16972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16970

def to_hash
  value
end