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.



7337
7338
7339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7337

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7335
7336
7337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7335

def value
  @value
end

Class Method Details

.ALLObject



7357
7358
7359
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7357

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



7342
7343
7344
7345
7346
7347
7348
7349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7342

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



7381
7382
7383
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7381

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



7352
7353
7354
7355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7352

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

.mondayObject



7365
7366
7367
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7365

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

.saturdayObject



7385
7386
7387
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7385

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

.sundayObject



7361
7362
7363
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7361

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

.thursdayObject



7377
7378
7379
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7377

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

.tuesdayObject



7369
7370
7371
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7369

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

.wednesdayObject



7373
7374
7375
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7373

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

Instance Method Details

#to_hashObject



7389
7390
7391
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7389

def to_hash
  value
end