haveapi 0.5.3 → 0.6.0

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: f07a08da63c6a6971d962f5de898151b8f1526e8
4
- data.tar.gz: 82a118d577b0f0c21585282b6e72733e8dac8857
3
+ metadata.gz: ebf5f1d0fbc768717e2524ba3f39aacd309cfc99
4
+ data.tar.gz: fc682dfc13a3233775e4b277f5a28b898c4c39f6
5
5
  SHA512:
6
- metadata.gz: babc460201bfb5cff7adfab5017a70570f69c0b484e898b3ca62c2d1c016a1cde2c93c2369edadfc0de2c9ec1a8a392b89c2eb1288863b938fb551e411d54850
7
- data.tar.gz: 8f1bea4fc43b85ff52374ac37cab28af42e7a1be75210fafe458f84a6a6f0503495f0b2921596c50b221430150362a33afc63f1a200ab2def908f236db482891
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-04-18'
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
@@ -68,7 +68,7 @@ module HaveAPI::ModelAdapters
68
68
  if assoc.index('__')
69
69
  tmp = {}
70
70
  parts = assoc.split('__')
71
- tmp[parts.first.to_sym] = ar_inner_includes(parts[1..-1])
71
+ tmp[parts.first.to_sym] = ar_inner_includes([parts[1..-1].join('__')])
72
72
 
73
73
  args << tmp
74
74
  else
@@ -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 = @include.clone if @include
130
- @exclude_back = @exclude.clone if @exclude
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
 
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module HaveAPI
2
- # Checks the value is a number or a string containing only digits.
2
+ # Checks the value is present and not empty.
3
3
  #
4
4
  # Short form:
5
5
  # string :param, required: true
@@ -1,4 +1,4 @@
1
1
  module HaveAPI
2
2
  PROTOCOL_VERSION = '1.0'
3
- VERSION = '0.5.3'
3
+ VERSION = '0.6.0'
4
4
  end
@@ -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.5.3
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-04-18 00:00:00.000000000 Z
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.5
261
+ rubygems_version: 2.5.2
262
262
  signing_key:
263
263
  specification_version: 4
264
264
  summary: Framework for creating self-describing APIs