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.



10673
10674
10675
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10673

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10671
10672
10673
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10671

def value
  @value
end

Class Method Details

.ALLObject



10693
10694
10695
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10693

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



10678
10679
10680
10681
10682
10683
10684
10685
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10678

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



10717
10718
10719
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10717

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



10688
10689
10690
10691
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10688

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

.mondayObject



10701
10702
10703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10701

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

.saturdayObject



10721
10722
10723
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10721

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

.sundayObject



10697
10698
10699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10697

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

.thursdayObject



10713
10714
10715
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10713

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

.tuesdayObject



10705
10706
10707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10705

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

.wednesdayObject



10709
10710
10711
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10709

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

Instance Method Details

#to_hashObject



10725
10726
10727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10725

def to_hash
  value
end