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.



10663
10664
10665
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10663

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10661
10662
10663
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10661

def value
  @value
end

Class Method Details

.ALLObject



10683
10684
10685
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10683

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



10668
10669
10670
10671
10672
10673
10674
10675
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10668

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



10699
10700
10701
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10699

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



10678
10679
10680
10681
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10678

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

.hourObject



10703
10704
10705
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10703

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

.minuteObject



10707
10708
10709
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10707

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

.monthObject



10691
10692
10693
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10691

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

.weekObject



10695
10696
10697
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10695

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

.yearObject



10687
10688
10689
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10687

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

Instance Method Details

#to_hashObject



10711
10712
10713
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10711

def to_hash
  value
end