Class: ComplyanceSDK::Models::PolicyResult

Inherits:
Object
  • Object
show all
Defined in:
lib/complyance_sdk/models/policy_result.rb

Overview

Result of evaluating a logical document type policy Contains the base document type and meta configuration flags

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_type, meta_config_flags, document_type) ⇒ PolicyResult

Initialize a new policy result

Parameters:

  • base_type (Symbol)

    The base document type (from DocumentType)

  • meta_config_flags (Hash)

    The meta configuration flags

  • document_type (String)

    The document type string



17
18
19
20
21
# File 'lib/complyance_sdk/models/policy_result.rb', line 17

def initialize(base_type, meta_config_flags, document_type)
  @base_type = base_type
  @meta_config_flags = meta_config_flags || {}
  @document_type = document_type
end

Instance Attribute Details

#base_typeObject (readonly)

Returns the value of attribute base_type.



10
11
12
# File 'lib/complyance_sdk/models/policy_result.rb', line 10

def base_type
  @base_type
end

#document_typeObject (readonly)

Returns the value of attribute document_type.



10
11
12
# File 'lib/complyance_sdk/models/policy_result.rb', line 10

def document_type
  @document_type
end

#meta_config_flagsObject (readonly)

Returns the value of attribute meta_config_flags.



10
11
12
# File 'lib/complyance_sdk/models/policy_result.rb', line 10

def meta_config_flags
  @meta_config_flags
end

Instance Method Details

#==(other) ⇒ Boolean

Equality comparison

Parameters:

Returns:

  • (Boolean)

    True if equal



129
130
131
132
133
134
135
# File 'lib/complyance_sdk/models/policy_result.rb', line 129

def ==(other)
  return false unless other.is_a?(PolicyResult)
  
  @base_type == other.base_type &&
    @meta_config_flags == other.meta_config_flags &&
    @document_type == other.document_type
end

#adjusted?Boolean

Check if this is an adjusted type

Returns:

  • (Boolean)

    True if adjusted type



96
97
98
# File 'lib/complyance_sdk/models/policy_result.rb', line 96

def adjusted?
  @meta_config_flags[:isAdjusted] == true
end

#b2b?Boolean

Check if this is a B2B type

Returns:

  • (Boolean)

    True if B2B type



82
83
84
# File 'lib/complyance_sdk/models/policy_result.rb', line 82

def b2b?
  @meta_config_flags[:isB2B] == true
end

#base_document_typeSymbol

Get the base document type

Returns:

  • (Symbol)

    The base document type



26
27
28
# File 'lib/complyance_sdk/models/policy_result.rb', line 26

def base_document_type
  @base_type
end

#export?Boolean

Check if this is an export type

Returns:

  • (Boolean)

    True if export type



47
48
49
# File 'lib/complyance_sdk/models/policy_result.rb', line 47

def export?
  @meta_config_flags[:isExport] == true
end

#get_document_typeString

Get document type string

Returns:

  • (String)

    The document type string



40
41
42
# File 'lib/complyance_sdk/models/policy_result.rb', line 40

def get_document_type
  @document_type
end

#get_meta_config_flagsHash

Get meta configuration flags

Returns:

  • (Hash)

    The meta configuration flags



33
34
35
# File 'lib/complyance_sdk/models/policy_result.rb', line 33

def get_meta_config_flags
  @meta_config_flags.dup
end

#hashInteger

Hash code for equality

Returns:

  • (Integer)

    Hash code



140
141
142
# File 'lib/complyance_sdk/models/policy_result.rb', line 140

def hash
  [@base_type, @meta_config_flags, @document_type].hash
end

#nominal_supply?Boolean

Check if this is a nominal supply type

Returns:

  • (Boolean)

    True if nominal supply type



68
69
70
# File 'lib/complyance_sdk/models/policy_result.rb', line 68

def nominal_supply?
  @meta_config_flags[:isNominal] == true
end

#prepayment?Boolean

Check if this is a prepayment type

Returns:

  • (Boolean)

    True if prepayment type



89
90
91
# File 'lib/complyance_sdk/models/policy_result.rb', line 89

def prepayment?
  @meta_config_flags[:isPrepayment] == true
end

#receipt?Boolean

Check if this is a receipt type

Returns:

  • (Boolean)

    True if receipt type



103
104
105
# File 'lib/complyance_sdk/models/policy_result.rb', line 103

def receipt?
  @meta_config_flags[:isReceipt] == true
end

#self_billed?Boolean

Check if this is a self-billed type

Returns:

  • (Boolean)

    True if self-billed type



54
55
56
# File 'lib/complyance_sdk/models/policy_result.rb', line 54

def self_billed?
  @meta_config_flags[:isSelfBilled] == true
end

#summary?Boolean

Check if this is a summary type

Returns:

  • (Boolean)

    True if summary type



75
76
77
# File 'lib/complyance_sdk/models/policy_result.rb', line 75

def summary?
  @meta_config_flags[:isSummary] == true
end

#third_party?Boolean

Check if this is a third party type

Returns:

  • (Boolean)

    True if third party type



61
62
63
# File 'lib/complyance_sdk/models/policy_result.rb', line 61

def third_party?
  @meta_config_flags[:isThirdParty] == true
end

#to_hHash

Convert to hash representation

Returns:

  • (Hash)

    Hash representation of the policy result



110
111
112
113
114
115
116
# File 'lib/complyance_sdk/models/policy_result.rb', line 110

def to_h
  {
    base_type: @base_type,
    meta_config_flags: @meta_config_flags,
    document_type: @document_type
  }
end

#to_sString

String representation

Returns:

  • (String)

    String representation



121
122
123
# File 'lib/complyance_sdk/models/policy_result.rb', line 121

def to_s
  "PolicyResult{base_type=#{@base_type}, document_type=#{@document_type}, flags=#{@meta_config_flags}}"
end