Class: Passbook::PKPass

Inherits:
Object
  • Object
show all
Defined in:
lib/passbook/pk_pass.rb

Instance Method Summary collapse

Constructor Details

#initialize(specs, assets, authority) ⇒ PKPass

Returns a new instance of PKPass.



9
10
11
12
13
14
# File 'lib/passbook/pk_pass.rb', line 9

def initialize(specs, assets, authority)
  @pass      = Pass.new(specs)
  @assets    = Assets.new(assets)
  @manifest  = Manifest.new(@pass, @assets)
  @signature = Signature.new(@manifest, authority)
end

Instance Method Details

#content_typeObject



16
17
18
# File 'lib/passbook/pk_pass.rb', line 16

def content_type
  "application/vnd.apple.pkpass"
end

#to_file(path) ⇒ Object



24
25
26
# File 'lib/passbook/pk_pass.rb', line 24

def to_file(path)
  File.write(path, to_s)
end

#to_sObject



20
21
22
# File 'lib/passbook/pk_pass.rb', line 20

def to_s
  Archive.zip(@pass, @assets, @manifest, @signature).string
end