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.



13766
13767
13768
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13766

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.ALLObject



13786
13787
13788
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13786

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



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

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



13802
13803
13804
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13802

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



13781
13782
13783
13784
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13781

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

.hourObject



13806
13807
13808
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13806

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

.minuteObject



13810
13811
13812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13810

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

.monthObject



13794
13795
13796
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13794

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

.weekObject



13798
13799
13800
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13798

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

.yearObject



13790
13791
13792
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13790

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

Instance Method Details

#to_hashObject



13814
13815
13816
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13814

def to_hash
  value
end