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.



15823
15824
15825
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15823

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15821
15822
15823
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15821

def value
  @value
end

Class Method Details

.ALLObject



15843
15844
15845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15843

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



15828
15829
15830
15831
15832
15833
15834
15835
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15828

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



15859
15860
15861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15859

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



15838
15839
15840
15841
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15838

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

.hourObject



15863
15864
15865
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15863

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

.minuteObject



15867
15868
15869
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15867

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

.monthObject



15851
15852
15853
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15851

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

.weekObject



15855
15856
15857
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15855

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

.yearObject



15847
15848
15849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15847

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

Instance Method Details

#to_hashObject



15871
15872
15873
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15871

def to_hash
  value
end