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.



8185
8186
8187
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8185

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8183
8184
8185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8183

def value
  @value
end

Class Method Details

.ALLObject



8205
8206
8207
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8205

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



8190
8191
8192
8193
8194
8195
8196
8197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8190

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



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

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



8200
8201
8202
8203
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8200

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

.mondayObject



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

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

.saturdayObject



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

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

.sundayObject



8209
8210
8211
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8209

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

.thursdayObject



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

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

.tuesdayObject



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

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

.wednesdayObject



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

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

Instance Method Details

#to_hashObject



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

def to_hash
  value
end