meducation_sdk 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CHANGELOG.md +3 -0
- data/lib/meducation_sdk/configuration.rb +14 -6
- data/lib/meducation_sdk/resources/media_file.rb +8 -1
- data/lib/meducation_sdk/version.rb +1 -1
- data/test/configuration_test.rb +34 -0
- data/test/resources/media_file_test.rb +16 -0
- metadata +13 -11
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NGRjYjYyNjkzNTNiY2YyZTk2YzhkN2MyMzRlMzdmMTkyZWVjMWZhOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDNmNTEyMzQyODJhMmI3NDE2ZTNiMTdkOTM1NGM1N2EyNTM2MzNhYg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2ZhNzM0ODU2ZWIyZjJiYTJkMGNjNzhjOWQ1MGQyMGU0YjYzNmFjMjJiODI2
|
10
|
+
YjQ2ZGQ3ZmQwYjY0OWM5YTJmYjljMGQ4MTVjNmFkOTU4YWUxODZjYzg2NjVm
|
11
|
+
OTQ5MWE2NTE5ZjllMzM1OWEzM2FmMWFjODM2N2YzZGZkNDMxOGE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YzQzY2Y1MmJjYzA2OGM3ZDJlZWY0ZDhiYjRiNGJlMGY2ZjQ0NjEyZTNmODg5
|
14
|
+
ZTM4ZDVjMjgxN2UxYjQ5MjYzZGJmYTAxZmY2NjdiODQ5N2EyNzgwZmViNmI4
|
15
|
+
MzcxY2Y5NDM3YmY5ODc4ZjBlYzM2MjAyZjllOTU3YThmYzJhNDQ=
|
data/CHANGELOG.md
ADDED
@@ -6,17 +6,25 @@ module MeducationSDK
|
|
6
6
|
|
7
7
|
class Configuration
|
8
8
|
|
9
|
-
SETTINGS = [
|
10
|
-
:logger, :access_id, :secret_key, :endpoint
|
11
|
-
]
|
9
|
+
SETTINGS = [ :logger ]
|
12
10
|
|
13
11
|
attr_writer *SETTINGS
|
14
12
|
|
15
13
|
def initialize
|
16
|
-
Filum.config
|
17
|
-
|
14
|
+
Filum.config.logfile = "./log/loquor.log"
|
15
|
+
Loquor.config.endpoint = "http://www.meducation.net/system"
|
16
|
+
self.logger = Filum.logger
|
17
|
+
end
|
18
|
+
|
19
|
+
[:access_id, :secret_key, :endpoint].each do |setting|
|
20
|
+
define_method "#{setting}=" do |val|
|
21
|
+
Loquor.config.send("#{setting}=", val)
|
18
22
|
end
|
19
|
-
|
23
|
+
end
|
24
|
+
|
25
|
+
def logger=(val)
|
26
|
+
@logger = val
|
27
|
+
Loquor.config.logger = val
|
20
28
|
end
|
21
29
|
|
22
30
|
SETTINGS.each do |setting|
|
@@ -9,13 +9,20 @@ module MeducationSDK
|
|
9
9
|
def comments
|
10
10
|
@comments ||= ItemComment.where(item_id: id, item_type: "MediaFile")
|
11
11
|
end
|
12
|
+
|
13
|
+
module State
|
14
|
+
def self.uploaded; 1 end
|
15
|
+
def self.processing; 2 end
|
16
|
+
def self.available; 3 end
|
17
|
+
def self.redacted; 4 end
|
18
|
+
end
|
12
19
|
end
|
13
20
|
|
14
21
|
class MediaFileMock < MediaFile
|
15
22
|
extend Loquor::ResourceMock
|
16
23
|
|
17
24
|
self.attributes = {
|
18
|
-
id: 1,
|
25
|
+
id: 1,
|
19
26
|
user_id: 1,
|
20
27
|
title: "Abdominal Ultrasound Tutorial"
|
21
28
|
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module MeducationSDK
|
4
|
+
class ConfigurationTest < Minitest::Test
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
MeducationSDK.instance_variable_set("@config", nil)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_obtaining_singletion
|
12
|
+
refute MeducationSDK.config.nil?
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_block_syntax
|
16
|
+
test_key = "foobar-123-access"
|
17
|
+
MeducationSDK.config do |config|
|
18
|
+
config.access_id = test_key
|
19
|
+
end
|
20
|
+
assert_equal test_key, Loquor.config.access_id
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_endpoint_is_set_correctly
|
24
|
+
Configuration.new
|
25
|
+
assert_equal "http://www.meducation.net/system", Loquor.config.endpoint
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_access_id_proxies_to_loquor
|
29
|
+
access_id = "test-access-key"
|
30
|
+
MeducationSDK.config.access_id = access_id
|
31
|
+
assert_equal access_id, Loquor.config.access_id
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -10,5 +10,21 @@ module MeducationSDK
|
|
10
10
|
MeducationSDK::User.expects(:find).with(3)
|
11
11
|
media_file.user
|
12
12
|
end
|
13
|
+
|
14
|
+
def test_uploaded_state_is_correct
|
15
|
+
assert_equal 1, MeducationSDK::MediaFile::State.uploaded
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_processing_state_is_correct
|
19
|
+
assert_equal 2, MeducationSDK::MediaFile::State.processing
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_available_state_is_correct
|
23
|
+
assert_equal 3, MeducationSDK::MediaFile::State.available
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_redacted_state_is_correct
|
27
|
+
assert_equal 4, MeducationSDK::MediaFile::State.redacted
|
28
|
+
end
|
13
29
|
end
|
14
30
|
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: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '>='
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '>='
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -98,28 +98,28 @@ dependencies:
|
|
98
98
|
name: mocha
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - '>='
|
101
|
+
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - '>='
|
108
|
+
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - '>='
|
115
|
+
- - ! '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - '>='
|
122
|
+
- - ! '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: Meducation's SDK
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- .gitignore
|
133
133
|
- .travis.yml
|
134
|
+
- CHANGELOG.md
|
134
135
|
- CONTRIBUTING.md
|
135
136
|
- Gemfile
|
136
137
|
- LICENCE.md
|
@@ -150,6 +151,7 @@ files:
|
|
150
151
|
- lib/meducation_sdk/resources/user.rb
|
151
152
|
- lib/meducation_sdk/version.rb
|
152
153
|
- meducation_sdk.gemspec
|
154
|
+
- test/configuration_test.rb
|
153
155
|
- test/mocker_test.rb
|
154
156
|
- test/resource_test.rb
|
155
157
|
- test/resources/item_comment_test.rb
|
@@ -166,12 +168,12 @@ require_paths:
|
|
166
168
|
- lib
|
167
169
|
required_ruby_version: !ruby/object:Gem::Requirement
|
168
170
|
requirements:
|
169
|
-
- - '>='
|
171
|
+
- - ! '>='
|
170
172
|
- !ruby/object:Gem::Version
|
171
173
|
version: '0'
|
172
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
175
|
requirements:
|
174
|
-
- - '>='
|
176
|
+
- - ! '>='
|
175
177
|
- !ruby/object:Gem::Version
|
176
178
|
version: '0'
|
177
179
|
requirements: []
|
@@ -181,10 +183,10 @@ signing_key:
|
|
181
183
|
specification_version: 4
|
182
184
|
summary: The SDK for Meducation
|
183
185
|
test_files:
|
186
|
+
- test/configuration_test.rb
|
184
187
|
- test/mocker_test.rb
|
185
188
|
- test/resource_test.rb
|
186
189
|
- test/resources/item_comment_test.rb
|
187
190
|
- test/resources/media_file_test.rb
|
188
191
|
- test/resources/user_test.rb
|
189
192
|
- test/test_helper.rb
|
190
|
-
has_rdoc:
|