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.



8196
8197
8198
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8196

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8194
8195
8196
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8194

def value
  @value
end

Class Method Details

.ALLObject



8216
8217
8218
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8216

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



8201
8202
8203
8204
8205
8206
8207
8208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8201

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



8240
8241
8242
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8240

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



8211
8212
8213
8214
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8211

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

.mondayObject



8224
8225
8226
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8224

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

.saturdayObject



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

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

.sundayObject



8220
8221
8222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8220

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

.thursdayObject



8236
8237
8238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8236

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

.tuesdayObject



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

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

.wednesdayObject



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

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

Instance Method Details

#to_hashObject



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

def to_hash
  value
end