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.



9307
9308
9309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9307

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9305
9306
9307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9305

def value
  @value
end

Class Method Details

.ALLObject



9327
9328
9329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9327

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



9312
9313
9314
9315
9316
9317
9318
9319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9312

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



9351
9352
9353
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9351

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



9322
9323
9324
9325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9322

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

.mondayObject



9335
9336
9337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9335

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

.saturdayObject



9355
9356
9357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9355

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

.sundayObject



9331
9332
9333
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9331

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

.thursdayObject



9347
9348
9349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9347

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

.tuesdayObject



9339
9340
9341
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9339

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

.wednesdayObject



9343
9344
9345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9343

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

Instance Method Details

#to_hashObject



9359
9360
9361
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9359

def to_hash
  value
end