Class: Passkit::Generator

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

Constant Summary collapse

TMP_FOLDER =
Rails.root.join("tmp/passkit").freeze

Instance Method Summary collapse

Constructor Details

#initialize(pass) ⇒ Generator

Returns a new instance of Generator.



7
8
9
10
# File 'lib/passkit/generator.rb', line 7

def initialize(pass)
  @pass = pass
  @generator = pass.generator
end

Instance Method Details

#generate_and_signObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/passkit/generator.rb', line 12

def generate_and_sign
  check_necessary_files
  create_temporary_directory
  copy_pass_to_tmp_location
  @pass.instance.add_other_files(@temporary_path)
  clean_ds_store_files
  I18n.with_locale(@pass.language) do
    generate_json_pass
  end
  generate_json_manifest
  sign_manifest
  compress_pass_file
end