helix 0.0.4.9.pre → 0.0.5.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/helix/base.rb +1 -0
- data/lib/helix/library.rb +6 -1
- data/spec/base_spec.rb +5 -0
- data/spec/library_spec.rb +10 -0
- data/spec/media_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTNmNDllNjZiNjY1OWRkZTE3OWEzNTZjN2I5ZjUwNzZmZDYyZjk4Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmUyOGZhY2UxYTMyYzU1MzU1YWEzYzRhMmViOWJmYTgzNjY0MWYxMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTk3ZGI1YjQyMDg4Y2EwOWFlNWZmNjljOTYxMDg4ZWQ1MjJjNDI4NTQ5MWM4
|
10
|
+
ZTgwNDU5ZDAzMWZjOWZkNzY5OGZkMmI2ZTUzNTU1YzhiYzFiYTgyYzMzNWE2
|
11
|
+
NTU0ZGZmNDY5ZGQ3M2ZiZDkxMzhhNTAxZTMyZjk2YTBjMmM3MmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTcxMGEwYTFjN2RkMDE3MjhlMjQ1YTg0YzQzNjYxYmE5NjhlZTYxYWNhY2Q3
|
14
|
+
MjQ5ZTU0YjY3ZGJlYmE0M2JkMzA2YWI2OWM4YmQwNmQxYWUxNWQ5YmE3ZGEz
|
15
|
+
YWYwNWY5YzZjZWRlMWQwMzVjNjFhMjJhMTc1NGRmYTk0ZDE3N2U=
|
data/lib/helix/base.rb
CHANGED
@@ -174,6 +174,7 @@ module Helix
|
|
174
174
|
|
175
175
|
def massage_raw_attrs(raw_attrs)
|
176
176
|
return raw_attrs['site'] if raw_attrs.respond_to?(:has_key?) && raw_attrs.has_key?('site')
|
177
|
+
return raw_attrs['library'] if raw_attrs.respond_to?(:has_key?) && raw_attrs.has_key?('library')
|
177
178
|
# FIXME: Albums JSON output is embedded as the only member of an Array.
|
178
179
|
proper_hash = raw_attrs.respond_to?(:has_key?) && raw_attrs.has_key?(guid_name)
|
179
180
|
proper_hash ? raw_attrs : raw_attrs.first
|
data/lib/helix/library.rb
CHANGED
@@ -10,7 +10,8 @@ module Helix
|
|
10
10
|
def self.create(attrs={}); super; end
|
11
11
|
|
12
12
|
def self.find(nickname, opts={})
|
13
|
-
|
13
|
+
default_opts = process_opts(opts)
|
14
|
+
super(nickname, opts.merge(default_opts))
|
14
15
|
end
|
15
16
|
|
16
17
|
# Creates a string that associates to the class id.
|
@@ -22,6 +23,10 @@ module Helix
|
|
22
23
|
def self.guid_name
|
23
24
|
"name"
|
24
25
|
end
|
26
|
+
|
27
|
+
def self.process_opts(opts)
|
28
|
+
{content_type: :xml}.merge(opts)
|
29
|
+
end
|
25
30
|
|
26
31
|
# The class name, to be used by supporting classes. Such as Config which uses
|
27
32
|
# this method as a way to build URLs.
|
data/spec/base_spec.rb
CHANGED
@@ -294,6 +294,11 @@ describe Helix::Base do
|
|
294
294
|
subject { obj.send(meth, raw_attrs) }
|
295
295
|
it { should eq(:site_contents) }
|
296
296
|
end
|
297
|
+
context "when given {'library' => :library_contents}" do
|
298
|
+
let(:raw_attrs) { {'library' => :library_contents} }
|
299
|
+
subject { obj.send(meth, raw_attrs) }
|
300
|
+
it { should eq(:library_contents) }
|
301
|
+
end
|
297
302
|
context "when given { guid_name => :the_val }" do
|
298
303
|
let(:raw_attrs) { { guid_name => :the_val } }
|
299
304
|
subject { obj.send(meth, raw_attrs) }
|
data/spec/library_spec.rb
CHANGED
@@ -26,6 +26,16 @@ describe Helix::Library do
|
|
26
26
|
[:destroy, :update].each do |crud_call|
|
27
27
|
it { should respond_to(crud_call) }
|
28
28
|
end
|
29
|
+
|
30
|
+
describe "#process_opts" do
|
31
|
+
context "opts has a key of content_type" do
|
32
|
+
it { subject.process_opts({content_type: :json}).should == {content_type: :json } }
|
33
|
+
end
|
34
|
+
context"when opts does not have a key of content type" do
|
35
|
+
it { subject.process_opts({}).should == {content_type: :xml } }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
29
39
|
end
|
30
40
|
|
31
41
|
end
|
data/spec/media_spec.rb
CHANGED
@@ -121,8 +121,9 @@ describe Helix::Media do
|
|
121
121
|
klass.stub(:attributes) { mock_attrs }
|
122
122
|
klass.stub(:guid_name) { guid_name }
|
123
123
|
klass.stub(:new) { mock_obj }
|
124
|
+
klass.stub(:process_opts) { {content_type: :xml} } if klass_sym[klass] == :library
|
124
125
|
end
|
125
|
-
context "and the guid is nil" do
|
126
|
+
context "and the guid is nil" do
|
126
127
|
it "should raise an ArgumentError complaining about a nil guid" do
|
127
128
|
msg = 'find requires a non-nil guid argument - received a nil argument.'
|
128
129
|
lambda { klass.send(meth, nil) }.should raise_error(ArgumentError, msg)
|
@@ -145,6 +146,7 @@ describe Helix::Media do
|
|
145
146
|
klass.stub(:attributes) { mock_attrs }
|
146
147
|
klass.stub(:guid_name) { guid_name }
|
147
148
|
klass.stub(:new) { mock_obj }
|
149
|
+
klass.stub(:process_opts) { {content_type: :xml} } if klass_sym[klass] == :library
|
148
150
|
end
|
149
151
|
context "and the guid is nil" do
|
150
152
|
it "should raise an ArgumentError complaining about a nil guid" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Twistage, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|