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.



14569
14570
14571
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14569

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14567
14568
14569
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14567

def value
  @value
end

Class Method Details

.ALLObject



14589
14590
14591
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14589

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



14574
14575
14576
14577
14578
14579
14580
14581
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14574

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



14613
14614
14615
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14613

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



14584
14585
14586
14587
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14584

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

.mondayObject



14597
14598
14599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14597

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

.saturdayObject



14617
14618
14619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14617

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

.sundayObject



14593
14594
14595
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14593

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

.thursdayObject



14609
14610
14611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14609

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

.tuesdayObject



14601
14602
14603
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14601

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

.wednesdayObject



14605
14606
14607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14605

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

Instance Method Details

#to_hashObject



14621
14622
14623
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14621

def to_hash
  value
end