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.



21849
21850
21851
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21849

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



21847
21848
21849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21847

def value
  @value
end

Class Method Details

.ALLObject



21869
21870
21871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21869

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



21854
21855
21856
21857
21858
21859
21860
21861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21854

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



21885
21886
21887
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21885

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



21864
21865
21866
21867
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21864

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

.hourObject



21889
21890
21891
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21889

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

.minuteObject



21893
21894
21895
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21893

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

.monthObject



21877
21878
21879
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21877

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

.weekObject



21881
21882
21883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21881

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

.yearObject



21873
21874
21875
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21873

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

Instance Method Details

#to_hashObject



21897
21898
21899
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21897

def to_hash
  value
end