Class: Smplkit::Jobs::JobEnvironment
- Inherits:
-
Struct
- Object
- Struct
- Smplkit::Jobs::JobEnvironment
- Defined in:
- lib/smplkit/jobs/models.rb
Overview
Per-environment enablement and optional configuration override for a job.
A recurring job fires in a given environment only when that environment has an entry in Smplkit::Jobs::Job#environments with enabled: true; an environment with no entry (or enabled: false) does not fire there.
Instance Attribute Summary collapse
-
#configuration ⇒ HttpConfig?
Optional per-environment request configuration that fully replaces the job’s base Smplkit::Jobs::Job#configuration for this environment.
-
#enabled ⇒ Boolean
Whether the job fires in this environment.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(enabled: false, configuration: nil) ⇒ JobEnvironment
constructor
A new instance of JobEnvironment.
Constructor Details
#initialize(enabled: false, configuration: nil) ⇒ JobEnvironment
Returns a new instance of JobEnvironment.
263 264 265 |
# File 'lib/smplkit/jobs/models.rb', line 263 def initialize(enabled: false, configuration: nil) super end |
Instance Attribute Details
#configuration ⇒ HttpConfig?
Returns Optional per-environment request configuration that fully replaces the job’s base Smplkit::Jobs::Job#configuration for this environment. nil (the default) inherits the base configuration. As with the base configuration, header values are returned in plaintext on reads, so a get-mutate-put round-trip preserves them.
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/smplkit/jobs/models.rb', line 262 JobEnvironment = Struct.new(:enabled, :configuration, keyword_init: true) do def initialize(enabled: false, configuration: nil) super end # @api private — Build a {JobEnvironment} from the generated wire model. # # @param src [SmplkitGeneratedClient::Jobs::JobEnvironment, nil] The wire # model, or +nil+ for a disabled environment with no override. # @return [JobEnvironment] def self.from_wire(src) return new if src.nil? cfg = src.configuration new( enabled: src.enabled.nil? ? false : src.enabled, configuration: cfg.nil? ? nil : HttpConfig.from_wire(cfg) ) end end |
#enabled ⇒ Boolean
Returns Whether the job fires in this environment. Defaults to false.
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/smplkit/jobs/models.rb', line 262 JobEnvironment = Struct.new(:enabled, :configuration, keyword_init: true) do def initialize(enabled: false, configuration: nil) super end # @api private — Build a {JobEnvironment} from the generated wire model. # # @param src [SmplkitGeneratedClient::Jobs::JobEnvironment, nil] The wire # model, or +nil+ for a disabled environment with no override. # @return [JobEnvironment] def self.from_wire(src) return new if src.nil? cfg = src.configuration new( enabled: src.enabled.nil? ? false : src.enabled, configuration: cfg.nil? ? nil : HttpConfig.from_wire(cfg) ) end end |
Class Method Details
.from_wire(src) ⇒ JobEnvironment
272 273 274 275 276 277 278 279 280 |
# File 'lib/smplkit/jobs/models.rb', line 272 def self.from_wire(src) return new if src.nil? cfg = src.configuration new( enabled: src.enabled.nil? ? false : src.enabled, configuration: cfg.nil? ? nil : HttpConfig.from_wire(cfg) ) end |