Class: Prdigest::Facts
- Inherits:
-
Object
- Object
- Prdigest::Facts
- Defined in:
- lib/prdigest/facts.rb
Constant Summary collapse
- SCHEMA =
"prdigest-facts"- SCHEMA_VERSION =
1
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(digest:, timezone:) ⇒ Facts
constructor
A new instance of Facts.
- #to_h ⇒ Object
Constructor Details
#initialize(digest:, timezone:) ⇒ Facts
Returns a new instance of Facts.
10 11 12 13 |
# File 'lib/prdigest/facts.rb', line 10 def initialize(digest:, timezone:) @digest = digest @timezone = timezone.to_s.freeze end |
Class Method Details
.failure(error_kind:, message:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/prdigest/facts.rb', line 15 def self.failure(error_kind:, message:) { schema: SCHEMA, schema_version: SCHEMA_VERSION, status: "failure", error: { kind: error_kind.to_s, message: .to_s }, digest: nil } end |
Instance Method Details
#to_h ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/prdigest/facts.rb', line 28 def to_h { schema: SCHEMA, schema_version: SCHEMA_VERSION, status: "success", error: nil, digest: serialize_digest } end |