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.



8230
8231
8232
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8230

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8228
8229
8230
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8228

def value
  @value
end

Class Method Details

.ALLObject



8250
8251
8252
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8250

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



8235
8236
8237
8238
8239
8240
8241
8242
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8235

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



8274
8275
8276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8274

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



8245
8246
8247
8248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8245

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

.mondayObject



8258
8259
8260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8258

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

.saturdayObject



8278
8279
8280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8278

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

.sundayObject



8254
8255
8256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8254

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

.thursdayObject



8270
8271
8272
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8270

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

.tuesdayObject



8262
8263
8264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8262

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

.wednesdayObject



8266
8267
8268
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8266

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

Instance Method Details

#to_hashObject



8282
8283
8284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8282

def to_hash
  value
end