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



7196
7197
7198
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7196

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7194
7195
7196
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7194

def value
  @value
end

Class Method Details

.ALLObject



7216
7217
7218
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7216

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



7201
7202
7203
7204
7205
7206
7207
7208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7201

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



7240
7241
7242
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7240

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



7211
7212
7213
7214
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7211

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

.mondayObject



7224
7225
7226
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7224

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

.saturdayObject



7244
7245
7246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7244

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

.sundayObject



7220
7221
7222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7220

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

.thursdayObject



7236
7237
7238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7236

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

.tuesdayObject



7228
7229
7230
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7228

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

.wednesdayObject



7232
7233
7234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7232

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

Instance Method Details

#to_hashObject



7248
7249
7250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7248

def to_hash
  value
end