Class: Igniter::Lang::ReceiptPayload

Inherits:
Object
  • Object
show all
Defined in:
lib/igniter/lang/receipt_payload.rb

Constant Summary collapse

SEMANTICS =
{
  report_only: true,
  runtime_enforced: false,
  execution_authorized: false,
  operation_execution_authorized: false,
  external_bridge_authorized: false,
  provider_call_authorized: false,
  real_data_export_authorized: false,
  ledger_core: false
}.freeze
DEFAULT_REDACTION_POLICY =
{
  raw_ref_export: false,
  hash_source_refs: true,
  redacted_ref_kinds: []
}.freeze
RAW_REF_KEYS =
%i[raw_ref raw_refs raw_source_ref raw_source_refs].freeze
RAW_REF_PREFIX =
"raw:"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(receipt_id:, profile:, payload: {}, evidence_links: {}, redaction_policy: {}, metadata: {}) ⇒ ReceiptPayload

Returns a new instance of ReceiptPayload.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/igniter/lang/receipt_payload.rb', line 33

def initialize(
  receipt_id:,
  profile:,
  payload: {},
  evidence_links: {},
  redaction_policy: {},
  metadata: {}
)
  @receipt_id = require_value(:receipt_id, receipt_id)
  @profile = require_value(:profile, profile)
  @payload = deep_freeze(normalize_hash(payload, :payload))
  @evidence_links = deep_freeze(normalize_hash(evidence_links, :evidence_links))
  @redaction_policy = deep_freeze(normalize_redaction_policy(redaction_policy))
  @metadata = deep_freeze(normalize_hash(, :metadata))
  reject_raw_refs!
  freeze
end

Instance Attribute Details

Returns the value of attribute evidence_links.



26
27
28
# File 'lib/igniter/lang/receipt_payload.rb', line 26

def evidence_links
  @evidence_links
end

#metadataObject (readonly)

Returns the value of attribute metadata.



26
27
28
# File 'lib/igniter/lang/receipt_payload.rb', line 26

def 
  @metadata
end

#payloadObject (readonly)

Returns the value of attribute payload.



26
27
28
# File 'lib/igniter/lang/receipt_payload.rb', line 26

def payload
  @payload
end

#profileObject (readonly)

Returns the value of attribute profile.



26
27
28
# File 'lib/igniter/lang/receipt_payload.rb', line 26

def profile
  @profile
end

#receipt_idObject (readonly)

Returns the value of attribute receipt_id.



26
27
28
# File 'lib/igniter/lang/receipt_payload.rb', line 26

def receipt_id
  @receipt_id
end

#redaction_policyObject (readonly)

Returns the value of attribute redaction_policy.



26
27
28
# File 'lib/igniter/lang/receipt_payload.rb', line 26

def redaction_policy
  @redaction_policy
end

Instance Method Details

#report_only?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/igniter/lang/receipt_payload.rb', line 51

def report_only?
  true
end

#runtime_enforced?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/igniter/lang/receipt_payload.rb', line 55

def runtime_enforced?
  false
end

#to_hObject



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/igniter/lang/receipt_payload.rb', line 59

def to_h
  {
    receipt_id: receipt_id,
    profile: profile,
    payload: payload,
    evidence_links: evidence_links,
    redaction_policy: redaction_policy,
    semantics: SEMANTICS,
    metadata: 
  }
end