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.



11221
11222
11223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11221

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11219
11220
11221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11219

def value
  @value
end

Class Method Details

.ALLObject



11241
11242
11243
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11241

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



11226
11227
11228
11229
11230
11231
11232
11233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11226

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



11265
11266
11267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11265

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



11236
11237
11238
11239
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11236

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

.mondayObject



11249
11250
11251
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11249

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

.saturdayObject



11269
11270
11271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11269

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

.sundayObject



11245
11246
11247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11245

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

.thursdayObject



11261
11262
11263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11261

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

.tuesdayObject



11253
11254
11255
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11253

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

.wednesdayObject



11257
11258
11259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11257

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

Instance Method Details

#to_hashObject



11273
11274
11275
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11273

def to_hash
  value
end