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.



14366
14367
14368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14366

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14364
14365
14366
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14364

def value
  @value
end

Class Method Details

.ALLObject



14386
14387
14388
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14386

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



14371
14372
14373
14374
14375
14376
14377
14378
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14371

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



14410
14411
14412
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14410

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



14381
14382
14383
14384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14381

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

.mondayObject



14394
14395
14396
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14394

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

.saturdayObject



14414
14415
14416
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14414

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

.sundayObject



14390
14391
14392
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14390

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

.thursdayObject



14406
14407
14408
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14406

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

.tuesdayObject



14398
14399
14400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14398

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

.wednesdayObject



14402
14403
14404
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14402

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

Instance Method Details

#to_hashObject



14418
14419
14420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14418

def to_hash
  value
end