dubai 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +65 -0
- data/Rakefile +2 -0
- data/dubai.gemspec +23 -22
- data/lib/dubai.rb +2 -0
- data/lib/dubai/commands.rb +3 -1
- data/lib/dubai/commands/build.rb +12 -9
- data/lib/dubai/commands/generate.rb +8 -6
- data/lib/dubai/commands/serve.rb +10 -7
- data/lib/dubai/pass.rb +36 -34
- data/lib/dubai/server.rb +3 -1
- data/lib/dubai/templates/boarding-pass.json +54 -54
- data/lib/dubai/templates/coupon.json +25 -31
- data/lib/dubai/templates/event-ticket.json +25 -31
- data/lib/dubai/templates/generic.json +25 -31
- data/lib/dubai/templates/store-card.json +25 -31
- data/lib/dubai/version.rb +3 -1
- data/spec/server_spec.rb +2 -0
- data/spec/spec_helper.rb +3 -1
- metadata +27 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43d49980ee92e90d8d9ee6bb7d11eed359aea9b9
|
4
|
+
data.tar.gz: 77bbff4dd70a002eb247d99f38e2e809d3efa6f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf34869df8e436cae3e3e275c999250f64086d76543d3718047da7814c6dde6e34b475f78a02fa00b51808e01c1afd5734a71a65e3dc50cdf70146fc77556aeb
|
7
|
+
data.tar.gz: 6a993da4ebb9478285ba168371384033dcee985979df83071af57576d3edb17916e18e799c4058a9dd36a9b3dd53c6e5ae1ea86b69b12f9de6c56227745c6255
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dubai (0.2.0)
|
5
|
+
commander (~> 4.1)
|
6
|
+
json
|
7
|
+
rubyzip (~> 1.0)
|
8
|
+
sinatra (>= 1.3, < 2.0.0)
|
9
|
+
terminal-table (~> 1.4)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
commander (4.4.7)
|
15
|
+
highline (~> 2.0.0)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
docile (1.3.2)
|
18
|
+
highline (2.0.2)
|
19
|
+
json (2.2.0)
|
20
|
+
rack (1.6.11)
|
21
|
+
rack-protection (1.5.5)
|
22
|
+
rack
|
23
|
+
rack-test (1.1.0)
|
24
|
+
rack (>= 1.0, < 3)
|
25
|
+
rake (12.3.2)
|
26
|
+
rspec (3.8.0)
|
27
|
+
rspec-core (~> 3.8.0)
|
28
|
+
rspec-expectations (~> 3.8.0)
|
29
|
+
rspec-mocks (~> 3.8.0)
|
30
|
+
rspec-core (3.8.2)
|
31
|
+
rspec-support (~> 3.8.0)
|
32
|
+
rspec-expectations (3.8.4)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.8.0)
|
35
|
+
rspec-mocks (3.8.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.8.0)
|
38
|
+
rspec-support (3.8.2)
|
39
|
+
rubyzip (1.2.3)
|
40
|
+
simplecov (0.17.0)
|
41
|
+
docile (~> 1.1)
|
42
|
+
json (>= 1.8, < 3)
|
43
|
+
simplecov-html (~> 0.10.0)
|
44
|
+
simplecov-html (0.10.2)
|
45
|
+
sinatra (1.4.8)
|
46
|
+
rack (~> 1.5)
|
47
|
+
rack-protection (~> 1.4)
|
48
|
+
tilt (>= 1.3, < 3)
|
49
|
+
terminal-table (1.8.0)
|
50
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
51
|
+
tilt (2.0.9)
|
52
|
+
unicode-display_width (1.6.0)
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
ruby
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
dubai!
|
59
|
+
rack-test
|
60
|
+
rake
|
61
|
+
rspec
|
62
|
+
simplecov
|
63
|
+
|
64
|
+
BUNDLED WITH
|
65
|
+
2.0.1
|
data/Rakefile
CHANGED
data/dubai.gemspec
CHANGED
@@ -1,32 +1,33 @@
|
|
1
|
-
#
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
|
5
|
+
require 'dubai/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.authors = [
|
9
|
-
s.email =
|
10
|
-
s.license =
|
11
|
-
s.homepage =
|
8
|
+
s.name = 'dubai'
|
9
|
+
s.authors = ['Mattt']
|
10
|
+
s.email = 'mattt@me.com'
|
11
|
+
s.license = 'MIT'
|
12
|
+
s.homepage = 'http://nomad-cli.com'
|
12
13
|
s.version = Dubai::VERSION
|
13
14
|
s.platform = Gem::Platform::RUBY
|
14
|
-
s.summary =
|
15
|
-
s.description =
|
15
|
+
s.summary = 'Dubai'
|
16
|
+
s.description = 'Passbook pass generation and preview.'
|
16
17
|
|
17
|
-
s.add_dependency
|
18
|
-
s.add_dependency
|
19
|
-
s.add_dependency
|
20
|
-
s.add_dependency
|
21
|
-
s.add_dependency
|
18
|
+
s.add_dependency 'commander', '~> 4.1'
|
19
|
+
s.add_dependency 'json'
|
20
|
+
s.add_dependency 'rubyzip', '~> 1.0'
|
21
|
+
s.add_dependency 'sinatra', ['>= 1.3', '< 2.0.0']
|
22
|
+
s.add_dependency 'terminal-table', '~> 1.4'
|
22
23
|
|
23
|
-
s.add_development_dependency
|
24
|
-
s.add_development_dependency
|
25
|
-
s.add_development_dependency
|
26
|
-
s.add_development_dependency
|
24
|
+
s.add_development_dependency 'rack-test'
|
25
|
+
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'rspec'
|
27
|
+
s.add_development_dependency 'simplecov'
|
27
28
|
|
28
|
-
s.files = Dir[
|
29
|
+
s.files = Dir['./**/*'].reject { |file| file =~ %r{\./(bin|log|pkg|script|spec|test|vendor)} }
|
29
30
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
31
|
-
s.require_paths = [
|
31
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
32
|
+
s.require_paths = ['lib']
|
32
33
|
end
|
data/lib/dubai.rb
CHANGED
data/lib/dubai/commands.rb
CHANGED
data/lib/dubai/commands/build.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
command :build do |c|
|
2
4
|
c.syntax = 'pk build [PASSNAME]'
|
3
5
|
c.summary = 'Creates a .pkpass archive'
|
@@ -18,20 +20,21 @@ command :build do |c|
|
|
18
20
|
@certificate = options.certificate
|
19
21
|
validate_certificate!
|
20
22
|
|
21
|
-
@password = ask(
|
23
|
+
@password = ask('Enter certificate password:') { |q| q.echo = false } if options.password
|
22
24
|
|
23
|
-
Dubai::Passbook.certificate
|
25
|
+
Dubai::Passbook.certificate = @certificate
|
26
|
+
Dubai::Passbook.password = @password
|
24
27
|
|
25
28
|
begin
|
26
29
|
File.open(@filepath, 'w') do |f|
|
27
30
|
f.write Dubai::Passbook::Pass.new(@directory).pkpass.string
|
28
31
|
end
|
29
|
-
rescue OpenSSL::PKCS12::PKCS12Error =>
|
30
|
-
say_error "Error: #{
|
31
|
-
say_warning
|
32
|
+
rescue OpenSSL::PKCS12::PKCS12Error => e
|
33
|
+
say_error "Error: #{e.message}"
|
34
|
+
say_warning 'You may be getting this error because the certificate password is either incorrect or missing'
|
32
35
|
abort
|
33
|
-
rescue =>
|
34
|
-
say_error
|
36
|
+
rescue StandardError => e
|
37
|
+
say_error("Error: #{e.message}") && abort
|
35
38
|
end
|
36
39
|
end
|
37
40
|
end
|
@@ -42,6 +45,6 @@ alias_command :b, :build
|
|
42
45
|
private
|
43
46
|
|
44
47
|
def validate_output_filepath!
|
45
|
-
say_error
|
46
|
-
say_error
|
48
|
+
say_error('Filepath required') && abort if @filepath.nil? || @filepath.empty?
|
49
|
+
say_error("#{@filepath} already exists") && abort if File.exist?(@filepath)
|
47
50
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fileutils'
|
2
4
|
|
3
5
|
command :generate do |c|
|
@@ -10,11 +12,11 @@ command :generate do |c|
|
|
10
12
|
|
11
13
|
c.action do |args, options|
|
12
14
|
@directory = args.first
|
13
|
-
@directory ||= ask
|
15
|
+
@directory ||= ask 'Enter a passbook name: '
|
14
16
|
|
15
|
-
say_error
|
16
|
-
say_error
|
17
|
-
say_error
|
17
|
+
say_error('Missing pass name') && abort if @directory.nil? || @directory.empty?
|
18
|
+
say_error("Directory #{@directory} already exists") && abort if File.directory?(@directory)
|
19
|
+
say_error("File exists at #{@directory}") && abort if File.exist?(@directory)
|
18
20
|
|
19
21
|
@type = options.type
|
20
22
|
determine_type! unless @type
|
@@ -36,9 +38,9 @@ alias_command :g, :generate
|
|
36
38
|
private
|
37
39
|
|
38
40
|
def determine_type!
|
39
|
-
@type ||= choose
|
41
|
+
@type ||= choose 'Select a pass type', *Dubai::Passbook::Pass::TYPES
|
40
42
|
end
|
41
43
|
|
42
44
|
def validate_type!
|
43
|
-
say_error %
|
45
|
+
say_error %(Invalid type: "#{@type}", expected one of: [#{Dubai::Passbook::Pass::TYPES.join(', ')}]) unless Dubai::Passbook::Pass::TYPES.include?(@type)
|
44
46
|
end
|
data/lib/dubai/commands/serve.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
command :serve do |c|
|
2
4
|
c.syntax = 'pk serve [PASSNAME]'
|
3
5
|
c.summary = 'Serves a .pkpass archive from a webserver'
|
@@ -15,9 +17,10 @@ command :serve do |c|
|
|
15
17
|
@certificate = options.certificate
|
16
18
|
validate_certificate!
|
17
19
|
|
18
|
-
@password = ask(
|
20
|
+
@password = ask('Enter certificate password:') { |q| q.echo = false } if options.password
|
19
21
|
|
20
|
-
Dubai::Passbook.certificate
|
22
|
+
Dubai::Passbook.certificate = @certificate
|
23
|
+
Dubai::Passbook.password = @password
|
21
24
|
|
22
25
|
Dubai::Server.set :directory, @directory
|
23
26
|
|
@@ -38,16 +41,16 @@ def determine_directory!
|
|
38
41
|
when 0 then nil
|
39
42
|
when 1 then File.dirname(files.first)
|
40
43
|
else
|
41
|
-
@directory = choose
|
44
|
+
@directory = choose 'Select a directory:', *files.collect { |f| File.dirname(f) }
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
45
48
|
def validate_directory!
|
46
|
-
say_error
|
47
|
-
say_error
|
48
|
-
say_error
|
49
|
+
say_error('Missing argument') && abort if @directory.nil?
|
50
|
+
say_error("Directory #{@directory} does not exist") && abort unless File.directory?(@directory)
|
51
|
+
say_error("Directory #{@directory} is not valid pass") && abort unless File.exist?(File.join(@directory, 'pass.json'))
|
49
52
|
end
|
50
53
|
|
51
54
|
def validate_certificate!
|
52
|
-
say_error
|
55
|
+
say_error('Missing or invalid certificate file') && abort if @certificate.nil? || !File.exist?(@certificate)
|
53
56
|
end
|
data/lib/dubai/pass.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'digest/sha1'
|
2
4
|
require 'openssl'
|
3
5
|
require 'base64'
|
@@ -6,32 +8,32 @@ require 'zip'
|
|
6
8
|
|
7
9
|
module Dubai
|
8
10
|
module Passbook
|
9
|
-
WWDR_CERTIFICATE =
|
10
|
-
-----BEGIN CERTIFICATE-----
|
11
|
-
MIIEIjCCAwqgAwIBAgIIAd68xDltoBAwDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UE
|
12
|
-
BhMCVVMxEzARBgN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GpZnMBxRpVzscYqC
|
35
|
+
tGwPDBUf
|
36
|
+
-----END CERTIFICATE-----
|
35
37
|
EOF
|
36
38
|
|
37
39
|
class << self
|
@@ -41,11 +43,11 @@ tGwPDBUf
|
|
41
43
|
class Pass
|
42
44
|
attr_reader :pass, :assets
|
43
45
|
|
44
|
-
TYPES = ['boarding-pass', 'coupon', 'event-ticket', 'store-card', 'generic']
|
46
|
+
TYPES = ['boarding-pass', 'coupon', 'event-ticket', 'store-card', 'generic'].freeze
|
45
47
|
|
46
48
|
def initialize(directory)
|
47
49
|
@assets = Dir[File.join(directory, '*')]
|
48
|
-
@pass = File.read(@assets.delete(@assets.detect{|file| File.basename(file) == 'pass.json'}))
|
50
|
+
@pass = File.read(@assets.delete(@assets.detect { |file| File.basename(file) == 'pass.json' }))
|
49
51
|
end
|
50
52
|
|
51
53
|
def manifest
|
@@ -53,7 +55,7 @@ tGwPDBUf
|
|
53
55
|
checksums['pass.json'] = Digest::SHA1.hexdigest(@pass)
|
54
56
|
|
55
57
|
@assets.each do |file|
|
56
|
-
checksums[File.basename(file)] = Digest::SHA1.file(file).hexdigest
|
58
|
+
checksums[File.basename(file)] = Digest::SHA1.file(file).hexdigest
|
57
59
|
end
|
58
60
|
|
59
61
|
checksums.to_json
|
@@ -61,12 +63,12 @@ tGwPDBUf
|
|
61
63
|
|
62
64
|
def pkpass
|
63
65
|
Zip::OutputStream.write_buffer do |zip|
|
64
|
-
zip.put_next_entry
|
65
|
-
zip.put_next_entry
|
66
|
-
zip.put_next_entry
|
66
|
+
zip.put_next_entry('pass.json') && zip.write(@pass)
|
67
|
+
zip.put_next_entry('manifest.json') && zip.write(manifest)
|
68
|
+
zip.put_next_entry('signature') && zip.write(signature(manifest))
|
67
69
|
|
68
70
|
@assets.each do |file|
|
69
|
-
zip.put_next_entry
|
71
|
+
zip.put_next_entry(File.basename(file)) && zip.print(IO.read(file))
|
70
72
|
end
|
71
73
|
end
|
72
74
|
end
|
@@ -77,7 +79,7 @@ tGwPDBUf
|
|
77
79
|
pk7 = OpenSSL::PKCS7.sign(p12.certificate, p12.key, manifest, [wwdr], OpenSSL::PKCS7::BINARY | OpenSSL::PKCS7::DETACHED)
|
78
80
|
data = OpenSSL::PKCS7.write_smime(pk7)
|
79
81
|
|
80
|
-
start = %
|
82
|
+
start = %(filename=\"smime.p7s"\n\n)
|
81
83
|
finish = "\n\n------"
|
82
84
|
data = data[(data.index(start) + start.length)...(data.rindex(finish) + finish.length)]
|
83
85
|
|
data/lib/dubai/server.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'sinatra/base'
|
2
4
|
|
3
5
|
module Dubai
|
4
6
|
class Server < Sinatra::Base
|
5
7
|
get '/pass.pkpass' do
|
6
8
|
content_type 'application/vnd.apple.pkpass'
|
7
|
-
attachment
|
9
|
+
attachment 'pass.pkpass'
|
8
10
|
|
9
11
|
Passbook::Pass.new(settings.directory).pkpass.string
|
10
12
|
end
|
@@ -1,56 +1,56 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
2
|
+
"formatVersion": 1,
|
3
|
+
"passTypeIdentifier": "pass.com.example.boarding-pass",
|
4
|
+
"description": "Example Boarding Pass",
|
5
|
+
"teamIdentifier": "Example",
|
6
|
+
"organizationName": "Example",
|
7
|
+
"serialNumber": "123456",
|
8
|
+
"foregroundColor": "#866B23",
|
9
|
+
"backgroundColor": "#FFD248",
|
10
|
+
"boardingPass": {
|
11
|
+
"primaryFields": [
|
12
|
+
{
|
13
|
+
"key": "origin",
|
14
|
+
"label": "San Francisco",
|
15
|
+
"value": "SFO"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"key": "destination",
|
19
|
+
"label": "London",
|
20
|
+
"value": "LHR"
|
21
|
+
}
|
22
|
+
],
|
23
|
+
"secondaryFields": [
|
24
|
+
{
|
25
|
+
"key": "boarding-gate",
|
26
|
+
"label": "Gate",
|
27
|
+
"value": "F12"
|
28
|
+
}
|
29
|
+
],
|
30
|
+
"auxiliaryFields": [
|
31
|
+
{
|
32
|
+
"key": "seat",
|
33
|
+
"label": "Seat",
|
34
|
+
"value": "7A"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"key": "passenger-name",
|
38
|
+
"label": "Passenger",
|
39
|
+
"value": "John Appleseed"
|
40
|
+
}
|
41
|
+
],
|
42
|
+
"transitType": "PKTransitTypeAir",
|
43
|
+
"barcode": {
|
44
|
+
"message": "ABC123",
|
45
|
+
"format": "PKBarcodeFormatQR",
|
46
|
+
"messageEncoding": "iso-8859-1"
|
47
|
+
},
|
48
|
+
"backFields": [
|
49
|
+
{
|
50
|
+
"key": "terms",
|
51
|
+
"label": "Terms and Conditions",
|
52
|
+
"value": "Lorem ipsum dolar sit amet"
|
53
|
+
}
|
54
|
+
]
|
55
|
+
}
|
56
56
|
}
|
@@ -1,33 +1,27 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"key" : "terms",
|
28
|
-
"label" : "Terms and Conditions",
|
29
|
-
"value" : "Lorem ipsum dolar sit amet"
|
30
|
-
}
|
31
|
-
]
|
32
|
-
}
|
2
|
+
"formatVersion": 1,
|
3
|
+
"passTypeIdentifier": "pass.com.example.coupon",
|
4
|
+
"description": "Example Coupon",
|
5
|
+
"teamIdentifier": "Example",
|
6
|
+
"organizationName": "Example",
|
7
|
+
"serialNumber": "123456",
|
8
|
+
"foregroundColor": "#FFFFFF",
|
9
|
+
"backgroundColor": "#C799FF",
|
10
|
+
"generic": {
|
11
|
+
"primaryFields": [],
|
12
|
+
"secondaryFields": [],
|
13
|
+
"auxiliaryFields": [],
|
14
|
+
"barcode": {
|
15
|
+
"message": "ABCD 123 EFGH 456 IJKL 789 MNOP",
|
16
|
+
"format": "PKBarcodeFormatPDF417",
|
17
|
+
"messageEncoding": "iso-8859-1"
|
18
|
+
},
|
19
|
+
"backFields": [
|
20
|
+
{
|
21
|
+
"key": "terms",
|
22
|
+
"label": "Terms and Conditions",
|
23
|
+
"value": "Lorem ipsum dolar sit amet"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
33
27
|
}
|
@@ -1,33 +1,27 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"key" : "terms",
|
28
|
-
"label" : "Terms and Conditions",
|
29
|
-
"value" : "Lorem ipsum dolar sit amet"
|
30
|
-
}
|
31
|
-
]
|
32
|
-
}
|
2
|
+
"formatVersion": 1,
|
3
|
+
"passTypeIdentifier": "pass.com.example.event-ticket",
|
4
|
+
"description": "Example Event Ticket",
|
5
|
+
"teamIdentifier": "Example",
|
6
|
+
"organizationName": "Example",
|
7
|
+
"serialNumber": "123456",
|
8
|
+
"foregroundColor": "#FFFFFF",
|
9
|
+
"backgroundColor": "#FF5453",
|
10
|
+
"generic": {
|
11
|
+
"primaryFields": [],
|
12
|
+
"secondaryFields": [],
|
13
|
+
"auxiliaryFields": [],
|
14
|
+
"barcode": {
|
15
|
+
"message": "ABCD 123 EFGH 456 IJKL 789 MNOP",
|
16
|
+
"format": "PKBarcodeFormatPDF417",
|
17
|
+
"messageEncoding": "iso-8859-1"
|
18
|
+
},
|
19
|
+
"backFields": [
|
20
|
+
{
|
21
|
+
"key": "terms",
|
22
|
+
"label": "Terms and Conditions",
|
23
|
+
"value": "Lorem ipsum dolar sit amet"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
33
27
|
}
|
@@ -1,33 +1,27 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"key" : "terms",
|
28
|
-
"label" : "Terms and Conditions",
|
29
|
-
"value" : "Lorem ipsum dolar sit amet"
|
30
|
-
}
|
31
|
-
]
|
32
|
-
}
|
2
|
+
"formatVersion": 1,
|
3
|
+
"passTypeIdentifier": "pass.com.example.generic",
|
4
|
+
"description": "Example Generic Pass",
|
5
|
+
"teamIdentifier": "Example",
|
6
|
+
"organizationName": "Example",
|
7
|
+
"serialNumber": "123456",
|
8
|
+
"foregroundColor": "#FFFFFF",
|
9
|
+
"backgroundColor": "#444444",
|
10
|
+
"generic": {
|
11
|
+
"primaryFields": [],
|
12
|
+
"secondaryFields": [],
|
13
|
+
"auxiliaryFields": [],
|
14
|
+
"barcode": {
|
15
|
+
"message": "ABCD 123 EFGH 456 IJKL 789 MNOP",
|
16
|
+
"format": "PKBarcodeFormatPDF417",
|
17
|
+
"messageEncoding": "iso-8859-1"
|
18
|
+
},
|
19
|
+
"backFields": [
|
20
|
+
{
|
21
|
+
"key": "terms",
|
22
|
+
"label": "Terms and Conditions",
|
23
|
+
"value": "Lorem ipsum dolar sit amet"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
33
27
|
}
|
@@ -1,33 +1,27 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"key" : "terms",
|
28
|
-
"label" : "Terms and Conditions",
|
29
|
-
"value" : "Lorem ipsum dolar sit amet"
|
30
|
-
}
|
31
|
-
]
|
32
|
-
}
|
2
|
+
"formatVersion": 1,
|
3
|
+
"passTypeIdentifier": "pass.com.example.store-card",
|
4
|
+
"description": "Example Store Card",
|
5
|
+
"teamIdentifier": "Example",
|
6
|
+
"organizationName": "Example",
|
7
|
+
"serialNumber": "123456",
|
8
|
+
"foregroundColor": "#FFFFFF",
|
9
|
+
"backgroundColor": "#AFC1E3",
|
10
|
+
"generic": {
|
11
|
+
"primaryFields": [],
|
12
|
+
"secondaryFields": [],
|
13
|
+
"auxiliaryFields": [],
|
14
|
+
"barcode": {
|
15
|
+
"message": "ABCD 123 EFGH 456 IJKL 789 MNOP",
|
16
|
+
"format": "PKBarcodeFormatPDF417",
|
17
|
+
"messageEncoding": "iso-8859-1"
|
18
|
+
},
|
19
|
+
"backFields": [
|
20
|
+
{
|
21
|
+
"key": "terms",
|
22
|
+
"label": "Terms and Conditions",
|
23
|
+
"value": "Lorem ipsum dolar sit amet"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
33
27
|
}
|
data/lib/dubai/version.rb
CHANGED
data/spec/server_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dubai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Mattt
|
7
|
+
- Mattt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: commander
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rubyzip
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sinatra
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.3'
|
62
|
-
- - "
|
62
|
+
- - "<"
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: 2.0.0
|
65
65
|
type: :runtime
|
@@ -69,25 +69,25 @@ dependencies:
|
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '1.3'
|
72
|
-
- - "
|
72
|
+
- - "<"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 2.0.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: terminal-table
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '1.
|
81
|
+
version: '1.4'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '1.
|
88
|
+
version: '1.4'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: rack-test
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: rspec
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
@@ -129,7 +129,7 @@ dependencies:
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
132
|
+
name: simplecov
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - ">="
|
@@ -143,13 +143,14 @@ dependencies:
|
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
description: Passbook pass generation and preview.
|
146
|
-
email:
|
146
|
+
email: mattt@me.com
|
147
147
|
executables:
|
148
148
|
- pk
|
149
149
|
extensions: []
|
150
150
|
extra_rdoc_files: []
|
151
151
|
files:
|
152
152
|
- "./Gemfile"
|
153
|
+
- "./Gemfile.lock"
|
153
154
|
- "./LICENSE"
|
154
155
|
- "./README.md"
|
155
156
|
- "./Rakefile"
|
@@ -190,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
191
|
version: '0'
|
191
192
|
requirements: []
|
192
193
|
rubyforge_project:
|
193
|
-
rubygems_version: 2.6.
|
194
|
+
rubygems_version: 2.6.14
|
194
195
|
signing_key:
|
195
196
|
specification_version: 4
|
196
197
|
summary: Dubai
|