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.



10115
10116
10117
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10115

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10113
10114
10115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10113

def value
  @value
end

Class Method Details

.ALLObject



10135
10136
10137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10135

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



10120
10121
10122
10123
10124
10125
10126
10127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10120

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



10130
10131
10132
10133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10130

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

.jewish_holidaysObject



10143
10144
10145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10143

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

.us_bank_holidaysObject



10139
10140
10141
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10139

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

Instance Method Details

#to_hashObject



10147
10148
10149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10147

def to_hash
  value
end