Module: CoronaPresenceTracing::Base

Included in:
CWACheckIn
Defined in:
lib/corona_presence_tracing/base.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



11
12
13
# File 'lib/corona_presence_tracing/base.rb', line 11

def address
  @address
end

#descriptionObject (readonly)

Returns the value of attribute description.



11
12
13
# File 'lib/corona_presence_tracing/base.rb', line 11

def description
  @description
end

#end_timeObject (readonly)

Returns the value of attribute end_time.



11
12
13
# File 'lib/corona_presence_tracing/base.rb', line 11

def end_time
  @end_time
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



11
12
13
# File 'lib/corona_presence_tracing/base.rb', line 11

def start_time
  @start_time
end

Class Method Details

.included(base) ⇒ Object



13
14
15
# File 'lib/corona_presence_tracing/base.rb', line 13

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#encoded_payloadObject



49
50
51
# File 'lib/corona_presence_tracing/base.rb', line 49

def encoded_payload
  @encoded_payload ||= Base64.urlsafe_encode64(QRCodePayload.encode(@qr_payload))
end

#initialize(options = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/corona_presence_tracing/base.rb', line 39

def initialize(options = {})
  @description = options[:description]
  @address = options[:address]
  @start_time = options[:start_time]
  @end_time = options[:end_time]

  validate
  build_payload
end

#urlObject



53
54
55
# File 'lib/corona_presence_tracing/base.rb', line 53

def url
  [self.class::BASE_URL, encoded_payload].join('#')
end