utter 1.0.4 → 1.0.5
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/examples/app.rb +21 -0
- data/examples/config.ru +10 -0
- data/lib/utter/version.rb +1 -1
- data/lib/utter.rb +18 -2
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52d762766607a4a8f85b52035ac6fc3b37896c72
|
4
|
+
data.tar.gz: 43702a686975fe137a9660cec6f40a3dbb222010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed05ad63614389de0eff74ee821933a69a87b97bd915cb4ae44327f60650ead7a8905c89401fdf2c63554615c1d1ba74d9e7f13bd808810e96e21c29d3c45629
|
7
|
+
data.tar.gz: 38d38483539ab5416ac87e2ead8730ffaba045a03d7ba0c825d8057b6b385efc185a916f29d38ef5d2ae8b530d54aeccae14fba5a223bc61207851d60721eb65
|
data/examples/app.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'utter'
|
2
|
+
module API
|
3
|
+
module V1
|
4
|
+
class PublicEndpoint < Utter::Endpoint
|
5
|
+
$log.info("mounting #{self}")
|
6
|
+
get '/' do
|
7
|
+
"public info"
|
8
|
+
end
|
9
|
+
run! if app_file == $0
|
10
|
+
end
|
11
|
+
|
12
|
+
class PrivateEndpoint < Utter::Endpoint
|
13
|
+
$log.info("mounting #{self}")
|
14
|
+
get '/' do
|
15
|
+
"private info (eyes only)"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
data/examples/config.ru
ADDED
data/lib/utter/version.rb
CHANGED
data/lib/utter.rb
CHANGED
@@ -13,8 +13,22 @@ $log = Logger.new(STDOUT)
|
|
13
13
|
|
14
14
|
module Utter
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
# any class that inherits from Endpoint, may include Utter::Token to add security
|
17
|
+
# token, a token can be used for authenticating a signed-in user or as an API for your system.
|
18
|
+
#
|
19
|
+
# Usage
|
20
|
+
#
|
21
|
+
# via curl https://api.example.com/v1/endpoint_name -u token_value:
|
22
|
+
# via Browser http://token_value@localhost:4567/
|
23
|
+
# If you need to authenticate via bearer auth (e.g., for a cross-origin request), use -H "Authorization: Bearer #{token_value}" instead of -u token_value:
|
24
|
+
#
|
25
|
+
# More Info
|
26
|
+
# - https://en.wikipedia.org/wiki/Digest_access_authentication
|
27
|
+
# - https://github.com/rack/rack/blob/master/lib/rack/auth/basic.rb
|
28
|
+
module Token
|
29
|
+
use Rack::Auth::Basic, "Protected Area" do |token|
|
30
|
+
token == 'foo'
|
31
|
+
end
|
18
32
|
end
|
19
33
|
|
20
34
|
class Endpoint < Sinatra::Base
|
@@ -32,6 +46,8 @@ module Utter
|
|
32
46
|
end
|
33
47
|
end
|
34
48
|
|
49
|
+
|
50
|
+
|
35
51
|
class Model
|
36
52
|
def self.inherited(model)
|
37
53
|
model.send :include, SSD
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zotherstupidguy
|
@@ -180,6 +180,8 @@ files:
|
|
180
180
|
- Rakefile
|
181
181
|
- bin/console
|
182
182
|
- bin/setup
|
183
|
+
- examples/app.rb
|
184
|
+
- examples/config.ru
|
183
185
|
- lib/utter.rb
|
184
186
|
- lib/utter/version.rb
|
185
187
|
- utter.gemspec
|