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.



11480
11481
11482
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11480

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11478
11479
11480
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11478

def value
  @value
end

Class Method Details

.ALLObject



11500
11501
11502
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11500

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



11485
11486
11487
11488
11489
11490
11491
11492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11485

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



11524
11525
11526
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11524

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



11495
11496
11497
11498
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11495

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

.mondayObject



11508
11509
11510
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11508

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

.saturdayObject



11528
11529
11530
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11528

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

.sundayObject



11504
11505
11506
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11504

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

.thursdayObject



11520
11521
11522
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11520

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

.tuesdayObject



11512
11513
11514
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11512

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

.wednesdayObject



11516
11517
11518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11516

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

Instance Method Details

#to_hashObject



11532
11533
11534
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11532

def to_hash
  value
end