Class: Clickwrap::Integrity::Anchor::Publication

Inherits:
Data
  • Object
show all
Defined in:
lib/clickwrap/integrity/anchor.rb

Overview

What an adapter returns from #publish. anchored: false is a normal outcome, not an error — a no-op adapter, a provider outage, or a queue that has not drained yet all mean "not anchored", and the honest record says so rather than leaving a caller to infer it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(anchored: false, reference: nil, published_at: nil, provider_name: nil, detail: nil) ⇒ Publication

Returns a new instance of Publication.



44
45
46
# File 'lib/clickwrap/integrity/anchor.rb', line 44

def initialize(anchored: false, reference: nil, published_at: nil, provider_name: nil, detail: nil)
  super
end

Instance Attribute Details

#anchoredObject (readonly)

Returns the value of attribute anchored

Returns:

  • (Object)

    the current value of anchored



43
44
45
# File 'lib/clickwrap/integrity/anchor.rb', line 43

def anchored
  @anchored
end

#detailObject (readonly)

Returns the value of attribute detail

Returns:

  • (Object)

    the current value of detail



43
44
45
# File 'lib/clickwrap/integrity/anchor.rb', line 43

def detail
  @detail
end

#provider_nameObject (readonly)

Returns the value of attribute provider_name

Returns:

  • (Object)

    the current value of provider_name



43
44
45
# File 'lib/clickwrap/integrity/anchor.rb', line 43

def provider_name
  @provider_name
end

#published_atObject (readonly)

Returns the value of attribute published_at

Returns:

  • (Object)

    the current value of published_at



43
44
45
# File 'lib/clickwrap/integrity/anchor.rb', line 43

def published_at
  @published_at
end

#referenceObject (readonly)

Returns the value of attribute reference

Returns:

  • (Object)

    the current value of reference



43
44
45
# File 'lib/clickwrap/integrity/anchor.rb', line 43

def reference
  @reference
end

Instance Method Details

#to_hObject



48
49
50
51
52
53
54
55
56
# File 'lib/clickwrap/integrity/anchor.rb', line 48

def to_h
  {
    "anchored" => anchored,
    "reference" => reference,
    "published_at" => published_at && Receipt.format_time(published_at),
    "provider_name" => provider_name,
    "detail" => detail
  }.compact
end