Class: Passifier::Pass
- Inherits:
-
Object
- Object
- Passifier::Pass
- Defined in:
- lib/passifier/pass.rb
Instance Attribute Summary collapse
-
#archive ⇒ Object
readonly
Returns the value of attribute archive.
-
#asset_files ⇒ Object
readonly
Returns the value of attribute asset_files.
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
-
#serial_number ⇒ Object
readonly
Returns the value of attribute serial_number.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Class Method Summary collapse
-
.create_archive(path, serial_number, spec_hash, assets, signing, options = {}) ⇒ Archive
Create a Pass and corresponding Archive file.
-
.to_apple_datetime(time_with_zone) ⇒ String
Convert a Time object to Apple’s preferred String time format.
Instance Method Summary collapse
-
#create_archive(path, options = {}) ⇒ Archive
Create the Archive file for this Pass.
-
#files_for_archive ⇒ Array<Spec, Manifest, ManifestSignature, StaticFile, UrlSource>
File objects that should be included in the archive.
-
#generate ⇒ Archive
Create the Archive file for this Pass.
-
#initialize(serial_number, spec_hash, assets, signing, options = {}) ⇒ Pass
constructor
A new instance of Pass.
-
#save ⇒ Archive
Create the Archive file for this Pass.
Constructor Details
#initialize(serial_number, spec_hash, assets, signing, options = {}) ⇒ Pass
Returns a new instance of Pass.
20 21 22 23 24 25 26 |
# File 'lib/passifier/pass.rb', line 20 def initialize(serial_number, spec_hash, assets, signing, = {}) @signing = signing @spec = Spec.new(serial_number, spec_hash) @asset_files = to_asset_files(assets) @manifest = Manifest.new(@asset_files, signing) @signature = ManifestSignature.new(@manifest, signing) end |
Instance Attribute Details
#archive ⇒ Object (readonly)
Returns the value of attribute archive.
7 8 9 |
# File 'lib/passifier/pass.rb', line 7 def archive @archive end |
#asset_files ⇒ Object (readonly)
Returns the value of attribute asset_files.
7 8 9 |
# File 'lib/passifier/pass.rb', line 7 def asset_files @asset_files end |
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
7 8 9 |
# File 'lib/passifier/pass.rb', line 7 def manifest @manifest end |
#serial_number ⇒ Object (readonly)
Returns the value of attribute serial_number.
7 8 9 |
# File 'lib/passifier/pass.rb', line 7 def serial_number @serial_number end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
7 8 9 |
# File 'lib/passifier/pass.rb', line 7 def signature @signature end |
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
7 8 9 |
# File 'lib/passifier/pass.rb', line 7 def spec @spec end |
Class Method Details
.create_archive(path, serial_number, spec_hash, assets, signing, options = {}) ⇒ Archive
Create a Pass and corresponding Archive file
62 63 64 65 |
# File 'lib/passifier/pass.rb', line 62 def self.create_archive(path, serial_number, spec_hash, assets, signing, = {}) pass = new(serial_number, spec_hash, assets, signing, ) pass.create_archive(path, ) end |
.to_apple_datetime(time_with_zone) ⇒ String
Convert a Time object to Apple’s preferred String time format
49 50 51 |
# File 'lib/passifier/pass.rb', line 49 def self.to_apple_datetime(time_with_zone) time_with_zone.strftime("%Y-%m-%dT%H:%M%:z") end |
Instance Method Details
#create_archive(path, options = {}) ⇒ Archive
Create the Archive file for this Pass
38 39 40 41 42 |
# File 'lib/passifier/pass.rb', line 38 def create_archive(path, = {}) @archive = Archive.new(path, @spec.serial_number, files_for_archive) @archive.store() @archive end |
#files_for_archive ⇒ Array<Spec, Manifest, ManifestSignature, StaticFile, UrlSource>
File objects that should be included in the archive
31 32 33 |
# File 'lib/passifier/pass.rb', line 31 def files_for_archive [@spec, @manifest, @signature, @asset_files].flatten.compact end |