Class: Clickwrap::Integrity::Timestamp::Token

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

Overview

What an adapter returns from #timestamp. issued: false is an ordinary outcome — no provider configured, provider unavailable, request declined — and the record says which rather than leaving a gap where a token should be.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issued: false, token: nil, digest: nil, provider_name: nil, protocol: nil, issued_at: nil, detail: nil) ⇒ Token

Returns a new instance of Token.



49
50
51
52
# File 'lib/clickwrap/integrity/timestamp.rb', line 49

def initialize(issued: false, token: nil, digest: nil, provider_name: nil, protocol: nil,
               issued_at: nil, detail: nil)
  super
end

Instance Attribute Details

#detailObject (readonly)

Returns the value of attribute detail

Returns:

  • (Object)

    the current value of detail



48
49
50
# File 'lib/clickwrap/integrity/timestamp.rb', line 48

def detail
  @detail
end

#digestObject (readonly)

Returns the value of attribute digest

Returns:

  • (Object)

    the current value of digest



48
49
50
# File 'lib/clickwrap/integrity/timestamp.rb', line 48

def digest
  @digest
end

#issuedObject (readonly)

Returns the value of attribute issued

Returns:

  • (Object)

    the current value of issued



48
49
50
# File 'lib/clickwrap/integrity/timestamp.rb', line 48

def issued
  @issued
end

#issued_atObject (readonly)

Returns the value of attribute issued_at

Returns:

  • (Object)

    the current value of issued_at



48
49
50
# File 'lib/clickwrap/integrity/timestamp.rb', line 48

def issued_at
  @issued_at
end

#protocolObject (readonly)

Returns the value of attribute protocol

Returns:

  • (Object)

    the current value of protocol



48
49
50
# File 'lib/clickwrap/integrity/timestamp.rb', line 48

def protocol
  @protocol
end

#provider_nameObject (readonly)

Returns the value of attribute provider_name

Returns:

  • (Object)

    the current value of provider_name



48
49
50
# File 'lib/clickwrap/integrity/timestamp.rb', line 48

def provider_name
  @provider_name
end

#tokenObject (readonly)

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token



48
49
50
# File 'lib/clickwrap/integrity/timestamp.rb', line 48

def token
  @token
end

Instance Method Details

#to_hObject



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/clickwrap/integrity/timestamp.rb', line 54

def to_h
  {
    "issued" => issued,
    "token" => token,
    "digest" => digest,
    "provider_name" => provider_name,
    "protocol" => protocol,
    # The provider's own time, described as the provider's own time.
    "provider_reported_time" => issued_at && Receipt.format_time(issued_at),
    "detail" => detail
  }.compact
end