conglomerate 0.2.0 → 0.2.1

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: 39ff3bd7063846051708c677ab9f8c3c0ebe0d5d
4
- data.tar.gz: 24433fc68163aebbbf567868edc05e807a07cf88
3
+ metadata.gz: 79cf2a21f974567cdf55b0a1e273292306c96140
4
+ data.tar.gz: 882941211d941acbd16c88eefb0e51c0fad474bc
5
5
  SHA512:
6
- metadata.gz: 2bf22794559d3319db96ffe11989ef093eed2f3402dcc435c645220663dabbb140c980e9eb938163baa4ab0f0cf695bcf3c3d7dc019e9c562c95c9a98c5ae8f6
7
- data.tar.gz: a82de2fe1c7dd8e60cf911b32eb914a07ba258508af060407d86e1372183a583240b192cd66cc6379a16edcaaef026085e335a783e4f0396fd858bebe50da651
6
+ metadata.gz: 57d389ee559e86c32166f58fc6efbcc9a23d57a5c3dbadca1318ef0735ae366f46cea65ddc2f62bbf97014ee5bc363c21b6a107a6118e8e25d30a12676d4903f
7
+ data.tar.gz: 568b17ac4a3c9bb36ec93aa8133926d6d42f39c0407351692eaa5b3a458682067fd7d5e514f337e74f350ec501a09c3db0fca35293ded8bf99a670ab2fe73226
@@ -30,10 +30,14 @@ module Conglomerate
30
30
  end
31
31
 
32
32
  def apply_href(collection, proc: self.class._href, object: nil)
33
- if object
34
- collection.merge({"href" => context.instance_exec(object, &proc)})
33
+ if proc
34
+ if object
35
+ collection.merge({"href" => context.instance_exec(object, &proc)})
36
+ else
37
+ collection.merge({"href" => context.instance_eval(&proc)})
38
+ end
35
39
  else
36
- collection.merge({"href" => context.instance_eval(&proc)})
40
+ collection
37
41
  end
38
42
  end
39
43
 
@@ -189,7 +193,7 @@ module Conglomerate
189
193
  attr_writer :_href, :_item_href, :_queries, :_attributes, :_links
190
194
 
191
195
  def _href
192
- @_href || Proc.new { raise ArgumentError, "You must include an href" }
196
+ @_href || nil
193
197
  end
194
198
 
195
199
  def _item_href
@@ -1,3 +1,3 @@
1
1
  module Conglomerate
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -34,18 +34,11 @@ end
34
34
  class ConglomerateExtraTestSerializer
35
35
  include Conglomerate.serializer
36
36
 
37
- href { "" }
38
37
  attribute :id
39
38
  end
40
39
 
41
40
  class ConglomerateNullSerializer
42
41
  include Conglomerate.serializer
43
-
44
- href { "" }
45
- end
46
-
47
- class ConglomerateInvalidSerializer
48
- include Conglomerate.serializer
49
42
  end
50
43
 
51
44
  describe Conglomerate do
@@ -96,18 +89,12 @@ describe Conglomerate do
96
89
  ConglomerateNullSerializer.new(object, :context => context).serialize
97
90
  end
98
91
 
99
- let(:invalid_serializer) do
100
- ConglomerateInvalidSerializer.new(object, :context => context).serialize
101
- end
102
-
103
92
  let(:test_collection) { test_serializer["collection"] }
104
93
 
105
94
  let(:extra_test_collection) { extra_test_serializer["collection"] }
106
95
 
107
96
  let(:null_collection) { null_serializer["collection"] }
108
97
 
109
- let(:invalid_collection) { invalid_serializer["collection"] }
110
-
111
98
  describe "#version" do
112
99
  it "sets version to 1.0" do
113
100
  expect(null_collection["version"]).to eq("1.0")
@@ -120,8 +107,8 @@ describe Conglomerate do
120
107
  expect(test_collection["href"]).to eq("abc")
121
108
  end
122
109
 
123
- it "errors if no href given" do
124
- expect { invalid_collection["href"] }.to raise_error
110
+ it "isn't included if the href is nil" do
111
+ expect(null_collection["href"]).to be_nil
125
112
  end
126
113
  end
127
114
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conglomerate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Emmons