toast 1.0.5 → 1.0.6
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/lib/toast/collection_request.rb +1 -1
- data/lib/toast/plural_assoc_request.rb +2 -2
- data/lib/toast/request_helpers.rb +5 -0
- data/lib/toast/singular_assoc_request.rb +2 -2
- data/lib/toast/version.rb +1 -1
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcf34faf2722c917e10c577473faa6a9b53831fb
|
4
|
+
data.tar.gz: 9f0f82599a3f566ac690509d18870eb383a4af71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0b50c7153ee3bcf91aecd387ea6bd6ca525239cc9e76597085cae557b3f937545a40405e9cedfd0991cccd969b0b78722d507bae2899aeb6923bdafcbb1e4ea
|
7
|
+
data.tar.gz: 13ff423f0903aef4e5a577ef8e03a2f79a8366e783ca4035655188608bcb2ed84a9ec0617b5761002a3a4a84ddcb658ea3f363ac821c2407eae0bf6635115962
|
@@ -124,7 +124,7 @@ class Toast::CollectionRequest
|
|
124
124
|
|
125
125
|
if new_instance.persisted?
|
126
126
|
response :created,
|
127
|
-
headers: {"Content-Type" => @
|
127
|
+
headers: {"Content-Type" => @base_config.media_type},
|
128
128
|
msg: "created #{new_instance.class}##{new_instance.id}",
|
129
129
|
body: represent(new_instance, @base_config)
|
130
130
|
else
|
@@ -195,7 +195,7 @@ class Toast::PluralAssocRequest
|
|
195
195
|
return response :bad_request, msg: "Link header missing or invalid"
|
196
196
|
end
|
197
197
|
|
198
|
-
name, target_id =
|
198
|
+
name, target_id = split_link_header(link)
|
199
199
|
target_model_class = name.singularize.classify.constantize
|
200
200
|
|
201
201
|
unless is_active_record? target_model_class
|
@@ -246,7 +246,7 @@ class Toast::PluralAssocRequest
|
|
246
246
|
return response :bad_request, msg: "Link header missing or invalid"
|
247
247
|
end
|
248
248
|
|
249
|
-
name, id =
|
249
|
+
name, id = split_link_header(link)
|
250
250
|
target_model_class = name.singularize.classify.constantize
|
251
251
|
|
252
252
|
unless is_active_record? target_model_class
|
@@ -17,6 +17,11 @@ module Toast::RequestHelpers
|
|
17
17
|
(request.protocol + request.host + port.to_s + path).chomp('/')
|
18
18
|
end
|
19
19
|
|
20
|
+
# split the name and id of the resource from a LinkHeader
|
21
|
+
def split_link_header link
|
22
|
+
URI(link.href).path.sub(@request.script_name,'').split('/')[1..-1]
|
23
|
+
end
|
24
|
+
|
20
25
|
def represent_one record, config
|
21
26
|
result = {}
|
22
27
|
|
@@ -99,7 +99,7 @@ class Toast::SingularAssocRequest
|
|
99
99
|
return response :bad_request, msg: "Link header missing or invalid"
|
100
100
|
end
|
101
101
|
|
102
|
-
name, target_id =
|
102
|
+
name, target_id = split_link_header(link)
|
103
103
|
target_model_class = name.singularize.classify.constantize
|
104
104
|
|
105
105
|
unless is_active_record? target_model_class
|
@@ -154,7 +154,7 @@ class Toast::SingularAssocRequest
|
|
154
154
|
return response :bad_request, msg: "Link header missing or invalid"
|
155
155
|
end
|
156
156
|
|
157
|
-
name, target_id =
|
157
|
+
name, target_id = split_link_header(link)
|
158
158
|
target_model_class = name.singularize.classify.constantize
|
159
159
|
|
160
160
|
unless is_active_record? target_model_class
|
data/lib/toast/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
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:
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.2.9
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.2.9
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: link_header
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.0.8
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.0.8
|
41
41
|
description: "Toast is a Rack application that hooks into Ruby on Rails. It exposes
|
@@ -85,19 +85,18 @@ require_paths:
|
|
85
85
|
- lib
|
86
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 2.0.0
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.5.2.3
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Toast exposes ActiveRecord models as a web service (REST API).
|
102
102
|
test_files: []
|
103
|
-
has_rdoc:
|