meducation_sdk 1.2.5 → 1.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a84843e7a9e3287fb6036a92fc892ccb3013e139
4
- data.tar.gz: aafeba10a53baeb9c440218bac4e38af72f8d667
3
+ metadata.gz: b0d5bc3f806d1bf7bbdd2e446a8cadc4b99fb81d
4
+ data.tar.gz: 3240fa5c42a3b8e09306109dc777270bb1d2dbf3
5
5
  SHA512:
6
- metadata.gz: 7bb2ad2455323da2ed02f4f43b57d448eecdfd032228630d1e9cb18ec7229e0b2f285d5658e580560ce87d3719579a555e84211445a78ab9f764373b3c06e386
7
- data.tar.gz: 3eb9a7ca95bf9c192e6cde8059ae6c2219d88766c41a9b3993bac210f54516fff78a6e912f6156c3017879ec6cd6001a0e6675b1c832e16e31a2befc872a8f6f
6
+ metadata.gz: 366800e0079db6bc71d493ccd6c7a0f8f80e0c1eb04bf45050f5ba40b8cd44ce47dc1a6d6c60b52fadd8df7e1122dabc06e0cf5e811f75af2cd036f066920232
7
+ data.tar.gz: 07f7a8885274d12b921200f80c3ba34d561dee8e8a7b04b8fa940868cc6f83a35fc4f9299246fa1cac247bd3872d7500ef92c1e30b77dcb49b5e79d0e8ef98f5
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- # 1.2.4 / 2014-02-11
1
+ # 1.2.6 / 2014-02-12
2
+ * [BUGFIX] Add boards and board items
3
+
4
+ # 1.2.5 / 2014-02-11
2
5
  * [BUGFIX] Fix problem with mocking new user email data
3
6
 
4
7
  # 1.2.4 / 2014-02-11
@@ -0,0 +1,27 @@
1
+ module MeducationSDK
2
+ class Board < Loquor::Resource
3
+ self.path = "/boards"
4
+
5
+ def owner
6
+ @owner ||= "MeducationSDK::#{owner_type.gsub("::", "")}".constantize.find(owner_id)
7
+ end
8
+
9
+ def created_by
10
+ @created_by ||= User.find(created_by_id)
11
+ end
12
+
13
+ end
14
+
15
+ class BoardMock < Board
16
+ extend Loquor::ResourceMock
17
+
18
+ self.attributes = {
19
+ id: 1,
20
+ created_by_id: 8,
21
+ owner_id: 5, owner_type: "Group",
22
+ name: "Greatest Board",
23
+ description: "This is the greatest board ever!!"
24
+ }
25
+ end
26
+ end
27
+
@@ -0,0 +1,31 @@
1
+ module MeducationSDK
2
+ class BoardItem < Loquor::Resource
3
+ self.path = "/board_items"
4
+
5
+ def item
6
+ @item ||= "MeducationSDK::#{item_type.gsub("::", "")}".constantize.find(item_id)
7
+ end
8
+
9
+ def board
10
+ @board ||= Board.find(board_id)
11
+ end
12
+
13
+ def user
14
+ @user ||= User.find(user_id)
15
+ end
16
+
17
+ end
18
+
19
+ class BoardItemMock < BoardItem
20
+ extend Loquor::ResourceMock
21
+
22
+ self.attributes = {
23
+ id: 1,
24
+ board_id: 8,
25
+ item_id: 5, item_type: "MediaFile",
26
+ user_id: 14
27
+ }
28
+ end
29
+ end
30
+
31
+
@@ -1,3 +1,3 @@
1
1
  module MeducationSDK
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.6"
3
3
  end
@@ -6,6 +6,8 @@ require "meducation_sdk/configuration"
6
6
  require "meducation_sdk/mocker"
7
7
 
8
8
  RESOURCES = %w{
9
+ board
10
+ board_item
9
11
  collection
10
12
  collection_section
11
13
  collection_topic
@@ -0,0 +1,28 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+ require File.expand_path('../../resource_test', __FILE__)
3
+
4
+ module MeducationSDK
5
+ class BoardItemTest < ResourceTest
6
+ test_resource(BoardItem, '/board_items')
7
+
8
+ def test_owner_calls_sdk
9
+ item = BoardItem.new(item_id: 2, item_type: "MediaFile")
10
+ MeducationSDK::MediaFile.expects(:find).with(2)
11
+ item.item
12
+ end
13
+
14
+ def test_user_calls_sdk
15
+ item = BoardItem.new(user_id: 2)
16
+ MeducationSDK::User.expects(:find).with(2)
17
+ item.user
18
+ end
19
+
20
+ def test_board_calls_sdk
21
+ item = BoardItem.new(board_id: 2)
22
+ MeducationSDK::Board.expects(:find).with(2)
23
+ item.board
24
+ end
25
+
26
+ end
27
+ end
28
+
@@ -0,0 +1,20 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+ require File.expand_path('../../resource_test', __FILE__)
3
+
4
+ module MeducationSDK
5
+ class BoardTest < ResourceTest
6
+ test_resource(Board, '/boards')
7
+
8
+ def test_owner_calls_sdk
9
+ board = Board.new(owner_id: 2, owner_type: "Group")
10
+ MeducationSDK::Group.expects(:find).with(2)
11
+ board.owner
12
+ end
13
+
14
+ def test_created_by_calls_sdk
15
+ board = Board.new(created_by_id: 2)
16
+ MeducationSDK::User.expects(:find).with(2)
17
+ board.created_by
18
+ end
19
+ end
20
+ end
@@ -11,10 +11,10 @@ module MeducationSDK
11
11
  comment.item
12
12
  end
13
13
 
14
- def test_item_calls_sdk
15
- comment = Comment.new(item_id: 2, item_type: "MediaFile")
16
- MeducationSDK::MediaFile.expects(:find).with(2)
17
- comment.item
14
+ def test_user_calls_sdk
15
+ comment = Comment.new(user_id: 2)
16
+ MeducationSDK::User.expects(:find).with(2)
17
+ comment.user
18
18
  end
19
19
  end
20
20
  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.5
4
+ version: 1.2.6
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 00:00:00.000000000 Z
11
+ date: 2014-02-12 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/board.rb
116
+ - lib/meducation_sdk/resources/board_item.rb
115
117
  - lib/meducation_sdk/resources/collection.rb
116
118
  - lib/meducation_sdk/resources/collection_section.rb
117
119
  - lib/meducation_sdk/resources/collection_topic.rb
@@ -146,6 +148,8 @@ files:
146
148
  - test/configuration_test.rb
147
149
  - test/mocker_test.rb
148
150
  - test/resource_test.rb
151
+ - test/resources/board_items_test.rb
152
+ - test/resources/board_test.rb
149
153
  - test/resources/collection_section_test.rb
150
154
  - test/resources/collection_test.rb
151
155
  - test/resources/collection_topic_test.rb
@@ -204,6 +208,8 @@ test_files:
204
208
  - test/configuration_test.rb
205
209
  - test/mocker_test.rb
206
210
  - test/resource_test.rb
211
+ - test/resources/board_items_test.rb
212
+ - test/resources/board_test.rb
207
213
  - test/resources/collection_section_test.rb
208
214
  - test/resources/collection_test.rb
209
215
  - test/resources/collection_topic_test.rb