shogun 2.1.1 → 3.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: dd1b08acc6a147b6ab44179c28906239ac5a13d2
4
- data.tar.gz: 465198a776d34f132b1fea6ed9a458f17b9accdd
3
+ metadata.gz: 0cba5f44740220ceed421671ca29aaf67451e1c8
4
+ data.tar.gz: 94496c87fe09aed639148d73f84ab094abe7db52
5
5
  SHA512:
6
- metadata.gz: dd26244a7c5bd904b194d0775f9ae8ed73284b752f0c0c02eeee21dad4a949aafdee830ccde331cacb8845f6897aba3550083454a1c5f163f890b90d4755c4f7
7
- data.tar.gz: 9ba3fb577d5992e37178e9251cf8da82587f22fe41fdf3b29cc0318ab1af425bac593ad817b96c25f86af9ffd904914a8a3856e46b69c458c3fe645d839776cc
6
+ metadata.gz: 4b6a4534a71e86e45934c7f049b3cc8e761061c71b796373d308a5406ea067a9749801e8568ccc9703e5c7e74f16125dcacbc84be7bfd5f7c579d38e5965d5a0
7
+ data.tar.gz: fb797d95f7f69233ad534fbb3c09270c01c02b076717b4ba18d8ed818dc14813f3d42b2de6245ccb165fec069f164b2e92ef1d151ccb4ffee768e25b003c5692
@@ -62,7 +62,6 @@ module Shogun
62
62
 
63
63
  require_relative "control/null"
64
64
 
65
-
66
65
  def to_a
67
66
  [status, headers, body]
68
67
  end
@@ -36,9 +36,33 @@ module Shogun
36
36
  ActiveRecord::LogSubscriber.logger = @logger
37
37
  ActiveRecord::LogSubscriber.colorize_logging = false
38
38
  ActiveRecord::Base.time_zone_aware_attributes = true
39
- ActiveRecord::Base.default_timezone = (self.class.const_get("TIMEZONE") || self.class.const_get("DEFAULT_TIMEZONE")).to_sym
39
+ ActiveRecord::Base.default_timezone = (timezone || default_timezone).to_sym
40
40
  ActiveRecord::Base.logger = @logger
41
- ActiveRecord::Base.establish_connection("#{self.class.const_get("URL")}?#{self.class.const_get("CONFIGURATION").to_query}")
41
+ ActiveRecord::Base.establish_connection(uri)
42
+ end
43
+
44
+ private def url
45
+ self.class.const_get("URL")
46
+ end
47
+
48
+ private def uri
49
+ "#{url}?#{query}"
50
+ end
51
+
52
+ private def query
53
+ configuration.to_query
54
+ end
55
+
56
+ private def configuration
57
+ self.class.const_get("CONFIGURATION")
58
+ end
59
+
60
+ private def timezone
61
+ self.class.const_get("TIMEZONE")
62
+ end
63
+
64
+ private def default_timezone
65
+ self.class.const_get("DEFAULT_TIMEZONE")
42
66
  end
43
67
  end
44
68
  end
@@ -14,7 +14,7 @@ module Shogun
14
14
 
15
15
  def as_document
16
16
  {
17
- document_key => document,
17
+ namespace => document,
18
18
  meta_key => @meta,
19
19
  links_key => @links,
20
20
  linked_key => @linked
@@ -31,8 +31,8 @@ module Shogun
31
31
  end
32
32
  end
33
33
 
34
- private def document_key
35
- self.class.const_get("DOCUMENT_KEY")
34
+ private def namespace
35
+ self.class.const_get("NAMESPACE")
36
36
  end
37
37
 
38
38
  private def meta_key
@@ -27,5 +27,9 @@ module Shogun
27
27
  private def metadata
28
28
  self.class.const_get("METADATA")
29
29
  end
30
+
31
+ private def namespace
32
+ self.class.const_get("NAMESPACE")
33
+ end
30
34
  end
31
35
  end
@@ -1,3 +1,3 @@
1
1
  module Shogun
2
- VERSION = "2.1.1"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -7,7 +7,7 @@ describe Shogun::Denormalizer do
7
7
  end
8
8
  end
9
9
  let(:denormalizer) { denormalizer_klass.new(object: presenter, fields: fields) }
10
- let(:document_key) { "accounts" }
10
+ let(:namespace) { "accounts" }
11
11
  let(:presenter) { instance_double("Presenter") }
12
12
  let(:links) { { "a" => "b" } }
13
13
  let(:meta) { { "c" => "d" } }
@@ -23,7 +23,7 @@ describe Shogun::Denormalizer do
23
23
  allow(presenter).to receive(:linked).and_return(linked)
24
24
  allow(presenter).to receive(:a).and_return(a)
25
25
  allow(presenter).to receive(:b).and_return(b)
26
- allow(denormalizer).to receive(:document_key).and_return(document_key)
26
+ allow(denormalizer).to receive(:namespace).and_return(namespace)
27
27
  allow(denormalizer).to receive(:mapping).and_return(mapping)
28
28
  end
29
29
 
@@ -46,8 +46,8 @@ describe Shogun::Denormalizer do
46
46
  expect(as_document).to have_key(Shogun::Denormalizer::LINKED_KEY)
47
47
  end
48
48
 
49
- it "contains the document key" do
50
- expect(as_document).to have_key(document_key)
49
+ it "contains the namespace key" do
50
+ expect(as_document).to have_key(namespace)
51
51
  end
52
52
  end
53
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shogun
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene