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.



12262
12263
12264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12262

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12260
12261
12262
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12260

def value
  @value
end

Class Method Details

.ALLObject



12282
12283
12284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12282

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



12267
12268
12269
12270
12271
12272
12273
12274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12267

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



12277
12278
12279
12280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12277

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

.jewish_holidaysObject



12290
12291
12292
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12290

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

.us_bank_holidaysObject



12286
12287
12288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12286

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

Instance Method Details

#to_hashObject



12294
12295
12296
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12294

def to_hash
  value
end