standardapi 5.0.0.6 → 5.0.0.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 063b813ac24cddfe25d10fc3a0feae1275f4a33c
|
4
|
+
data.tar.gz: 1508403c873b4155d310a90899aaa24ee8b53adb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d957f41104edfbb811c394a0c2412b5733ea30ad17aff358180d205d1555b5c55723dabdc3785b47a13120f9fd942c9ec6026ffc064a6adfb696f3ceea4cf230
|
7
|
+
data.tar.gz: ce04e41c9d05bfd6d481cd65a12a279c337d60f376d6b9d9757eef7f03571bdda5bd7a9168670bf0e7f61787ffb4ee8cf758df0c3ba6042a2be0f4434f11f862
|
@@ -112,19 +112,19 @@ module StandardAPI
|
|
112
112
|
assert_equal json[included.to_s][key.to_s], normalize_to_json(m, key, value)
|
113
113
|
end
|
114
114
|
else
|
115
|
-
|
115
|
+
m2 = m.send(included).first.try(:reload)
|
116
116
|
|
117
|
-
m_json = if
|
118
|
-
json[included.to_s].find { |x| x['id'] == normalize_to_json(
|
119
|
-
elsif
|
120
|
-
json[included.to_s].find { |x| x.keys.all? { |key| x[key] == normalize_to_json(
|
117
|
+
m_json = if m2 && m2.has_attribute?(:id)
|
118
|
+
json[included.to_s].find { |x| x['id'] == normalize_to_json(m2, :id, m2.id) }
|
119
|
+
elsif m2
|
120
|
+
json[included.to_s].find { |x| x.keys.all? { |key| x[key] == normalize_to_json(m2, key, m2[key]) } }
|
121
121
|
else
|
122
122
|
nil
|
123
123
|
end
|
124
124
|
|
125
|
-
view_attributes(
|
126
|
-
message = "Model / Attribute: #{
|
127
|
-
assert_equal m_json[key.to_s], normalize_to_json(
|
125
|
+
view_attributes(m2).each do |key, value|
|
126
|
+
message = "Model / Attribute: #{m2.class.name}##{key}"
|
127
|
+
assert_equal m_json[key.to_s], normalize_to_json(m2, key, value), message
|
128
128
|
end
|
129
129
|
|
130
130
|
end
|
@@ -12,9 +12,26 @@ module StandardAPI
|
|
12
12
|
end
|
13
13
|
|
14
14
|
test '#index.json requires limit' do
|
15
|
-
|
15
|
+
limit = controller_class.new.send(:resource_limit)
|
16
|
+
|
17
|
+
return if !limit || limit == Float::INFINITY
|
18
|
+
|
19
|
+
begin
|
16
20
|
get resource_path(:index, format: :json)
|
21
|
+
assert_response :bad_request
|
22
|
+
rescue ActionController::ParameterMissing
|
17
23
|
end
|
24
|
+
|
25
|
+
# return if !controller_class.new.send(:resource_limit)
|
26
|
+
# if app.config.action_dispatch.show_exceptions
|
27
|
+
# assert_raises ActionController::ParameterMissing do
|
28
|
+
# get resource_path(:index, format: 'json')
|
29
|
+
# assert_response :bad_request
|
30
|
+
# end
|
31
|
+
# else
|
32
|
+
# get resource_path(:index, format: :json)
|
33
|
+
# assert_response :bad_request
|
34
|
+
# end
|
18
35
|
end
|
19
36
|
|
20
37
|
test '#index.json params[:limit]' do
|
data/lib/standard_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standardapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|