toast 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: 1a702e1c3fefb8b0f86ae4169cf2bf0d5c06c59e
4
- data.tar.gz: 7909991e0e45f40ab0f9889656a5fa0f64244bb2
3
+ metadata.gz: 5e4eb8103991d5f602d32c0d0a0f28302c7d8f92
4
+ data.tar.gz: 555253820fdeed47d6f65c82f7e0f7f4510abfd3
5
5
  SHA512:
6
- metadata.gz: ae832ad5e6df4d2b1fe56e52125fc2721029bd084c8c8ef7f1c1271d64bffbdea500f3fe9b3fbc3cdac7c47f9762cc3010cee3b8335c406aed1f084a8a2b20e7
7
- data.tar.gz: b7c9bd99a118e16f6d722e5bc4323335e85f151be89e59457684426cee8b4c3bf8bd3afaea460620f3013da83d4d27f9e18fc9281505f3d55bef98e0bdd090d6
6
+ metadata.gz: 423b2edc025b2bd8e31c043303fc6e702dd18bcba559703814e51dd00f7eb29a16c2acb8b7641d4f9ee8b82418e9d2f83dd31fd219bb97743c566ff69a77776f
7
+ data.tar.gz: 5ee502e2b5b2caf57642a9aec5cb39466b8423cf6053c17ddbec774dc223137aa1b32e28a6a5b05c8c85fcc0f23f79ef49564aa40769c06cb7525f1952b5b54d
data/README.md CHANGED
@@ -22,7 +22,7 @@ Other features are:
22
22
 
23
23
  Toast v1 is build for Rails 5. The predecesssor v0.9 supports 3 and 4, but has a much different and smaller DSL.
24
24
 
25
- See the User Manual (to be published soon) for a detailed description.
25
+ See the [User Manual](https://robokopp.github.io/toast) for a detailed description.
26
26
 
27
27
  Status
28
28
  ======
@@ -30,6 +30,8 @@ Status
30
30
  Toast v1 for Rails 5 is a complete rewrite of v0.9, which was first published and used in production since 2012.
31
31
  It comes now with secure defaults: Nothing is exposed unless declared, all endpoints have a default authorization hook responding with 401.
32
32
 
33
+ v1 is not compatible with v0.9, and it is not tested with Rails < v5. All configurations must be ported to the new DSL.
34
+
33
35
  From my point of view it is production ready. I am in the process of porting a large API from v0.9 to v1 that uses all features and it looks very good so far. Of course minor issues will appear, please help to report and fix them.
34
36
 
35
37
  Installation
@@ -69,7 +71,7 @@ and let a corresponding model class have this code:
69
71
  belongs_to :apple
70
72
  has_many :coconuts
71
73
 
72
- scope :less_than_100, where("number < 100")
74
+ scope :less_than_100, -> { where("number < 100") }
73
75
  end
74
76
 
75
77
  Then we can define the API like this (in `config/toast-api/banana.rb`):
@@ -158,7 +160,7 @@ Then we can define the API like this (in `config/toast-api/banana.rb`):
158
160
  }
159
161
  }
160
162
 
161
- Note, that all `allow`-blocks returning _true_. In practice authorization logic should be applied. An `allow`-block must be defined for each endpoint because it defaults to return `false`, which causes a 401 response.
163
+ Note, that all allow-blocks in the above example return _true_. In practice authorization logic should be applied. An allow-block must be defined for each endpoint because it defaults to return _false_, which causes a _401 Unauthorized_ response.
162
164
 
163
165
  The above definition exposes the model Banana as such:
164
166
 
@@ -190,7 +192,7 @@ The default length of collections is limited to 42, this can be adjusted globall
190
192
  GET http://www.example.com/bananas/less_than_100
191
193
  --> 200, '[{BANANA}, {BANANA}, ...]'
192
194
 
193
- Any scope can be published this way as well as any model class method returning a relation.
195
+ Any _scope_ or class method returning a relation can be published this way.
194
196
 
195
197
  ### Get an associated collection + filter
196
198
  GET http://www.example.com/bananas/23/coconuts?max_weight=3
@@ -233,7 +235,7 @@ Toast ingores unknown attributes, but prints warnings in it's log file. Only att
233
235
  Link: "http://www.example.com/coconuts/31"
234
236
  --> 200
235
237
 
236
- Toast uses the (unusual) methods LINK and UNLINK in order to express the action of linking or unlinking existing resources. The above request will add _Coconut#31_ to the association _Banana#coconuts_.
238
+ Toast uses the (unusual) HTTP verbs LINK and UNLINK in order to express the action of linking or unlinking existing resources. The above request will add _Coconut#31_ to the association _Banana#coconuts_.
237
239
 
238
240
 
239
241
 
@@ -57,7 +57,7 @@ class Toast::RackApp
57
57
  begin
58
58
  base_config = get_config(model_class)
59
59
  rescue Toast::Errors::ConfigNotFound => error
60
- return response :internal_server_error,
60
+ return response :not_found,
61
61
  msg: "no API configuration found for model `#{model_class.name}'"
62
62
  end
63
63
 
data/lib/toast/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Toast
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toast
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
  - robokopp (Robert Annies)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-08 00:00:00.000000000 Z
11
+ date: 2017-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -90,7 +90,8 @@ files:
90
90
  - lib/toast/singular_assoc_request.rb
91
91
  - lib/toast/version.rb
92
92
  homepage: https://github.com/robokopp/toast
93
- licenses: []
93
+ licenses:
94
+ - MIT
94
95
  metadata: {}
95
96
  post_install_message:
96
97
  rdoc_options: []
@@ -100,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
101
  requirements:
101
102
  - - '>='
102
103
  - !ruby/object:Gem::Version
103
- version: '0'
104
+ version: 2.2.2
104
105
  required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  requirements:
106
107
  - - '>='