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.



13490
13491
13492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13490

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13488
13489
13490
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13488

def value
  @value
end

Class Method Details

.ALLObject



13510
13511
13512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13510

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



13495
13496
13497
13498
13499
13500
13501
13502
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13495

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



13534
13535
13536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13534

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



13505
13506
13507
13508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13505

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

.mondayObject



13518
13519
13520
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13518

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

.saturdayObject



13538
13539
13540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13538

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

.sundayObject



13514
13515
13516
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13514

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

.thursdayObject



13530
13531
13532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13530

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

.tuesdayObject



13522
13523
13524
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13522

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

.wednesdayObject



13526
13527
13528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13526

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

Instance Method Details

#to_hashObject



13542
13543
13544
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13542

def to_hash
  value
end