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.



15442
15443
15444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15442

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15440
15441
15442
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15440

def value
  @value
end

Class Method Details

.ALLObject



15462
15463
15464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15462

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



15447
15448
15449
15450
15451
15452
15453
15454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15447

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



15472
15473
15474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15472

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



15457
15458
15459
15460
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15457

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

.weekdaysObject

Mon - Fri



15467
15468
15469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15467

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

Instance Method Details

#to_hashObject



15476
15477
15478
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15476

def to_hash
  value
end