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.



9002
9003
9004
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9002

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9000
9001
9002
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9000

def value
  @value
end

Class Method Details

.ALLObject



9022
9023
9024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9022

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



9007
9008
9009
9010
9011
9012
9013
9014
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9007

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



9046
9047
9048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9046

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



9017
9018
9019
9020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9017

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

.mondayObject



9030
9031
9032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9030

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

.saturdayObject



9050
9051
9052
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9050

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

.sundayObject



9026
9027
9028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9026

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

.thursdayObject



9042
9043
9044
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9042

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

.tuesdayObject



9034
9035
9036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9034

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

.wednesdayObject



9038
9039
9040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9038

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

Instance Method Details

#to_hashObject



9054
9055
9056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9054

def to_hash
  value
end