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.



8234
8235
8236
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8234

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8232
8233
8234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8232

def value
  @value
end

Class Method Details

.ALLObject



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

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



8239
8240
8241
8242
8243
8244
8245
8246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8239

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



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

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



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

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

.mondayObject



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

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

.saturdayObject



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

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

.sundayObject



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

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

.thursdayObject



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

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

.tuesdayObject



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

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

.wednesdayObject



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

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

Instance Method Details

#to_hashObject



8286
8287
8288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8286

def to_hash
  value
end