Class: Io::Flow::V0::Models::HolidayCalendar

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

Returns a new instance of HolidayCalendar.



8528
8529
8530
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8528

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8526
8527
8528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8526

def value
  @value
end

Class Method Details

.ALLObject



8548
8549
8550
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8548

def HolidayCalendar.ALL
  @@all ||= [HolidayCalendar.us_bank_holidays, HolidayCalendar.jewish_holidays]
end

.apply(value) ⇒ Object

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



8533
8534
8535
8536
8537
8538
8539
8540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8533

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

.from_string(value) ⇒ Object

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



8543
8544
8545
8546
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8543

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

.jewish_holidaysObject



8556
8557
8558
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8556

def HolidayCalendar.jewish_holidays
  @@_jewish_holidays ||= HolidayCalendar.new('jewish_holidays')
end

.us_bank_holidaysObject



8552
8553
8554
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8552

def HolidayCalendar.us_bank_holidays
  @@_us_bank_holidays ||= HolidayCalendar.new('us_bank_holidays')
end

Instance Method Details

#to_hashObject



8560
8561
8562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8560

def to_hash
  value
end