hangar 0.1.3 → 0.1.4

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: 00e3ca4a7ff8a99f24e0861983e9924dd2f11e0c
4
- data.tar.gz: b9450473a33e006118801bb872e779a1aa16d024
3
+ metadata.gz: 38c212290c63ba2b653e4f9191e15e332fa91e56
4
+ data.tar.gz: b266016d0680f3cf61c6756fe1a94f1b5602e482
5
5
  SHA512:
6
- metadata.gz: d6caac367be939b5859524e196a94cdd85e01cf03b31ede9f0394deb6e0601af62b35c7ddaa0a93e7884c1980a30db3c41913ee0ef3c8d06e374fa1ce2bc7686
7
- data.tar.gz: 56b555eff7d4e9fc13c03667381e0360faaa0d01080ea01a4aec5b949adf93ebf7b5412bc69f58423c3f936eb3207964e2417e8e1cc69a9060834463d75a0ff8
6
+ metadata.gz: 4f9b79f324377cdc234ce105ee6fa1d4c1b01c848de64a3908c0fef6d17014807e04de3746a747cef8fe192badc5af9899b953e1de57e610ee866723b76ddbef
7
+ data.tar.gz: 0c3ee3d211290ab0c0e4c9b3c93c8d001b3fedc76218eb70095ae5b3560709b5d950a74b1886face3d3b2f9871dce1044612a3ebf1187e1d4a925116a26e0c37
@@ -5,7 +5,7 @@ module Hangar
5
5
 
6
6
  def create
7
7
  created = FactoryBot.create resource, *traits, resource_attributes
8
- render json: created.as_json(include: includes.as_json)
8
+ render json: created.as_json(include: includes)
9
9
  end
10
10
 
11
11
  def new
@@ -29,7 +29,19 @@ module Hangar
29
29
  end
30
30
 
31
31
  def includes
32
- @includes ||= params[:include].blank? ? [] : params.require(:include)
32
+ @includes ||= begin
33
+ _includes = params.fetch(:include, {}).as_json
34
+
35
+ unless _includes.is_a?(Hash)
36
+ array_of_assocation_and_options_pairs = Array(_includes).flat_map do |n|
37
+ n.is_a?(Hash) ? n.to_a : [[n, {}]]
38
+ end
39
+
40
+ _includes = Hash[array_of_assocation_and_options_pairs]
41
+ end
42
+
43
+ _includes.deep_symbolize_keys
44
+ end
33
45
  end
34
46
 
35
47
  def error_render_method(exception)
@@ -1,3 +1,3 @@
1
1
  module Hangar
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hangar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Rossmeissl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-18 00:00:00.000000000 Z
11
+ date: 2018-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails