shogun 3.4.0 → 4.0.0

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: baef85e062e0f401dc69337927206fe08ea15913
4
- data.tar.gz: a4e4cb082dd8b3c7b50bed58eae1d7a6c74dc76a
3
+ metadata.gz: 5a13c92ba733fd72e94d508faf1a68b1e422fb63
4
+ data.tar.gz: 234b2edfa6cd05b942bf473373393e049da94534
5
5
  SHA512:
6
- metadata.gz: afc14b18bcaaabd78e8f0c9e292d994e77e85c5331e11ca09a8ffa30d7dc3d829a7d8bdb17601e2f2739df908cf803354cd8f8055bee7a91a923e9b2ebb6bb39
7
- data.tar.gz: fe8866312d0146cf3538a8f31299c3a0e1c7c1062e166645fd4a656389dc452280902fdd420d8d5ed2f9a4e860d823b477d3c20279a110cdcec1ce612baa5481
6
+ metadata.gz: bfcd32715980755c6f43700a8dc255b37e47ecd97b6102d12bf56ed368246a9311f8a3024d4f7e733a081a8c5a3eace42a5ff9a5bf86d80cb4127a850678e4e5
7
+ data.tar.gz: 0ef2da1e448489317249f13d22e6815e58a7d5d97414148b20faeeb6791a6bdcf19b06b9ef3468157065f3de7254d3ce047137a861cb10610b3657ec66ce9d27
@@ -16,12 +16,16 @@ module Shogun
16
16
  @meta
17
17
  end
18
18
 
19
- def linked
20
- @linked
21
- end
22
-
23
19
  def links
24
20
  @links.tap do |hash|
21
+ includes.each do |name|
22
+ hash.store(name, [host, name, "?#{name}=#{id}"].join("/"))
23
+ end
24
+ end
25
+ end
26
+
27
+ def linked
28
+ @linked.tap do |hash|
25
29
  includes.each do |name|
26
30
  case association(name).macro
27
31
  when :has_many
@@ -36,7 +40,7 @@ module Shogun
36
40
  end
37
41
 
38
42
  private def host
39
- ENV["API_HOST"]
43
+ ENV["SERVER_HOST"]
40
44
  end
41
45
 
42
46
  private def namespace
@@ -44,7 +48,11 @@ module Shogun
44
48
  end
45
49
 
46
50
  private def association(name)
47
- source.class.reflections[name.to_sym]
51
+ associations[name.to_sym]
52
+ end
53
+
54
+ private def associations
55
+ source.class.reflections
48
56
  end
49
57
 
50
58
  private def source
@@ -3,6 +3,7 @@ module Shogun
3
3
  include Enumerable
4
4
 
5
5
  def initialize(resources:, cast:, includes: [], meta: {}, links: {}, linked: {})
6
+ @cast = @cast
6
7
  @sources = resources.map do |resource|
7
8
  cast.new(resource: resource, includes: includes)
8
9
  end
@@ -24,7 +25,15 @@ module Shogun
24
25
  end
25
26
 
26
27
  def links
27
- @links
28
+ @links.tap do |hash|
29
+ includes.each do |name|
30
+ hash.store("#{namespace}.#{name}", [host, name, "{#{namespace}.#{name}}"].join("/"))
31
+ end
32
+ end
33
+ end
34
+
35
+ private def namespace
36
+ @cast.const_get("NAMESPACE")
28
37
  end
29
38
  end
30
39
  end
@@ -1,3 +1,3 @@
1
1
  module Shogun
2
- VERSION = "3.4.0"
2
+ VERSION = "4.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shogun
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-09 00:00:00.000000000 Z
11
+ date: 2014-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adamantium