Class: Io::Flow::V0::Models::Calendar

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) ⇒ Calendar

Returns a new instance of Calendar.



6810
6811
6812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6810

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6808
6809
6810
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6808

def value
  @value
end

Class Method Details

.ALLObject



6830
6831
6832
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6830

def Calendar.ALL
  @@all ||= [Calendar.weekdays, Calendar.everyday]
end

.apply(value) ⇒ Object

Returns the instance of Calendar for this value, creating a new instance for an unknown value



6815
6816
6817
6818
6819
6820
6821
6822
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6815

def Calendar.apply(value)
  if value.instance_of?(Calendar)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || Calendar.new(value))
  end
end

.everydayObject

7 days per week



6840
6841
6842
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6840

def Calendar.everyday
  @@_everyday ||= Calendar.new('everyday')
end

.from_string(value) ⇒ Object

Returns the instance of Calendar for this value, or nil if not found



6825
6826
6827
6828
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6825

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

.weekdaysObject

Mon - Fri



6835
6836
6837
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6835

def Calendar.weekdays
  @@_weekdays ||= Calendar.new('weekdays')
end

Instance Method Details

#to_hashObject



6844
6845
6846
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6844

def to_hash
  value
end