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.



14272
14273
14274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14272

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14270
14271
14272
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14270

def value
  @value
end

Class Method Details

.ALLObject



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

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



14277
14278
14279
14280
14281
14282
14283
14284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14277

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



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

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



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

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

.mondayObject



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

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

.saturdayObject



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

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

.sundayObject



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

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

.thursdayObject



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

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

.tuesdayObject



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

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

.wednesdayObject



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

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

Instance Method Details

#to_hashObject



14324
14325
14326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14324

def to_hash
  value
end