underway 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/CHANGELOG.md +19 -0
- data/README.md +36 -2
- data/example/app.rb +1 -0
- data/lib/underway/api.rb +6 -0
- data/lib/underway/version.rb +1 -1
- data/lib/underway.rb +0 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ee57f24ba90cd705ee45e9179174240077059c9
|
|
4
|
+
data.tar.gz: 7b354facf948869e7de7f01cdb026187fb96a005
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e47816d17d724ce6442d7e3dc54e6c2b7bac2c1851b69a97d75552fb8a49772fca5c3254855014b7aeddc20f952fcfec5b9d78ee282e7dd1f3d21275b15334d
|
|
7
|
+
data.tar.gz: a475108a944742afaf76fefbf08f10917445785b85b5d6c1995205e468c04183cced8f0430c903d2a880015f913a0763b3c5052a794735c8d014dbf5a0ef14d4
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased][unreleased]
|
|
6
|
+
- Nothing
|
|
7
|
+
|
|
8
|
+
## [1.0.1] - 2018-05-09
|
|
9
|
+
### Fixed
|
|
10
|
+
- No longer require Sinatra to be installed
|
|
11
|
+
[#4](https://github.com/jamesmartin/underway/issues/4)
|
|
12
|
+
|
|
13
|
+
## 1.0.0 - 2018-03-05
|
|
14
|
+
### Added
|
|
15
|
+
- First release
|
|
16
|
+
|
|
17
|
+
[unreleased]: https://github.com/jamesmartin/underway/compare/v1.0.1...HEAD
|
|
18
|
+
[1.0.1]: https://github.com/jamesmartin/underway/compare/v1.0.0...v1.0.1
|
|
19
|
+
[1.0.0]: https://github.com/jamesmartin/underway/compare/5c7f4d7d3bfc...v1.0.0
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Underway
|
|
2
2
|
|
|
3
|
+
[](https://travis-ci.org/jamesmartin/underway)
|
|
4
|
+
|
|
3
5
|
Underway is a Ruby gem that helps developers quickly prototype [GitHub
|
|
4
6
|
Apps](https://developer.github.com/apps/).
|
|
5
7
|
|
|
@@ -45,8 +47,10 @@ When you're done creating a new App you should have:
|
|
|
45
47
|
- A private key file (.pem)
|
|
46
48
|
- A webhook secret (optional)
|
|
47
49
|
|
|
48
|
-
Make a copy of the
|
|
49
|
-
|
|
50
|
+
Make a copy of the
|
|
51
|
+
[config.json.example](https://github.com/jamesmartin/underway/blob/master/config.json.example)
|
|
52
|
+
file in a location readable by your application and edit the file to match your
|
|
53
|
+
GitHub App's settings.
|
|
50
54
|
|
|
51
55
|
At its core, Underway is just a Ruby library and can be used in virtually any
|
|
52
56
|
application. To get started quickly and test out your new GitHub App you might
|
|
@@ -71,3 +75,33 @@ Underway::Settings.configure do |config|
|
|
|
71
75
|
config.config_filename = "config.json"
|
|
72
76
|
end
|
|
73
77
|
```
|
|
78
|
+
|
|
79
|
+
## Usage
|
|
80
|
+
|
|
81
|
+
The most useful part of Underway for interacting with GitHub Apps is found in
|
|
82
|
+
the `Underway::Api` class.
|
|
83
|
+
|
|
84
|
+
For example, right out of the box you can generate a JWT for your App:
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
Underway::Api.generate_jwt
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
You can get an access token for a given installation of your App:
|
|
91
|
+
|
|
92
|
+
```ruby
|
|
93
|
+
installations = Underway::Api.invoke("/app/installations")
|
|
94
|
+
access_token = Underway::Api.installation_token(id: installations.first.id)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Access tokens are cached, to save API calls. When an access token has expired a
|
|
98
|
+
new one will be generated and cached.
|
|
99
|
+
|
|
100
|
+
To get a list of repositories to which an installation of your App has access,
|
|
101
|
+
try this:
|
|
102
|
+
|
|
103
|
+
```ruby
|
|
104
|
+
installations = Underway::Api.invoke("/app/installations")
|
|
105
|
+
access_token = Underway::Api.installation_token(id: installations.first.id)
|
|
106
|
+
repositories = Underway::Api.invoke("/installation/repositories", headers: { authorization: "token #{access_token}" })
|
|
107
|
+
```
|
data/example/app.rb
CHANGED
data/lib/underway/api.rb
CHANGED
data/lib/underway/version.rb
CHANGED
data/lib/underway.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: underway
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Martin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -159,6 +159,8 @@ extra_rdoc_files: []
|
|
|
159
159
|
files:
|
|
160
160
|
- ".gitignore"
|
|
161
161
|
- ".ruby-version"
|
|
162
|
+
- ".travis.yml"
|
|
163
|
+
- CHANGELOG.md
|
|
162
164
|
- Gemfile
|
|
163
165
|
- LICENSE
|
|
164
166
|
- README.md
|