Class: Kentaa::Api::Resources::Consent

Inherits:
Object
  • Object
show all
Defined in:
lib/kentaa/api/resources/consent.rb

Constant Summary collapse

STATUS_GRANTED =
'granted'
STATUS_REVOKED =
'revoked'
TYPE_TERMS_CONDITIONS =
'terms_conditions'
TYPE_PROCESSING_PERSONAL_DATA =
'processing_personal_data'
TYPE_PROCESSING_PERSONAL_SENSITIVE_DATA =
'processing_personal_sensitive_data'
TYPE_NEWSLETTER_SUBSCRIPTION =
'newsletter_subscription'
TYPE_NEWS_ITEM_SUBSCRIPTION =
'news_item_subscription'
TYPE_CONTACT_PHONE =
'contact_phone'
TYPE_CONTACT_PHONE_COMMERCIAL =
'contact_phone_commercial'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Consent

Returns a new instance of Consent.



22
23
24
# File 'lib/kentaa/api/resources/consent.rb', line 22

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



20
21
22
# File 'lib/kentaa/api/resources/consent.rb', line 20

def data
  @data
end

Instance Method Details



58
59
60
# File 'lib/kentaa/api/resources/consent.rb', line 58

def consent_status
  data[:consent_status]
end


78
79
80
# File 'lib/kentaa/api/resources/consent.rb', line 78

def consent_text
  data[:consent_text]
end


26
27
28
# File 'lib/kentaa/api/resources/consent.rb', line 26

def consent_type
  data[:consent_type]
end

#contact_phone?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/kentaa/api/resources/consent.rb', line 50

def contact_phone?
  consent_type == TYPE_CONTACT_PHONE
end

#contact_phone_commercial?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/kentaa/api/resources/consent.rb', line 54

def contact_phone_commercial?
  consent_type == TYPE_CONTACT_PHONE_COMMERCIAL
end

#granted?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/kentaa/api/resources/consent.rb', line 62

def granted?
  consent_status == STATUS_GRANTED
end

#granted_atObject



70
71
72
# File 'lib/kentaa/api/resources/consent.rb', line 70

def granted_at
  Time.parse(data[:granted_at])
end

#news_item_subscription?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/kentaa/api/resources/consent.rb', line 46

def news_item_subscription?
  consent_type == TYPE_NEWS_ITEM_SUBSCRIPTION
end

#newsletter_subscription?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/kentaa/api/resources/consent.rb', line 42

def newsletter_subscription?
  consent_type == TYPE_NEWSLETTER_SUBSCRIPTION
end

#privacy_versionObject



98
99
100
# File 'lib/kentaa/api/resources/consent.rb', line 98

def privacy_version
  data[:privacy_version]
end

#processing_personal_data?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/kentaa/api/resources/consent.rb', line 34

def processing_personal_data?
  consent_type == TYPE_PROCESSING_PERSONAL_DATA
end

#processing_personal_sensitive_data?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/kentaa/api/resources/consent.rb', line 38

def processing_personal_sensitive_data?
  consent_type == TYPE_PROCESSING_PERSONAL_SENSITIVE_DATA
end

#revoked?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/kentaa/api/resources/consent.rb', line 66

def revoked?
  consent_status == STATUS_REVOKED
end

#revoked_atObject



74
75
76
# File 'lib/kentaa/api/resources/consent.rb', line 74

def revoked_at
  Time.parse(data[:revoked_at]) if data[:revoked_at]
end

#terms_conditions?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/kentaa/api/resources/consent.rb', line 30

def terms_conditions?
  consent_type == TYPE_TERMS_CONDITIONS
end

#terms_conditions_versionObject



94
95
96
# File 'lib/kentaa/api/resources/consent.rb', line 94

def terms_conditions_version
  data[:terms_conditions_version]
end

#textObject



82
83
84
# File 'lib/kentaa/api/resources/consent.rb', line 82

def text
  data[:text] || data[:consent_text]
end

#urlObject



86
87
88
# File 'lib/kentaa/api/resources/consent.rb', line 86

def url
  data[:url]
end

#versionObject



90
91
92
# File 'lib/kentaa/api/resources/consent.rb', line 90

def version
  data[:version] || data[:terms_conditions_version]
end