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.



14697
14698
14699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14697

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14695
14696
14697
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14695

def value
  @value
end

Class Method Details

.ALLObject



14717
14718
14719
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14717

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



14702
14703
14704
14705
14706
14707
14708
14709
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14702

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



14741
14742
14743
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14741

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



14712
14713
14714
14715
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14712

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

.mondayObject



14725
14726
14727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14725

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

.saturdayObject



14745
14746
14747
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14745

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

.sundayObject



14721
14722
14723
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14721

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

.thursdayObject



14737
14738
14739
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14737

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

.tuesdayObject



14729
14730
14731
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14729

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

.wednesdayObject



14733
14734
14735
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14733

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

Instance Method Details

#to_hashObject



14749
14750
14751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14749

def to_hash
  value
end