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.



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

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.ALLObject



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

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



8258
8259
8260
8261
8262
8263
8264
8265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8258

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



8297
8298
8299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8297

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



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

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

.mondayObject



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

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

.saturdayObject



8301
8302
8303
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8301

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

.sundayObject



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

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

.thursdayObject



8293
8294
8295
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8293

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

.tuesdayObject



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

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

.wednesdayObject



8289
8290
8291
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8289

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

Instance Method Details

#to_hashObject



8305
8306
8307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8305

def to_hash
  value
end