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.



11779
11780
11781
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11779

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11777
11778
11779
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11777

def value
  @value
end

Class Method Details

.ALLObject



11799
11800
11801
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11799

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



11784
11785
11786
11787
11788
11789
11790
11791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11784

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



11823
11824
11825
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11823

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



11794
11795
11796
11797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11794

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

.mondayObject



11807
11808
11809
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11807

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

.saturdayObject



11827
11828
11829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11827

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

.sundayObject



11803
11804
11805
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11803

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

.thursdayObject



11819
11820
11821
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11819

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

.tuesdayObject



11811
11812
11813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11811

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

.wednesdayObject



11815
11816
11817
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11815

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

Instance Method Details

#to_hashObject



11831
11832
11833
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11831

def to_hash
  value
end