underway 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0725b18ff63695654ff86cd63ba3d4669971a8ca
4
- data.tar.gz: 2804c0a2916e847b2a7a53739c1568f94e7fcd99
3
+ metadata.gz: 0ee57f24ba90cd705ee45e9179174240077059c9
4
+ data.tar.gz: 7b354facf948869e7de7f01cdb026187fb96a005
5
5
  SHA512:
6
- metadata.gz: 19914c5e32911685356e467ea190e73ac62222b939d9234c6e9180e3483d8433b1ddea0bf59fffd1990097eb5c326b5bc26d08c50a8d2fcd55179b6ded028dec
7
- data.tar.gz: 1601a1f138f9dcf6ea6a709a2d272165deaff6fa1cb4a98b0c5327111a06ab912f62a391542114b6f4b9d5070d445b290577448bb0d34e109a5633d3ec909447
6
+ metadata.gz: 9e47816d17d724ce6442d7e3dc54e6c2b7bac2c1851b69a97d75552fb8a49772fca5c3254855014b7aeddc20f952fcfec5b9d78ee282e7dd1f3d21275b15334d
7
+ data.tar.gz: a475108a944742afaf76fefbf08f10917445785b85b5d6c1995205e468c04183cced8f0430c903d2a880015f913a0763b3c5052a794735c8d014dbf5a0ef14d4
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3
4
+ - 2.4
5
+ - 2.5
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
+ [![Build Status](https://travis-ci.org/jamesmartin/underway.svg?branch=master)](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 [config.json.example]() file in a location readable by your
49
- application and edit the file to match your GitHub App's settings.
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
@@ -1,5 +1,6 @@
1
1
  require "sinatra"
2
2
  require "underway"
3
+ require "underway/sinatra"
3
4
 
4
5
  configure do
5
6
  Underway::Settings.configure do |config|
data/lib/underway/api.rb CHANGED
@@ -78,5 +78,11 @@ module Underway
78
78
  def self.verbose_logging?
79
79
  !!Underway::Settings.config.verbose_logging
80
80
  end
81
+
82
+ def self.log(message)
83
+ if verbose_logging?
84
+ ::Underway::Settings.config.logger.info(message)
85
+ end
86
+ end
81
87
  end
82
88
  end
@@ -1,3 +1,3 @@
1
1
  module Underway
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/underway.rb CHANGED
@@ -3,7 +3,6 @@ require "underway/database"
3
3
  require "underway/logger"
4
4
  require "underway/sawyer_to_json"
5
5
  require "underway/settings"
6
- require "underway/sinatra"
7
6
  require "underway/token_cache"
8
7
  require "underway/version"
9
8
 
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.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-03-05 00:00:00.000000000 Z
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