meducation_sdk 1.2.2 → 1.2.3

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: 705dd8122aa3d3f9e50991f56ac319b79bcfc7e3
4
- data.tar.gz: f41e39c51424c598df5e7e9fe1edfdd5b40afaaa
3
+ metadata.gz: 08a2b4afcd4cd3ee0d7c63d5437abb7e43b6f555
4
+ data.tar.gz: 9d62ed2deadafb2f5fd501c7f4e05558e3cfea13
5
5
  SHA512:
6
- metadata.gz: 0b7af6fc5a042945d8393d8b58e6a6cf067d6ac674ecaba9f6ba3cb257902a910b79cf4b232e07982435ba188541c0cf5b22d01dcb61a93ace49fdd0aa3dedad
7
- data.tar.gz: 882a7678004542aee1d442c87a10f9131d3883f092eccbc3623995a70b5837e69a62b5adcfdf5f5812246941722d294f0768f474f13a9e068897d2ba51f99cfc
6
+ metadata.gz: f165943b70f48c31fb7b27c92cfd1136c22da49dbdcf49b9db6f958c51fde010358b413de88537341f8e104d6d335fca039ffb89fa71fdf46fd816c6676d4f61
7
+ data.tar.gz: 0a3050e3bee662dcef70b4efc8ba5c1c8a6ddeeb4cd351d9ef10f17b405e074d62ca9ce7c4538ca65e1eac95513b4ced9e87da7537e2113006967e80ac889815
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.2.3 / 2014-02-06
2
+ * [FEATURE] Add votes
3
+
1
4
  # 1.2.2 / 2014-02-06
2
5
  * [FEATURE] Add short_display_name_to_user
3
6
 
@@ -0,0 +1,26 @@
1
+ module MeducationSDK
2
+ class Vote < Loquor::Resource
3
+ self.path = "/votes"
4
+
5
+ def item
6
+ @item ||= "MeducationSDK::#{item_type.gsub("::", "")}".constantize.find(item_id)
7
+ end
8
+
9
+ def user
10
+ @user ||= User.find(user_id)
11
+ end
12
+ end
13
+
14
+ class VoteMock < Vote
15
+ extend Loquor::ResourceMock
16
+
17
+ self.attributes = {
18
+ id: 1,
19
+ user_id: 8,
20
+ item_id: 5,
21
+ item_type: "MediaFile",
22
+ liked: true
23
+ }
24
+ end
25
+ end
26
+
@@ -1,3 +1,3 @@
1
1
  module MeducationSDK
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -32,6 +32,7 @@ RESOURCES = %w{
32
32
  syllabus_item
33
33
  user
34
34
  user_settings
35
+ vote
35
36
  }
36
37
  RESOURCES.each do |resource|
37
38
  require "meducation_sdk/resources/#{resource}"
@@ -0,0 +1,22 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+ require File.expand_path('../../resource_test', __FILE__)
3
+
4
+ module MeducationSDK
5
+ class VoteTest < ResourceTest
6
+ test_resource(Vote, '/votes')
7
+
8
+ def test_item_calls_sdk
9
+ vote = Vote.new(item_id: 2, item_type: "MediaFile")
10
+ MeducationSDK::MediaFile.expects(:find).with(2)
11
+ vote.item
12
+ end
13
+
14
+ def test_item_calls_sdk
15
+ vote = Vote.new(item_id: 2, item_type: "MediaFile")
16
+ MeducationSDK::MediaFile.expects(:find).with(2)
17
+ vote.item
18
+ end
19
+ end
20
+ end
21
+
22
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meducation_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
@@ -138,6 +138,7 @@ files:
138
138
  - lib/meducation_sdk/resources/syllabus_item.rb
139
139
  - lib/meducation_sdk/resources/user.rb
140
140
  - lib/meducation_sdk/resources/user_settings.rb
141
+ - lib/meducation_sdk/resources/vote.rb
141
142
  - lib/meducation_sdk/version.rb
142
143
  - meducation_sdk.gemspec
143
144
  - test/arbitary_test.rb
@@ -170,6 +171,7 @@ files:
170
171
  - test/resources/syllabus_item_test.rb
171
172
  - test/resources/user_settings_test.rb
172
173
  - test/resources/user_test.rb
174
+ - test/resources/vote_test.rb
173
175
  - test/test_helper.rb
174
176
  homepage: http://github.com/meducation/meducation_sdk
175
177
  licenses:
@@ -226,5 +228,6 @@ test_files:
226
228
  - test/resources/syllabus_item_test.rb
227
229
  - test/resources/user_settings_test.rb
228
230
  - test/resources/user_test.rb
231
+ - test/resources/vote_test.rb
229
232
  - test/test_helper.rb
230
233
  has_rdoc: