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.



10732
10733
10734
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10732

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10730
10731
10732
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10730

def value
  @value
end

Class Method Details

.ALLObject



10752
10753
10754
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10752

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



10737
10738
10739
10740
10741
10742
10743
10744
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10737

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



10776
10777
10778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10776

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



10747
10748
10749
10750
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10747

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

.mondayObject



10760
10761
10762
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10760

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

.saturdayObject



10780
10781
10782
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10780

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

.sundayObject



10756
10757
10758
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10756

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

.thursdayObject



10772
10773
10774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10772

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

.tuesdayObject



10764
10765
10766
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10764

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

.wednesdayObject



10768
10769
10770
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10768

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

Instance Method Details

#to_hashObject



10784
10785
10786
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10784

def to_hash
  value
end