lc_api 1.1 → 1.2

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.
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
- options[:params] = (options[:params] || {}).merge({include: options[:include].join(",")})
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)
@@ -1,3 +1,3 @@
1
1
  module LcApi
2
- VERSION = "1.1"
2
+ VERSION = "1.2"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lc_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: