Class: LogBrew::TelemetryResourceBuilder
- Inherits:
-
Object
- Object
- LogBrew::TelemetryResourceBuilder
- Defined in:
- lib/logbrew/telemetry_resource.rb
Overview
Builder for one immutable telemetry resource.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize ⇒ TelemetryResourceBuilder
constructor
A new instance of TelemetryResourceBuilder.
- #with_application(name: nil, version: nil, build: nil) ⇒ Object
- #with_deployment(environment: nil, release: nil) ⇒ Object
- #with_device(family: nil, model: nil, architecture: nil) ⇒ Object
- #with_framework(name:, version: nil) ⇒ Object
- #with_operating_system(name:, version: nil, build: nil) ⇒ Object
- #with_runtime(name:, version: nil) ⇒ Object
- #with_service(name:, version: nil) ⇒ Object
Constructor Details
#initialize ⇒ TelemetryResourceBuilder
Returns a new instance of TelemetryResourceBuilder.
106 107 108 |
# File 'lib/logbrew/telemetry_resource.rb', line 106 def initialize @value = {} end |
Instance Method Details
#build ⇒ Object
145 146 147 |
# File 'lib/logbrew/telemetry_resource.rb', line 145 def build TelemetryResource.from_hash(@value) end |
#with_application(name: nil, version: nil, build: nil) ⇒ Object
140 141 142 143 |
# File 'lib/logbrew/telemetry_resource.rb', line 140 def with_application(name: nil, version: nil, build: nil) @value["application"] = optional_fields(name: name, version: version, build: build) self end |
#with_deployment(environment: nil, release: nil) ⇒ Object
115 116 117 118 |
# File 'lib/logbrew/telemetry_resource.rb', line 115 def with_deployment(environment: nil, release: nil) @value["deployment"] = optional_fields(environment: environment, release: release) self end |
#with_device(family: nil, model: nil, architecture: nil) ⇒ Object
135 136 137 138 |
# File 'lib/logbrew/telemetry_resource.rb', line 135 def with_device(family: nil, model: nil, architecture: nil) @value["device"] = optional_fields(family: family, model: model, architecture: architecture) self end |
#with_framework(name:, version: nil) ⇒ Object
125 126 127 128 |
# File 'lib/logbrew/telemetry_resource.rb', line 125 def with_framework(name:, version: nil) @value["framework"] = named_version(name, version) self end |
#with_operating_system(name:, version: nil, build: nil) ⇒ Object
130 131 132 133 |
# File 'lib/logbrew/telemetry_resource.rb', line 130 def (name:, version: nil, build: nil) @value["operatingSystem"] = optional_fields(name: name, version: version, build: build) self end |
#with_runtime(name:, version: nil) ⇒ Object
120 121 122 123 |
# File 'lib/logbrew/telemetry_resource.rb', line 120 def with_runtime(name:, version: nil) @value["runtime"] = named_version(name, version) self end |
#with_service(name:, version: nil) ⇒ Object
110 111 112 113 |
# File 'lib/logbrew/telemetry_resource.rb', line 110 def with_service(name:, version: nil) @value["service"] = named_version(name, version) self end |