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.



7712
7713
7714
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7712

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7710
7711
7712
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7710

def value
  @value
end

Class Method Details

.ALLObject



7732
7733
7734
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7732

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



7717
7718
7719
7720
7721
7722
7723
7724
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7717

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



7756
7757
7758
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7756

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



7727
7728
7729
7730
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7727

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

.mondayObject



7740
7741
7742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7740

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

.saturdayObject



7760
7761
7762
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7760

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

.sundayObject



7736
7737
7738
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7736

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

.thursdayObject



7752
7753
7754
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7752

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

.tuesdayObject



7744
7745
7746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7744

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

.wednesdayObject



7748
7749
7750
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7748

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

Instance Method Details

#to_hashObject



7764
7765
7766
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7764

def to_hash
  value
end