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.



18486
18487
18488
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18486

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18484
18485
18486
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18484

def value
  @value
end

Class Method Details

.ALLObject



18506
18507
18508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18506

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



18491
18492
18493
18494
18495
18496
18497
18498
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18491

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



18530
18531
18532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18530

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



18501
18502
18503
18504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18501

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

.mondayObject



18514
18515
18516
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18514

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

.saturdayObject



18534
18535
18536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18534

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

.sundayObject



18510
18511
18512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18510

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

.thursdayObject



18526
18527
18528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18526

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

.tuesdayObject



18518
18519
18520
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18518

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

.wednesdayObject



18522
18523
18524
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18522

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

Instance Method Details

#to_hashObject



18538
18539
18540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18538

def to_hash
  value
end