standardapi 1.0.17 → 1.0.18

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: f80d90ed82d66f971ccf96ea833f58acd99c9adf
4
- data.tar.gz: e317d8b862655b1d97081a3d114be321a417fcb5
3
+ metadata.gz: a335bf3f3a1df576a464d696cfb2c4e08db85ebd
4
+ data.tar.gz: b1c17381aa0c534ccaec58ffa3a9d86fe53d37f0
5
5
  SHA512:
6
- metadata.gz: 64df65916314e170718b1efb030802c8950a4ea11f55f6dfdb9ed6b8d801fcbf9488204c04f2015ea984bcd2152889a87e53b0d7d20d9facd8138a89ab17b8bb
7
- data.tar.gz: c3acbfc937611625bd7d08d0692df7d5738486c360df3de3a0523011ccfb2096407914fc724560e774a07311409d50699e523228aa28596553cc8e6dc633dfaf
6
+ metadata.gz: 6d08cab6b53e58fff34afd58d359c51bc4ae72f7d020d5ee35f649fc0f7f7589185225771b5dabd4a0a2250c5ec1f7d630c2b116368a7c62155b00bd2e0b9a0f
7
+ data.tar.gz: 5193ba62c57aa0aa3e997a73875ebf66434a06228897b5e13adb682a32cfefc802b5d562286a6815f30b190fa3c03b163ae373777df66bb54e76c9329deea489
@@ -2,7 +2,7 @@ module StandardAPI
2
2
  module Helpers
3
3
 
4
4
  def model_partial(record)
5
- if lookup_context.exists?(record.model_name.element, controller_name)
5
+ if lookup_context.exists?(record.model_name.element, controller_name, true)
6
6
  [record.model_name.plural, record.model_name.element].join('/')
7
7
  else
8
8
  'application/record'
@@ -91,7 +91,6 @@ module StandardAPI
91
91
 
92
92
  view_attributes(m).each do |key, value|
93
93
  message = "Model / Attribute: #{m.class.name}##{key}"
94
- byebug if m_json[key.to_s] != normalize_to_json(m, key, value)
95
94
  assert_equal m_json[key.to_s], normalize_to_json(m, key, value)
96
95
  end
97
96
 
@@ -12,13 +12,13 @@ includes.each do |inc, subinc|
12
12
 
13
13
  if collection
14
14
  partial = model_partial(association.klass)
15
- json.array! record.send(inc), partial: partial, as: :record, locals: { includes: subinc }
15
+ json.array! record.send(inc), partial: partial, as: partial.split('/').last, locals: { includes: subinc }
16
16
  else
17
17
  if record.send(inc).nil?
18
18
  json.set! association.klass.model_name.element, nil
19
19
  else
20
20
  partial = model_partial(record.send(inc))
21
- json.partial! partial, record: record.send(inc), includes: subinc
21
+ json.partial! partial, partial.split('/').last => record.send(inc), includes: subinc
22
22
  end
23
23
  end
24
24
  end
@@ -1 +1 @@
1
- json.array! instance_variable_get("@#{model.model_name.plural}"), partial: model_partial(model), as: :record, includes: includes
1
+ json.array! instance_variable_get("@#{model.model_name.plural}"), partial: model_partial(model), as: model_partial(model).split('/').last, includes: includes
@@ -1 +1,2 @@
1
- json.partial! model_partial(model), record: instance_variable_get("@#{model.model_name.singular}"), includes: includes
1
+ json.partial! model_partial(model), model_partial(model).split('/').last.to_sym => instance_variable_get("@#{model.model_name.singular}"), includes: includes
2
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standardapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Bracy
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: byebug
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
181
195
  description: StandardAPI makes it easy to expose a query interface for your Rails
182
196
  models
183
197
  email: