Class: Codily::Elements::CacheSetting

Inherits:
ServiceBelonggingBase show all
Defined in:
lib/codily/elements/cache_setting.rb

Instance Attribute Summary

Attributes inherited from Base

#fastly_obj, #root

Instance Method Summary collapse

Methods inherited from ServiceBelonggingBase

#as_hash, #initialize, #key, parent_class, #parent_key, #service_id, #service_name

Methods inherited from Base

#as_dsl_hash, #as_hash, def_attr, defaults, #dsl_args, #id, #initialize, #inspect, #key, #name, name_for_attr, #parent, #parent_class, parent_class, #parent_key, #parents, path

Constructor Details

This class inherits a constructor from Codily::Elements::ServiceBelonggingBase

Instance Method Details

#cache_condition(name = nil, &block) ⇒ Object



23
24
25
# File 'lib/codily/elements/cache_setting.rb', line 23

def cache_condition(name = nil, &block)
  set_refer_element(:cache_condition, Condition, {name: name, type: 'CACHE', _service_name: self.service_name}, &block)
end

#fastly_classObject



27
28
29
# File 'lib/codily/elements/cache_setting.rb', line 27

def fastly_class
  Fastly::CacheSetting
end

#setupObject



13
14
15
16
17
18
19
20
21
# File 'lib/codily/elements/cache_setting.rb', line 13

def setup
  delete_if_empty! *%i(
    cache_condition
  )
  force_integer! *%i(
    ttl
    stale_ttl
  )
end