lc_api 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lc_api/message.rb +17 -0
- data/lib/lc_api/series.rb +1 -0
- data/lib/lc_api/version.rb +1 -1
- data/spec/fixtures/message.json +31 -0
- data/spec/fixtures/message_without_audio.json +25 -0
- data/spec/fixtures/messages.json +31 -0
- data/spec/fixtures/series.json +145 -0
- data/spec/fixtures/seriess.json +145 -0
- data/spec/lc_api_spec.rb +3 -0
- data/spec/resources/message_spec.rb +38 -4
- data/spec/resources/series_spec.rb +13 -3
- data/spec/spec_helper.rb +15 -1
- metadata +12 -2
data/lib/lc_api/message.rb
CHANGED
@@ -1,4 +1,21 @@
|
|
1
1
|
module LcApi
|
2
2
|
class Message < Base
|
3
|
+
def audio
|
4
|
+
find_format(:audio)
|
5
|
+
end
|
6
|
+
|
7
|
+
def high_quality_video
|
8
|
+
find_format(:high_quality_video)
|
9
|
+
end
|
10
|
+
|
11
|
+
def low_quality_video
|
12
|
+
find_format(:low_quality_video)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def find_format(name)
|
18
|
+
(self.formats.select {|f| f.name.downcase.gsub(/\s+/, "_") == name.to_s.downcase}).first
|
19
|
+
end
|
3
20
|
end
|
4
21
|
end
|
data/lib/lc_api/series.rb
CHANGED
data/lib/lc_api/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"id": 9267,
|
3
|
+
"title": "Your Habits",
|
4
|
+
"part": 4,
|
5
|
+
"length": null,
|
6
|
+
"series_id": 1096,
|
7
|
+
"speaker_id": 98,
|
8
|
+
"resources_url": null,
|
9
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/302831",
|
10
|
+
"date_released": "2014-01-26",
|
11
|
+
"formats": [
|
12
|
+
{
|
13
|
+
"name": "High quality video",
|
14
|
+
"url": "http://wistia.com/high_vid.mp4",
|
15
|
+
"content_length": null,
|
16
|
+
"type": "video"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"name": "Low quality video",
|
20
|
+
"url": "http://wistia.com/low_vid.mp4",
|
21
|
+
"content_length": null,
|
22
|
+
"type": "video"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"name": "Audio",
|
26
|
+
"url": "http://wistia.com/audio.mp3",
|
27
|
+
"content_length": null,
|
28
|
+
"type": "audio"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"id": 9267,
|
3
|
+
"title": "Your Habits",
|
4
|
+
"part": 4,
|
5
|
+
"length": null,
|
6
|
+
"series_id": 1096,
|
7
|
+
"speaker_id": 98,
|
8
|
+
"resources_url": null,
|
9
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/302831",
|
10
|
+
"date_released": "2014-01-26",
|
11
|
+
"formats": [
|
12
|
+
{
|
13
|
+
"name": "High quality video",
|
14
|
+
"url": "http://wistia.com/high_vid.mp4",
|
15
|
+
"content_length": null,
|
16
|
+
"type": "video"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"name": "Low quality video",
|
20
|
+
"url": "http://wistia.com/low_vid.mp4",
|
21
|
+
"content_length": null,
|
22
|
+
"type": "video"
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
[{
|
2
|
+
"id": 9267,
|
3
|
+
"title": "Your Habits",
|
4
|
+
"part": 4,
|
5
|
+
"length": null,
|
6
|
+
"series_id": 1096,
|
7
|
+
"speaker_id": 98,
|
8
|
+
"resources_url": null,
|
9
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/302831",
|
10
|
+
"date_released": "2014-01-26",
|
11
|
+
"formats": [
|
12
|
+
{
|
13
|
+
"name": "High quality video",
|
14
|
+
"url": null,
|
15
|
+
"content_length": null,
|
16
|
+
"type": "video"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"name": "Low quality video",
|
20
|
+
"url": null,
|
21
|
+
"content_length": null,
|
22
|
+
"type": "video"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"name": "Audio",
|
26
|
+
"url": null,
|
27
|
+
"content_length": null,
|
28
|
+
"type": "audio"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
}]
|
@@ -0,0 +1,145 @@
|
|
1
|
+
{
|
2
|
+
"id": 1096,
|
3
|
+
"title": "Small Things Big Difference",
|
4
|
+
"description": "Major resolutions and huge goals. We want big change and we want it now. But maybe taking life in a new direction has a lot more to do with the little things. Let's learn how to embrace intentionality in Small Things, Big Difference.",
|
5
|
+
"hashtag": null,
|
6
|
+
"slug": "small-things",
|
7
|
+
"parts": 4,
|
8
|
+
"promo": null,
|
9
|
+
"viewable": true,
|
10
|
+
"start_date": "2014-01-04",
|
11
|
+
"end_date": "2014-01-26",
|
12
|
+
"type": "Sermon",
|
13
|
+
"images": [
|
14
|
+
{
|
15
|
+
"name": "224x160",
|
16
|
+
"url": "http:\/\/s3.amazonaws.com\/lcapi.production\/series\/small-things\/224x160.jpg?1391467308"
|
17
|
+
}
|
18
|
+
],
|
19
|
+
"messages": [
|
20
|
+
{
|
21
|
+
"id": 9267,
|
22
|
+
"title": "Your Habits",
|
23
|
+
"part": 4,
|
24
|
+
"length": null,
|
25
|
+
"series_id": 1096,
|
26
|
+
"speaker_id": 98,
|
27
|
+
"resources_url": null,
|
28
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/302831",
|
29
|
+
"date_released": "2014-01-26",
|
30
|
+
"formats": [
|
31
|
+
{
|
32
|
+
"name": "High quality video",
|
33
|
+
"url": "http://wistia.com/high_vid.mp4",
|
34
|
+
"content_length": null,
|
35
|
+
"type": "video"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"name": "Low quality video",
|
39
|
+
"url": "http://wistia.com/low_vid.mp4",
|
40
|
+
"content_length": null,
|
41
|
+
"type": "video"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"name": "Audio",
|
45
|
+
"url": "http://wistia.com/audio.mp3",
|
46
|
+
"content_length": null,
|
47
|
+
"type": "audio"
|
48
|
+
}
|
49
|
+
]
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"id": 9266,
|
53
|
+
"title": "Your Words",
|
54
|
+
"part": 3,
|
55
|
+
"length": null,
|
56
|
+
"series_id": 1096,
|
57
|
+
"speaker_id": 98,
|
58
|
+
"resources_url": null,
|
59
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/300279",
|
60
|
+
"date_released": "2014-01-19",
|
61
|
+
"formats": [
|
62
|
+
{
|
63
|
+
"name": "High quality video",
|
64
|
+
"url": "http://wistia.com/high_vid.mp4",
|
65
|
+
"content_length": null,
|
66
|
+
"type": "video"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"name": "Low quality video",
|
70
|
+
"url": "http://wistia.com/low_vid.mp4",
|
71
|
+
"content_length": null,
|
72
|
+
"type": "video"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"name": "Audio",
|
76
|
+
"url": "http://wistia.com/audio.mp3",
|
77
|
+
"content_length": null,
|
78
|
+
"type": "audio"
|
79
|
+
}
|
80
|
+
]
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"id": 9265,
|
84
|
+
"title": "Your Thoughts",
|
85
|
+
"part": 2,
|
86
|
+
"length": null,
|
87
|
+
"series_id": 1096,
|
88
|
+
"speaker_id": 98,
|
89
|
+
"resources_url": null,
|
90
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/297880",
|
91
|
+
"date_released": "2014-01-12",
|
92
|
+
"formats": [
|
93
|
+
{
|
94
|
+
"name": "High quality video",
|
95
|
+
"url": "http://wistia.com/high_vid.mp4",
|
96
|
+
"content_length": null,
|
97
|
+
"type": "video"
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"name": "Low quality video",
|
101
|
+
"url": "http://wistia.com/low_vid.mp4",
|
102
|
+
"content_length": null,
|
103
|
+
"type": "video"
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"name": "Audio",
|
107
|
+
"url": "http://wistia.com/audio.mp3",
|
108
|
+
"content_length": null,
|
109
|
+
"type": "audio"
|
110
|
+
}
|
111
|
+
]
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"id": 9264,
|
115
|
+
"title": "Your One Word",
|
116
|
+
"part": 1,
|
117
|
+
"length": null,
|
118
|
+
"series_id": 1096,
|
119
|
+
"speaker_id": 98,
|
120
|
+
"resources_url": null,
|
121
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/293779",
|
122
|
+
"date_released": "2014-01-05",
|
123
|
+
"formats": [
|
124
|
+
{
|
125
|
+
"name": "High quality video",
|
126
|
+
"url": "http://wistia.com/high_vid.mp4",
|
127
|
+
"content_length": null,
|
128
|
+
"type": "video"
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"name": "Low quality video",
|
132
|
+
"url": "http://wistia.com/low_vid.mp4",
|
133
|
+
"content_length": null,
|
134
|
+
"type": "video"
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"name": "Audio",
|
138
|
+
"url": "http://wistia.com/audio.mp3",
|
139
|
+
"content_length": null,
|
140
|
+
"type": "audio"
|
141
|
+
}
|
142
|
+
]
|
143
|
+
}
|
144
|
+
]
|
145
|
+
}
|
@@ -0,0 +1,145 @@
|
|
1
|
+
[{
|
2
|
+
"id": 1096,
|
3
|
+
"title": "Small Things Big Difference",
|
4
|
+
"description": "Major resolutions and huge goals. We want big change and we want it now. But maybe taking life in a new direction has a lot more to do with the little things. Let's learn how to embrace intentionality in Small Things, Big Difference.",
|
5
|
+
"hashtag": null,
|
6
|
+
"slug": "small-things",
|
7
|
+
"parts": 4,
|
8
|
+
"promo": null,
|
9
|
+
"viewable": true,
|
10
|
+
"start_date": "2014-01-04",
|
11
|
+
"end_date": "2014-01-26",
|
12
|
+
"type": "Sermon",
|
13
|
+
"images": [
|
14
|
+
{
|
15
|
+
"name": "224x160",
|
16
|
+
"url": "http:\/\/s3.amazonaws.com\/lcapi.production\/series\/small-things\/224x160.jpg?1391467308"
|
17
|
+
}
|
18
|
+
],
|
19
|
+
"messages": [
|
20
|
+
{
|
21
|
+
"id": 9267,
|
22
|
+
"title": "Your Habits",
|
23
|
+
"part": 4,
|
24
|
+
"length": null,
|
25
|
+
"series_id": 1096,
|
26
|
+
"speaker_id": 98,
|
27
|
+
"resources_url": null,
|
28
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/302831",
|
29
|
+
"date_released": "2014-01-26",
|
30
|
+
"formats": [
|
31
|
+
{
|
32
|
+
"name": "High quality video",
|
33
|
+
"url": "http://wistia.com/high_vid.mp4",
|
34
|
+
"content_length": null,
|
35
|
+
"type": "video"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"name": "Low quality video",
|
39
|
+
"url": "http://wistia.com/low_vid.mp4",
|
40
|
+
"content_length": null,
|
41
|
+
"type": "video"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"name": "Audio",
|
45
|
+
"url": "http://wistia.com/audio.mp3",
|
46
|
+
"content_length": null,
|
47
|
+
"type": "audio"
|
48
|
+
}
|
49
|
+
]
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"id": 9266,
|
53
|
+
"title": "Your Words",
|
54
|
+
"part": 3,
|
55
|
+
"length": null,
|
56
|
+
"series_id": 1096,
|
57
|
+
"speaker_id": 98,
|
58
|
+
"resources_url": null,
|
59
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/300279",
|
60
|
+
"date_released": "2014-01-19",
|
61
|
+
"formats": [
|
62
|
+
{
|
63
|
+
"name": "High quality video",
|
64
|
+
"url": "http://wistia.com/high_vid.mp4",
|
65
|
+
"content_length": null,
|
66
|
+
"type": "video"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"name": "Low quality video",
|
70
|
+
"url": "http://wistia.com/low_vid.mp4",
|
71
|
+
"content_length": null,
|
72
|
+
"type": "video"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"name": "Audio",
|
76
|
+
"url": "http://wistia.com/audio.mp3",
|
77
|
+
"content_length": null,
|
78
|
+
"type": "audio"
|
79
|
+
}
|
80
|
+
]
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"id": 9265,
|
84
|
+
"title": "Your Thoughts",
|
85
|
+
"part": 2,
|
86
|
+
"length": null,
|
87
|
+
"series_id": 1096,
|
88
|
+
"speaker_id": 98,
|
89
|
+
"resources_url": null,
|
90
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/297880",
|
91
|
+
"date_released": "2014-01-12",
|
92
|
+
"formats": [
|
93
|
+
{
|
94
|
+
"name": "High quality video",
|
95
|
+
"url": "http://wistia.com/high_vid.mp4",
|
96
|
+
"content_length": null,
|
97
|
+
"type": "video"
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"name": "Low quality video",
|
101
|
+
"url": "http://wistia.com/low_vid.mp4",
|
102
|
+
"content_length": null,
|
103
|
+
"type": "video"
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"name": "Audio",
|
107
|
+
"url": "http://wistia.com/audio.mp3",
|
108
|
+
"content_length": null,
|
109
|
+
"type": "audio"
|
110
|
+
}
|
111
|
+
]
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"id": 9264,
|
115
|
+
"title": "Your One Word",
|
116
|
+
"part": 1,
|
117
|
+
"length": null,
|
118
|
+
"series_id": 1096,
|
119
|
+
"speaker_id": 98,
|
120
|
+
"resources_url": null,
|
121
|
+
"youversionlive_id": "http:\/\/m.youversion.com\/events\/293779",
|
122
|
+
"date_released": "2014-01-05",
|
123
|
+
"formats": [
|
124
|
+
{
|
125
|
+
"name": "High quality video",
|
126
|
+
"url": "http://wistia.com/high_vid.mp4",
|
127
|
+
"content_length": null,
|
128
|
+
"type": "video"
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"name": "Low quality video",
|
132
|
+
"url": "http://wistia.com/low_vid.mp4",
|
133
|
+
"content_length": null,
|
134
|
+
"type": "video"
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"name": "Audio",
|
138
|
+
"url": "http://wistia.com/audio.mp3",
|
139
|
+
"content_length": null,
|
140
|
+
"type": "audio"
|
141
|
+
}
|
142
|
+
]
|
143
|
+
}
|
144
|
+
]
|
145
|
+
}]
|
data/spec/lc_api_spec.rb
CHANGED
@@ -6,6 +6,9 @@ describe LcApi do
|
|
6
6
|
expect(LcApi.key).to eq "1111"
|
7
7
|
end
|
8
8
|
|
9
|
+
#this test will fail randomly if you use fakeweb inside of a 'describe'
|
10
|
+
#block instead of an 'it' block. there will be a trailing slash, not sure
|
11
|
+
#why this happens
|
9
12
|
it "should set the site" do
|
10
13
|
expect(LcApi::Base.site.to_s).to eq SITE_URL
|
11
14
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe LcApi::Message do
|
4
4
|
describe "returning all messages" do
|
5
5
|
it "should grab a collection of messages" do
|
6
|
-
FakeWeb.register_uri(:get, "#{SITE_URL}/messages.json?key=1111", :body =>
|
6
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages.json?key=1111", :body => fixture('messages.json'))
|
7
7
|
@messages = LcApi::Message.find(:all)
|
8
8
|
expect(@messages.class).to eq ActiveResource::Collection
|
9
9
|
end
|
@@ -11,7 +11,7 @@ describe LcApi::Message do
|
|
11
11
|
|
12
12
|
describe "returning a single message" do
|
13
13
|
it "should return a message" do
|
14
|
-
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?key=1111", :body =>
|
14
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?key=1111", :body => fixture('message.json'))
|
15
15
|
@message = LcApi::Message.find(2)
|
16
16
|
expect(@message.class).to eq LcApi::Message
|
17
17
|
end
|
@@ -20,7 +20,7 @@ describe LcApi::Message do
|
|
20
20
|
describe "including the series info" do
|
21
21
|
it "should include 'series' in the url" do
|
22
22
|
# If this test passes, that means the url below was correctly called, no need for any expects
|
23
|
-
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?include=series&key=1111", :body =>
|
23
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?include=series&key=1111", :body => fixture('message.json'))
|
24
24
|
LcApi::Message.find(2, include: [:series])
|
25
25
|
end
|
26
26
|
end
|
@@ -28,8 +28,42 @@ describe LcApi::Message do
|
|
28
28
|
describe "including the speaker info" do
|
29
29
|
it "should include 'speaker' in the url" do
|
30
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}/messages/2.json?include=speaker&key=1111", :body =>
|
31
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?include=speaker&key=1111", :body => fixture('message.json'))
|
32
32
|
LcApi::Message.find(2, include: [:speaker])
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
describe "finding different formats" do
|
37
|
+
describe ".audio" do
|
38
|
+
it "returns the audio format" do
|
39
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?key=1111", :body => fixture('message.json'))
|
40
|
+
message = LcApi::Message.find(2)
|
41
|
+
expect(message.audio.url.should).to eq "http://wistia.com/audio.mp3"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe ".high_quality_video" do
|
46
|
+
it "returns the high quality format" do
|
47
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?key=1111", :body => fixture('message.json'))
|
48
|
+
message = LcApi::Message.find(2)
|
49
|
+
expect(message.high_quality_video.url).to eq("http://wistia.com/high_vid.mp4")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe ".low_quality_video" do
|
54
|
+
it "returns the low quality format" do
|
55
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?key=1111", :body => fixture('message.json'))
|
56
|
+
message = LcApi::Message.find(2)
|
57
|
+
expect(message.low_quality_video.url).to eq("http://wistia.com/low_vid.mp4")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "when a format is missing" do
|
62
|
+
it "returns nil" do
|
63
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/messages/2.json?key=1111", :body => fixture('message_without_audio.json'))
|
64
|
+
message = LcApi::Message.find(2)
|
65
|
+
expect(message.audio).to eq nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
35
69
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe LcApi::Series do
|
4
4
|
describe "returning all series" do
|
5
5
|
it "should grab a collection of series" do
|
6
|
-
FakeWeb.register_uri(:get, "#{SITE_URL}/series.json?key=1111", :body =>
|
6
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/series.json?key=1111", :body => fixture("seriess.json"))
|
7
7
|
@series = LcApi::Series.find(:all)
|
8
8
|
expect(@series.class).to eq ActiveResource::Collection
|
9
9
|
end
|
@@ -11,7 +11,7 @@ describe LcApi::Series do
|
|
11
11
|
|
12
12
|
describe "returning a single series" do
|
13
13
|
it "should return a series" do
|
14
|
-
FakeWeb.register_uri(:get, "#{SITE_URL}/series/2.json?key=1111", :body =>
|
14
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/series/2.json?key=1111", :body => fixture("series.json"))
|
15
15
|
@series = LcApi::Series.find(2)
|
16
16
|
expect(@series.class).to eq LcApi::Series
|
17
17
|
end
|
@@ -20,8 +20,18 @@ describe LcApi::Series do
|
|
20
20
|
describe "including the messages info" do
|
21
21
|
it "should include 'messages' in the url" do
|
22
22
|
# If this test passes, that means the url below was correctly called, no need for any expects
|
23
|
-
FakeWeb.register_uri(:get, "#{SITE_URL}/series/2.json?include=messages&key=1111", :body =>
|
23
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/series/2.json?include=messages&key=1111", :body => fixture("series.json"))
|
24
24
|
LcApi::Series.find(2, include: [:messages])
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
describe "the has_many messages and the message find_format methods" do
|
29
|
+
describe ".audio" do
|
30
|
+
it "returns the audio format" do
|
31
|
+
FakeWeb.register_uri(:get, "#{SITE_URL}/series/2.json?include=messages&key=1111", :body => fixture("series.json"))
|
32
|
+
series = LcApi::Series.find(2, include: [:messages])
|
33
|
+
expect(series.messages.first.audio.url).to eq "http://wistia.com/audio.mp3"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
27
37
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,4 +2,18 @@ require 'lc_api'
|
|
2
2
|
require 'fakeweb'
|
3
3
|
FakeWeb.allow_net_connect = false
|
4
4
|
LcApi.key = "1111"
|
5
|
-
SITE_URL = "http://lctv-api.herokuapp.com/v1"
|
5
|
+
SITE_URL = "http://lctv-api.herokuapp.com/v1"
|
6
|
+
|
7
|
+
def fixture_path
|
8
|
+
File.expand_path("../fixtures", __FILE__)
|
9
|
+
end
|
10
|
+
|
11
|
+
def fixture(file)
|
12
|
+
File.new(File.join(fixture_path, '/', file))
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.expect_with :rspec do |c|
|
17
|
+
c.syntax = [:should, :expect]
|
18
|
+
end
|
19
|
+
end
|
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.
|
4
|
+
version: '1.1'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activeresource
|
@@ -110,6 +110,11 @@ files:
|
|
110
110
|
- lib/lc_api/message.rb
|
111
111
|
- lib/lc_api/series.rb
|
112
112
|
- lib/lc_api/version.rb
|
113
|
+
- spec/fixtures/message.json
|
114
|
+
- spec/fixtures/message_without_audio.json
|
115
|
+
- spec/fixtures/messages.json
|
116
|
+
- spec/fixtures/series.json
|
117
|
+
- spec/fixtures/seriess.json
|
113
118
|
- spec/lc_api_spec.rb
|
114
119
|
- spec/resources/location_spec.rb
|
115
120
|
- spec/resources/message_spec.rb
|
@@ -141,6 +146,11 @@ signing_key:
|
|
141
146
|
specification_version: 3
|
142
147
|
summary: LC API
|
143
148
|
test_files:
|
149
|
+
- spec/fixtures/message.json
|
150
|
+
- spec/fixtures/message_without_audio.json
|
151
|
+
- spec/fixtures/messages.json
|
152
|
+
- spec/fixtures/series.json
|
153
|
+
- spec/fixtures/seriess.json
|
144
154
|
- spec/lc_api_spec.rb
|
145
155
|
- spec/resources/location_spec.rb
|
146
156
|
- spec/resources/message_spec.rb
|