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.



14267
14268
14269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14267

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14265
14266
14267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14265

def value
  @value
end

Class Method Details

.ALLObject



14287
14288
14289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14287

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



14272
14273
14274
14275
14276
14277
14278
14279
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14272

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



14311
14312
14313
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14311

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



14282
14283
14284
14285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14282

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

.mondayObject



14295
14296
14297
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14295

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

.saturdayObject



14315
14316
14317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14315

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

.sundayObject



14291
14292
14293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14291

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

.thursdayObject



14307
14308
14309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14307

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

.tuesdayObject



14299
14300
14301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14299

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

.wednesdayObject



14303
14304
14305
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14303

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

Instance Method Details

#to_hashObject



14319
14320
14321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14319

def to_hash
  value
end