lc_api 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lc_api/base.rb +2 -5
- data/lib/lc_api/version.rb +1 -1
- data/spec/resources/message_spec.rb +8 -0
- data/spec/resources/series_spec.rb +8 -0
- metadata +1 -1
data/lib/lc_api/base.rb
CHANGED
@@ -10,11 +10,8 @@ module LcApi
|
|
10
10
|
scope = args.slice!(0)
|
11
11
|
options = args.slice!(0) || {}
|
12
12
|
|
13
|
-
if options.has_key? :include
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
|
13
|
+
options[:params] = (options[:params] || {}).merge({include: options[:include].join(",")}) if options.has_key? :include
|
14
|
+
options[:params] = (options[:params] || {}).merge({type: options[:type]}) if options.has_key? :type
|
18
15
|
options[:params] = (options[:params] || {}).merge({key: LcApi.key})
|
19
16
|
|
20
17
|
super(scope, options)
|
data/lib/lc_api/version.rb
CHANGED
@@ -33,6 +33,14 @@ describe LcApi::Message do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
describe "filtering by type" do
|
37
|
+
it "should include 'type=sermon' in the url" do
|
38
|
+
# If this test passes, that means the url below was correctly called, no need for any expects
|
39
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages.json?type=sermon&key=1111", :body => fixture('messages.json'))
|
40
|
+
LcApi::Message.find(:all, type: :sermon)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
36
44
|
describe "finding different formats" do
|
37
45
|
describe ".audio" do
|
38
46
|
it "returns the audio format" do
|
@@ -25,6 +25,14 @@ describe LcApi::Series do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
describe "filtering by type" do
|
29
|
+
it "should include 'type=sermon' in the url" do
|
30
|
+
# If this test passes, that means the url below was correctly called, no need for any expects
|
31
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/series.json?type=sermon&key=1111", :body => fixture('seriess.json'))
|
32
|
+
LcApi::Series.find(:all, type: :sermon)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
28
36
|
describe "the has_many messages and the message find_format methods" do
|
29
37
|
describe ".audio" do
|
30
38
|
it "returns the audio format" do
|