Class: Codily::Elements::ResponseObject

Inherits:
ServiceBelonggingBase show all
Includes:
FileLoadable
Defined in:
lib/codily/elements/response_object.rb

Instance Attribute Summary

Attributes inherited from Base

#fastly_obj, #root

Instance Method Summary collapse

Methods included from FileLoadable

included

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



41
42
43
# File 'lib/codily/elements/response_object.rb', line 41

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

#content(obj = nil) ⇒ Object



37
38
39
# File 'lib/codily/elements/response_object.rb', line 37

def content(obj = nil)
  getset :content, file_loadable(obj)
end

#fastly_classObject



49
50
51
# File 'lib/codily/elements/response_object.rb', line 49

def fastly_class
  Fastly::ResponseObject
end

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



45
46
47
# File 'lib/codily/elements/response_object.rb', line 45

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

#setupObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/codily/elements/response_object.rb', line 24

def setup
  delete_if_empty! *%i(
    content
    content_type
    response
    cache_condition
    request_condition
  )
  force_integer! *%i(
    status
  )
end