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.



12929
12930
12931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12929

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12927
12928
12929
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12927

def value
  @value
end

Class Method Details

.ALLObject



12949
12950
12951
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12949

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



12934
12935
12936
12937
12938
12939
12940
12941
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12934

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



12973
12974
12975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12973

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



12944
12945
12946
12947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12944

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

.mondayObject



12957
12958
12959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12957

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

.saturdayObject



12977
12978
12979
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12977

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

.sundayObject



12953
12954
12955
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12953

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

.thursdayObject



12969
12970
12971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12969

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

.tuesdayObject



12961
12962
12963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12961

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

.wednesdayObject



12965
12966
12967
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12965

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

Instance Method Details

#to_hashObject



12981
12982
12983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12981

def to_hash
  value
end