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.



7189
7190
7191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7189

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7187
7188
7189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7187

def value
  @value
end

Class Method Details

.ALLObject



7209
7210
7211
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7209

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



7194
7195
7196
7197
7198
7199
7200
7201
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7194

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



7233
7234
7235
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7233

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



7204
7205
7206
7207
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7204

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

.mondayObject



7217
7218
7219
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7217

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

.saturdayObject



7237
7238
7239
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7237

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

.sundayObject



7213
7214
7215
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7213

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

.thursdayObject



7229
7230
7231
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7229

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

.tuesdayObject



7221
7222
7223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7221

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

.wednesdayObject



7225
7226
7227
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7225

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

Instance Method Details

#to_hashObject



7241
7242
7243
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7241

def to_hash
  value
end