meducation_sdk 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/meducation_sdk/resources/collection.rb +28 -0
- data/lib/meducation_sdk/resources/collection_section.rb +27 -0
- data/lib/meducation_sdk/resources/collection_topic.rb +14 -6
- data/lib/meducation_sdk/version.rb +1 -1
- data/lib/meducation_sdk.rb +2 -0
- data/test/resources/collection_section_test.rb +9 -0
- data/test/resources/collection_test.rb +9 -0
- data/test/resources/collection_topic_test.rb +2 -2
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b643cc213f1f63326785abe8533f3d93d14677f1
|
4
|
+
data.tar.gz: 6647a725736653c8812f558998a5ae7cbd79930b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cac0dbe55601b4eeb3596bc8b8018932fb3c252f67a32bac65795e0aea261d3dbc747bc13be1fd1938177395b16e1b8f0f55bb890785d29c7d2364ec46397676
|
7
|
+
data.tar.gz: 4113d3b7eb473793004a269bd2a4c5482b19333928c62c7cf1764c007fc2800d54a3b9c27e5946b27daabbdde360f61b986fb0a978c5a044f3e68229da5eaa9e
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
module MeducationSDK
|
2
|
+
|
3
|
+
class Collection < Loquor::Resource
|
4
|
+
|
5
|
+
self.path = "/collections"
|
6
|
+
|
7
|
+
def sections
|
8
|
+
@sections ||= Section.where(collection_id: id)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class CollectionMock < Collection
|
14
|
+
extend Loquor::ResourceMock
|
15
|
+
|
16
|
+
self.attributes = {
|
17
|
+
id: 7,
|
18
|
+
title: 'This is a mock collection',
|
19
|
+
description: 'This is a sample description',
|
20
|
+
market_description: 'This is a sample market description',
|
21
|
+
section_ids: [2,3,4,5,6],
|
22
|
+
topic_ids: [1,2,3,4],
|
23
|
+
resource_ids: [9,8,7,6]
|
24
|
+
}
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module MeducationSDK
|
2
|
+
|
3
|
+
class CollectionSection < Loquor::Resource
|
4
|
+
|
5
|
+
self.path = "/collection_sections"
|
6
|
+
|
7
|
+
def topics
|
8
|
+
@topics ||= Section.where(section_id: id)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
class CollectionSectionMock < Collection
|
14
|
+
extend Loquor::ResourceMock
|
15
|
+
|
16
|
+
self.attributes = {
|
17
|
+
id: 463728,
|
18
|
+
title: 'This is a mock collection section',
|
19
|
+
description: 'This is a sample description',
|
20
|
+
collection_id: 1,
|
21
|
+
topic_ids: [1,2,4],
|
22
|
+
resource_ids: [9,8]
|
23
|
+
}
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module MeducationSDK
|
2
|
+
|
2
3
|
class CollectionTopic < Loquor::Resource
|
4
|
+
|
3
5
|
self.path = "/collection_topics"
|
4
6
|
|
5
7
|
def user
|
@@ -9,18 +11,24 @@ module MeducationSDK
|
|
9
11
|
def comments
|
10
12
|
@comments ||= Comment.where(id: comment_ids)
|
11
13
|
end
|
14
|
+
|
12
15
|
end
|
13
16
|
|
14
17
|
class CollectionTopicMock < CollectionTopic
|
15
18
|
extend Loquor::ResourceMock
|
16
19
|
|
17
20
|
self.attributes = {
|
18
|
-
id:
|
19
|
-
title:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
id: 728463,
|
22
|
+
title: 'This is a mock collection topic',
|
23
|
+
description: 'This is a sample description',
|
24
|
+
collection_id: 1,
|
25
|
+
section_id: 17,
|
26
|
+
resource_ids: [3, 4, 5],
|
27
|
+
views_in_last_30_days: 1,
|
28
|
+
views_in_last_60_days: 2,
|
29
|
+
rating: 123
|
24
30
|
}
|
31
|
+
|
25
32
|
end
|
33
|
+
|
26
34
|
end
|
data/lib/meducation_sdk.rb
CHANGED
@@ -6,8 +6,8 @@ module MeducationSDK
|
|
6
6
|
test_resource(CollectionTopic, '/collection_topics')
|
7
7
|
|
8
8
|
def test_comments_calls_sdk
|
9
|
-
topic = CollectionTopic.new(comment_ids: [7,8,9])
|
10
|
-
MeducationSDK::Comment.expects(:where).with(id: [7,8,9])
|
9
|
+
topic = CollectionTopic.new(comment_ids: [7, 8, 9])
|
10
|
+
MeducationSDK::Comment.expects(:where).with(id: [7, 8, 9])
|
11
11
|
topic.comments
|
12
12
|
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meducation_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -112,6 +112,8 @@ files:
|
|
112
112
|
- lib/meducation_sdk.rb
|
113
113
|
- lib/meducation_sdk/configuration.rb
|
114
114
|
- lib/meducation_sdk/mocker.rb
|
115
|
+
- lib/meducation_sdk/resources/collection.rb
|
116
|
+
- lib/meducation_sdk/resources/collection_section.rb
|
115
117
|
- lib/meducation_sdk/resources/collection_topic.rb
|
116
118
|
- lib/meducation_sdk/resources/comment.rb
|
117
119
|
- lib/meducation_sdk/resources/community.rb
|
@@ -142,6 +144,8 @@ files:
|
|
142
144
|
- test/configuration_test.rb
|
143
145
|
- test/mocker_test.rb
|
144
146
|
- test/resource_test.rb
|
147
|
+
- test/resources/collection_section_test.rb
|
148
|
+
- test/resources/collection_test.rb
|
145
149
|
- test/resources/collection_topic_test.rb
|
146
150
|
- test/resources/comment_test.rb
|
147
151
|
- test/resources/community_membership_test.rb
|
@@ -187,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
191
|
version: '0'
|
188
192
|
requirements: []
|
189
193
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.2.0
|
191
195
|
signing_key:
|
192
196
|
specification_version: 4
|
193
197
|
summary: The SDK for Meducation
|
@@ -196,6 +200,8 @@ test_files:
|
|
196
200
|
- test/configuration_test.rb
|
197
201
|
- test/mocker_test.rb
|
198
202
|
- test/resource_test.rb
|
203
|
+
- test/resources/collection_section_test.rb
|
204
|
+
- test/resources/collection_test.rb
|
199
205
|
- test/resources/collection_topic_test.rb
|
200
206
|
- test/resources/comment_test.rb
|
201
207
|
- test/resources/community_membership_test.rb
|
@@ -221,4 +227,3 @@ test_files:
|
|
221
227
|
- test/resources/user_settings_test.rb
|
222
228
|
- test/resources/user_test.rb
|
223
229
|
- test/test_helper.rb
|
224
|
-
has_rdoc:
|