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.



11751
11752
11753
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11751

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11749
11750
11751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11749

def value
  @value
end

Class Method Details

.ALLObject



11771
11772
11773
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11771

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



11756
11757
11758
11759
11760
11761
11762
11763
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11756

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



11787
11788
11789
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11787

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



11766
11767
11768
11769
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11766

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

.hourObject



11791
11792
11793
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11791

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

.minuteObject



11795
11796
11797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11795

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

.monthObject



11779
11780
11781
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11779

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

.weekObject



11783
11784
11785
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11783

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

.yearObject



11775
11776
11777
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11775

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

Instance Method Details

#to_hashObject



11799
11800
11801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11799

def to_hash
  value
end