Class: Foobara::CommandConnectors::Http::SetHeader

Inherits:
ResponseMutator show all
Defined in:
foobara-http-command-connector-0.0.23/src/http/response_mutators/set_header.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from Value::Processor

#created_in_namespace, #declaration_data, #parent_declaration_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ResponseMutator

#result_type_declaration_from

Methods inherited from Value::Mutator

error_classes, foobara_manifest, #process_value

Methods inherited from Value::Processor

#always_applicable?, #applicable?, #attribute_name, #build_error, default_declaration_data, #dup_processor, error_class, error_classes, #error_context, #error_message, #error_path, foobara_manifest, #foobara_manifest, #initialize, #inspect, instance, #method_missing, #name, new_with_agnostic_args, #possible_errors, #priority, #process_outcome, #process_outcome!, #process_value, #process_value!, processor_name, requires_declaration_data?, requires_parent_declaration_data?, #respond_to_missing?, #runner, symbol

Methods included from IsManifestable

#foobara_domain, #foobara_manifest, #foobara_organization, #scoped_clear_caches

Methods included from Foobara::Concern

foobara_class_methods_module_for, foobara_concern?, included

Constructor Details

This class inherits a constructor from Foobara::Value::Processor

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Foobara::Value::Processor

Class Attribute Details

.header_nameObject

Returns the value of attribute header_name.



6
7
8
# File 'foobara-http-command-connector-0.0.23/src/http/response_mutators/set_header.rb', line 6

def header_name
  @header_name
end

.header_valueObject

Returns the value of attribute header_value.



6
7
8
# File 'foobara-http-command-connector-0.0.23/src/http/response_mutators/set_header.rb', line 6

def header_value
  @header_value
end

Instance Attribute Details

#header_nameObject



28
29
30
# File 'foobara-http-command-connector-0.0.23/src/http/response_mutators/set_header.rb', line 28

def header_name
  @header_name ||= self.class.header_name
end

#header_valueObject



32
33
34
# File 'foobara-http-command-connector-0.0.23/src/http/response_mutators/set_header.rb', line 32

def header_value
  @header_value ||= self.class.header_value
end

Class Method Details

.for(header_name, header_value) ⇒ Object



8
9
10
11
12
13
14
15
# File 'foobara-http-command-connector-0.0.23/src/http/response_mutators/set_header.rb', line 8

def for(header_name, header_value)
  subclass = Class.new(self)

  subclass.header_name = header_name
  subclass.header_value = header_value

  subclass
end

Instance Method Details

#mutate(response) ⇒ Object



24
25
26
# File 'foobara-http-command-connector-0.0.23/src/http/response_mutators/set_header.rb', line 24

def mutate(response)
  response.add_header(header_name.to_s, header_value)
end

#result_type_from(result_type) ⇒ Object



20
21
22
# File 'foobara-http-command-connector-0.0.23/src/http/response_mutators/set_header.rb', line 20

def result_type_from(result_type)
  result_type
end