haveapi 0.5.3 → 0.6.0
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/CHANGELOG +5 -0
- data/README.md +8 -1
- data/haveapi.gemspec +1 -1
- data/lib/haveapi/authentication/token/resources.rb +1 -1
- data/lib/haveapi/model_adapters/active_record.rb +1 -1
- data/lib/haveapi/params.rb +7 -4
- data/lib/haveapi/server.rb +3 -0
- data/lib/haveapi/validators/presence.rb +1 -1
- data/lib/haveapi/version.rb +1 -1
- data/spec/validators/numericality_spec.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebf5f1d0fbc768717e2524ba3f39aacd309cfc99
|
4
|
+
data.tar.gz: fc682dfc13a3233775e4b277f5a28b898c4c39f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c6a7e2cf446b7a073abfc3c730d8e66a98bf08c352b436794955908eb81b991935c9e2407e95ce5c2d44d7076089580e5d2ff0aa796dacb19c017da74aca7b4
|
7
|
+
data.tar.gz: 122cf69cfd635ce62ec712d2d1d1d578cb8d5ddde30baa78b29fe7fc644bcfc1f865e9416b7157612487b3c0d8405f5c0544c3812da77d6fa6d3f02c12207461
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
* Tue Oct 18 2016 - version 0.6.0
|
2
|
+
- Token authentication: fix output of action renew
|
3
|
+
- ActiveRecord: fix parsing of includes
|
4
|
+
- Params.use: fix nested calls
|
5
|
+
|
1
6
|
* Mon Apr 18 2016 - version 0.5.3
|
2
7
|
- ActiveRecord.ar_parse_includes: ignore not existing associations
|
3
8
|
- Paginable: remove default values for limit and offset parameters
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ which they otherwise know nothing about.
|
|
21
21
|
- Auto-generated online HTML documentation
|
22
22
|
- Generic interface for clients - one client can be used to access all APIs
|
23
23
|
using this framework
|
24
|
-
- Ruby, PHP and JavaScript clients already available
|
24
|
+
- Ruby (with CLI), PHP and JavaScript (with web administration) clients already available
|
25
25
|
- A change in the API is immediately reflected in all clients
|
26
26
|
- Supports API versioning
|
27
27
|
- ORM integration
|
@@ -271,6 +271,13 @@ APIs that are using HaveAPI.
|
|
271
271
|
|
272
272
|
or [create your own client](doc/create-client.md).
|
273
273
|
|
274
|
+
Complex applications can be built on top of these basic clients, e.g.:
|
275
|
+
|
276
|
+
- [haveapi-webui](https://github.com/vpsfreecz/haveapi-webui), a generic web administration
|
277
|
+
for HaveAPI-based APIs
|
278
|
+
- [haveapi-fs](https://github.com/vpsfreecz/haveapi-fs), a FUSE based filesystem that can
|
279
|
+
mount any HaveAPI-based API
|
280
|
+
|
274
281
|
## Read more
|
275
282
|
- [Protocol definition](doc/protocol.md)
|
276
283
|
- [How to create a client](doc/create-client.md)
|
data/haveapi.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'haveapi/version'
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'haveapi'
|
7
7
|
s.version = HaveAPI::VERSION
|
8
|
-
s.date = '2016-
|
8
|
+
s.date = '2016-10-18'
|
9
9
|
s.summary =
|
10
10
|
s.description = 'Framework for creating self-describing APIs'
|
11
11
|
s.authors = 'Jakub Skokan'
|
@@ -99,7 +99,7 @@ END
|
|
99
99
|
|
100
100
|
def exec
|
101
101
|
klass = self.class.resource.token_instance[@version]
|
102
|
-
klass.send(:renew_token, request, current_user, klass.token(request))
|
102
|
+
{valid_to: klass.send(:renew_token, request, current_user, klass.token(request))}
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
data/lib/haveapi/params.rb
CHANGED
@@ -123,11 +123,14 @@ module HaveAPI
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def use(name, include: nil, exclude: nil)
|
126
|
+
@include_back ||= []
|
127
|
+
@exclude_back ||= []
|
128
|
+
|
126
129
|
block = @action.resource.params(name)
|
127
130
|
|
128
131
|
if block
|
129
|
-
@include_back
|
130
|
-
@exclude_back
|
132
|
+
@include_back << @include.clone if @include
|
133
|
+
@exclude_back << @exclude.clone if @exclude
|
131
134
|
|
132
135
|
if include
|
133
136
|
@include ||= []
|
@@ -141,8 +144,8 @@ module HaveAPI
|
|
141
144
|
|
142
145
|
instance_eval(&block)
|
143
146
|
|
144
|
-
@include = @include_back if include
|
145
|
-
@exclude = @exclude_back if exclude
|
147
|
+
@include = @include_back.pop if @include
|
148
|
+
@exclude = @exclude_back.pop if @exclude
|
146
149
|
end
|
147
150
|
end
|
148
151
|
|
data/lib/haveapi/server.rb
CHANGED
@@ -122,6 +122,9 @@ module HaveAPI
|
|
122
122
|
set :views, settings.root + '/views'
|
123
123
|
set :public_folder, settings.root + '/public'
|
124
124
|
set :bind, '0.0.0.0'
|
125
|
+
set :dump_errors, true
|
126
|
+
set :raise_errors, true
|
127
|
+
set :show_exceptions, false
|
125
128
|
|
126
129
|
helpers ServerHelpers
|
127
130
|
|
data/lib/haveapi/version.rb
CHANGED
@@ -67,4 +67,14 @@ describe HaveAPI::Validators::Numericality do
|
|
67
67
|
expect(v.valid?(0)).to be false
|
68
68
|
expect(v.valid?(2)).to be false
|
69
69
|
end
|
70
|
+
|
71
|
+
it 'checks number as string' do
|
72
|
+
v = HaveAPI::Validators::Numericality.new(:number, {min: 5})
|
73
|
+
expect(v.valid?('5')).to be true
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'rejects a string that is not a number' do
|
77
|
+
v = HaveAPI::Validators::Numericality.new(:number, {min: 5})
|
78
|
+
expect(v.valid?('abc')).to be false
|
79
|
+
end
|
70
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haveapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Skokan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require_all
|
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
260
|
rubyforge_project:
|
261
|
-
rubygems_version: 2.2
|
261
|
+
rubygems_version: 2.5.2
|
262
262
|
signing_key:
|
263
263
|
specification_version: 4
|
264
264
|
summary: Framework for creating self-describing APIs
|