Class: LogStruct::Log::Shrine::Upload
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::Shrine::Upload
- Extended by:
- T::Sig
- Defined in:
- lib/log_struct/log/shrine/upload.rb
Instance Attribute Summary collapse
-
#duration_ms ⇒ Float?
readonly
Returns the value of prop
duration_ms. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#location ⇒ String
readonly
Returns the value of prop
location. -
#options ⇒ Hash{Symbol => T.untyped}?
readonly
Returns the value of prop
options. -
#source ⇒ Source::Shrine
readonly
Shared/common fields.
-
#storage ⇒ Symbol
readonly
Event-specific fields.
-
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp. -
#upload_options ⇒ Hash{Symbol => T.untyped}?
readonly
Returns the value of prop
upload_options. -
#uploader ⇒ String?
readonly
Returns the value of prop
uploader.
Instance Method Summary collapse
- #initialize(source: Source::Shrine, event: Event::Upload, timestamp:, level: Level::Info, storage:, location:, upload_options: nil, options: nil, uploader: nil, duration_ms: nil) ⇒ void constructor
- #to_h ⇒ Hash{LogStruct::LogField => T.untyped}
Methods included from LogStruct::Log::Shared::SerializeCommon
#as_json, #serialize, #serialize_common
Methods included from Interfaces::CommonFields
Constructor Details
#initialize(source: Source::Shrine, event: Event::Upload, timestamp:, level: Level::Info, storage:, location:, upload_options: nil, options: nil, uploader: nil, duration_ms: nil) ⇒ void
|
|
# File '' const :source, Source::Shrine, default: Source::Shrine const :event, Event, default: Event::Upload const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :storage, Symbol const :location, String const :upload_options, T.nilable(T::Hash[Symbol, T.untyped]), default: nil const :options, T.nilable(T::Hash[Symbol, T.untyped]), default: nil const :uploader, T.nilable(String), default: nil const :duration_ms, T.nilable(Float), default: nil |
Instance Attribute Details
#duration_ms ⇒ Float? (readonly)
Returns the value of prop duration_ms.
|
|
# File '' const :duration_ms, T.nilable(Float), default: nil |
#event ⇒ Event (readonly)
Returns the value of prop event.
|
|
# File '' const :event, Event, default: Event::Upload |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info |
#location ⇒ String (readonly)
Returns the value of prop location.
|
|
# File '' const :location, String |
#options ⇒ Hash{Symbol => T.untyped}? (readonly)
Returns the value of prop options.
|
|
# File '' const :options, T.nilable(T::Hash[Symbol, T.untyped]), default: nil |
#source ⇒ Source::Shrine (readonly)
Shared/common fields
|
|
# File '' const :source, Source::Shrine, default: Source::Shrine |
#storage ⇒ Symbol (readonly)
Event-specific fields
|
|
# File '' const :storage, Symbol |
#timestamp ⇒ Time (readonly)
Returns the value of prop timestamp.
|
|
# File '' const :timestamp, Time, factory: -> { Time.now } |
#upload_options ⇒ Hash{Symbol => T.untyped}? (readonly)
Returns the value of prop upload_options.
|
|
# File '' const :upload_options, T.nilable(T::Hash[Symbol, T.untyped]), default: nil |
#uploader ⇒ String? (readonly)
Returns the value of prop uploader.
|
|
# File '' const :uploader, T.nilable(String), default: nil |
Instance Method Details
#to_h ⇒ Hash{LogStruct::LogField => T.untyped}
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/log_struct/log/shrine/upload.rb', line 45 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::Storage] = storage h[LogField::Location] = location h[LogField::UploadOptions] = unless .nil? h[LogField::Options] = unless .nil? h[LogField::Uploader] = uploader unless uploader.nil? h[LogField::DurationMs] = duration_ms unless duration_ms.nil? h end |