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.



11470
11471
11472
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11470

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11468
11469
11470
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11468

def value
  @value
end

Class Method Details

.ALLObject



11490
11491
11492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11490

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



11475
11476
11477
11478
11479
11480
11481
11482
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11475

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



11514
11515
11516
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11514

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



11485
11486
11487
11488
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11485

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

.mondayObject



11498
11499
11500
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11498

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

.saturdayObject



11518
11519
11520
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11518

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

.sundayObject



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

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

.thursdayObject



11510
11511
11512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11510

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

.tuesdayObject



11502
11503
11504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11502

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

.wednesdayObject



11506
11507
11508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11506

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

Instance Method Details

#to_hashObject



11522
11523
11524
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11522

def to_hash
  value
end