Class: Passkit::PayloadGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/passkit/payload_generator.rb

Constant Summary collapse

VALIDITY =
30.days

Class Method Summary collapse

Class Method Details

.encrypted(pass_class, generator = nil) ⇒ Object



5
6
7
# File 'lib/passkit/payload_generator.rb', line 5

def self.encrypted(pass_class, generator = nil)
  UrlEncrypt.encrypt(hash(pass_class, generator))
end

.hash(pass_class, generator = nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/passkit/payload_generator.rb', line 9

def self.hash(pass_class, generator = nil)
  valid_until = VALIDITY.from_now

  {valid_until: valid_until,
   generator_class: generator&.class&.name,
   generator_id: generator&.id,
   pass_class: pass_class.name}
end