Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage updates. Added a section on obtaining a certificate. #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,38 @@ Or install it yourself as:
## Usage

```ruby
test_icon = File.open('icon.png')
@pair = {
key: OpenSSL::PKey::RSA.new(File.read('rsa.pem'), 'my pass phrase'),
certificate: OpenSSL::X509::Certificate.new(File.read('apple-dev.cer'))
}
```
p12 = OpenSSL::PKCS12.new(File.read('certificate.p12'), 'PASSWORD')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening a single file won't work because the file is closed after being read.


```ruby
builder = Grocer::Pushpackager::Package.new({
websiteName: "Bay Airlines",
websitePushID: "web.com.example.domain",
allowedDomains: ["http://domain.example.com"],
urlFormatString: "http://domain.example.com/%@/?flight=%@",
authenticationToken: "19f8d7a6e9fb8a7f6d9330dabe",
webServiceURL: "https://example.com/push",
certificate: @pair[:certificate],
key: @pair[:key],
certificate: p12.certificate,
key: p12.certificate,
iconSet: {
:'16x16' => test_icon,
:'16x16@2x' => test_icon,
:'32x32' => test_icon,
:'32x32@2x' => test_icon,
:'128x128' => test_icon,
:'128x128@2x' => test_icon
:'16x16' => File.open('icon.png'),
:'16x16@2x' => File.open('icon.png'),
:'32x32' => File.open('icon.png'),
:'32x32@2x' => File.open('icon.png'),
:'128x128' => File.open('icon.png'),
:'128x128@2x' => File.open('icon.png')
}
})
builder.file # A closed Tempfile that can be read
builder.buffer # A string buffer that can be streamed out to a client
```

## Obtaining a Certificate

1. Visit the [Website Push IDs](https://developer.apple.com/account/ios/identifiers/websitePushId/websitePushIdList.action) page under Identifiers in the Developer Center.
2. Create a new ID.
3. Download the new certificate in the Certificates section.
4. Open the certificate in Keychain Access
5. Right click on the certificate and choose export. Select the p12 option.

## Contributing

1. Fork it
Expand Down