Skip to content

Commit d5bf5b5

Browse files
annaswimscoorasse
andauthored
extra Documentation (#24)
* update documentation * more comments * Update lib/passkit/factory.rb Co-authored-by: Alessandro Rodi <[email protected]> * Update lib/passkit/base_pass.rb Co-authored-by: Alessandro Rodi <[email protected]> --------- Co-authored-by: Alessandro Rodi <[email protected]>
1 parent d435db2 commit d5bf5b5

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,14 @@ You can define colors, fields and texts. You can also define the logo and the ba
128128
You should place the images in a 'private/passkit/<your_downcased_passname>' folder.
129129
There is a [dummy app in the gem](test/dummy) that you can use to check how to create your own Wallet Passes.
130130

131+
Full documentation for image specifications is on Apple's
132+
[Pass Design and Creation](https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html)
133+
page. Naming the file according to convetion and putting it in 'private/passkit/<your_downcased_passname>' is all that's needed for it
134+
to be included in the pass.
135+
131136
### Serve your Wallet Pass
132137

133-
Use the [Passkit::UrlGenerator](lib/passkit/url_generator.rb) to generate the URL to serve your Wallet Pass.
138+
Use the [Passkit::UrlGenerator](lib/passkit/url_generator.rb) to generate the URL to serve your Wallet Pass.
134139
You can initialize it with:
135140

136141
```ruby

docs/passkit_environment_variables.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In production, it will simply be your domain name, but in development you can us
1212

1313
This is the easy one.
1414
Head to https://www.apple.com/certificateauthority/ and download the latest Apple Intermediate Certificate Worldwide Developer Relations.
15-
You might want to choose the one with the longest expiration date.
15+
You might want to choose the one with the longest expiration date. PASSKIT_APPLE_INTERMEDIATE_CERTIFICATE is the path to the certificate.
1616

1717
### `PASSKIT_APPLE_TEAM_IDENTIFIER`
1818

@@ -32,7 +32,7 @@ Head to your Apple Developers console and generate a new certificate.
3232

3333
The identifier is the `PASSKIT_PASS_TYPE_IDENTIFIER` variable.
3434

35-
Now, create a certificate signing request: https://help.apple.com/developer-account/#/devbfa00fef7
35+
Now, create a certificate signing request: https://developer.apple.com/help/account/create-certificates/create-a-certificate-signing-request/
3636

3737
And create the certificate:
3838

lib/passkit/base_pass.rb

+13-3
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,40 @@ def web_service_url
4747
"#{ENV["PASSKIT_WEB_SERVICE_HOST"]}/passkit/api"
4848
end
4949

50+
# The foreground color, used for the values of fields shown on the front of the pass.
5051
def foreground_color
5152
# black
5253
"rgb(0, 0, 0)"
5354
end
5455

56+
# The background color, used for the background of the front and back of the pass.
57+
# If you provide a background image, any background color is ignored.
5558
def background_color
5659
# white
5760
"rgb(255, 255, 255)"
5861
end
5962

63+
# The label color, used for the labels of fields shown on the front of the pass.
6064
def label_color
6165
# black
6266
"rgb(0, 0, 0)"
6367
end
6468

69+
# The organization name is displayed on the lock screen when your pass is relevant and by apps such as Mail which
70+
# act as a conduit for passes. The value for the organizationName key in the pass specifies the organization name.
71+
# Choose a name that users recognize and associate with your organization or company.
6572
def organization_name
6673
"Passkit"
6774
end
6875

76+
# The description lets VoiceOver make your pass accessible to blind and low-vision users. The value for the
77+
# description key in the pass specifies the description.
78+
# @see https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html
6979
def description
7080
"A basic description for a pass"
7181
end
7282

73-
# A pass can have up to ten relevant locations
83+
# An array of up to 10 latitudes and longitudes. iOS uses these locations to determine when to display the pass on the lock screen
7484
#
7585
# @see https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html
7686
def locations
@@ -133,7 +143,7 @@ def event_ticket
133143

134144
# Date and time the pass expires, must include
135145
# days, hours and minutes (seconds are optional)
136-
# Returns a String representing the date and time in W3C format
146+
# Returns a String representing the date and time in W3C format ("%Y-%m-%dT%H:%M:%S%z")
137147
def expiration_date
138148
end
139149

@@ -157,7 +167,7 @@ def nfc
157167
# Date and time when the pass becomes relevant and should be
158168
# displayed, must include days, hours and minutes
159169
# (seconds are optional)
160-
# Returns a String representing the date and time in W3C format
170+
# Returns a String representing the date and time in W3C format ("%Y-%m-%dT%H:%M:%S%z")
161171
def relevant_date
162172
end
163173

lib/passkit/factory.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Passkit
22
class Factory
33
class << self
4+
# generator is an optional ActiveRecord object, the application data for the pass
45
def create_pass(pass_class, generator = nil)
56
pass = Passkit::Pass.create!(klass: pass_class, generator: generator)
67
Passkit::Generator.new(pass).generate_and_sign

0 commit comments

Comments
 (0)