Class: Io::Flow::V0::Models::DayOfWeek

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) ⇒ DayOfWeek

Returns a new instance of DayOfWeek.



7864
7865
7866
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7864

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7862
7863
7864
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7862

def value
  @value
end

Class Method Details

.ALLObject



7884
7885
7886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7884

def DayOfWeek.ALL
  @@all ||= [DayOfWeek.sunday, DayOfWeek.monday, DayOfWeek.tuesday, DayOfWeek.wednesday, DayOfWeek.thursday, DayOfWeek.friday, DayOfWeek.saturday]
end

.apply(value) ⇒ Object

Returns the instance of DayOfWeek for this value, creating a new instance for an unknown value



7869
7870
7871
7872
7873
7874
7875
7876
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7869

def DayOfWeek.apply(value)
  if value.instance_of?(DayOfWeek)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || DayOfWeek.new(value))
  end
end

.fridayObject



7908
7909
7910
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7908

def DayOfWeek.friday
  @@_friday ||= DayOfWeek.new('friday')
end

.from_string(value) ⇒ Object

Returns the instance of DayOfWeek for this value, or nil if not found



7879
7880
7881
7882
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7879

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

.mondayObject



7892
7893
7894
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7892

def DayOfWeek.monday
  @@_monday ||= DayOfWeek.new('monday')
end

.saturdayObject



7912
7913
7914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7912

def DayOfWeek.saturday
  @@_saturday ||= DayOfWeek.new('saturday')
end

.sundayObject



7888
7889
7890
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7888

def DayOfWeek.sunday
  @@_sunday ||= DayOfWeek.new('sunday')
end

.thursdayObject



7904
7905
7906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7904

def DayOfWeek.thursday
  @@_thursday ||= DayOfWeek.new('thursday')
end

.tuesdayObject



7896
7897
7898
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7896

def DayOfWeek.tuesday
  @@_tuesday ||= DayOfWeek.new('tuesday')
end

.wednesdayObject



7900
7901
7902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7900

def DayOfWeek.wednesday
  @@_wednesday ||= DayOfWeek.new('wednesday')
end

Instance Method Details

#to_hashObject



7916
7917
7918
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7916

def to_hash
  value
end