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.



13764
13765
13766
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13764

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13762
13763
13764
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13762

def value
  @value
end

Class Method Details

.ALLObject



13784
13785
13786
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13784

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



13769
13770
13771
13772
13773
13774
13775
13776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13769

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



13800
13801
13802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13800

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



13779
13780
13781
13782
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13779

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

.hourObject



13804
13805
13806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13804

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

.minuteObject



13808
13809
13810
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13808

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

.monthObject



13792
13793
13794
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13792

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

.weekObject



13796
13797
13798
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13796

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

.yearObject



13788
13789
13790
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13788

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

Instance Method Details

#to_hashObject



13812
13813
13814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13812

def to_hash
  value
end