active_public_resources 0.1.0 → 0.1.1

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: ea460bb501af9bbb08231a84510177ff3761ef52
4
- data.tar.gz: 68fb85e323706aee67764043f335d85278ded269
3
+ metadata.gz: 04458663975d9edb753ec8b0d61d6f1451a1621e
4
+ data.tar.gz: 059e0e5e7ddc3cec723c6eda3c3e511d7ef25f0a
5
5
  SHA512:
6
- metadata.gz: 321135a83f8c692fa0cb79cce1d14d7c47e47fff6bd137e91a6e1ad0f5cf9511497c5729dc2088aeb8b4bd25b81575b8beb382bf375b3d6298b0251c16270b28
7
- data.tar.gz: eb7a94808c82a9a89fc154a0aa7f4ea9d1a2e918937b30deec61b7f42ea8cee9046a4cc8e88bcada8040afc0b023799063e912fc4eb788938b3bef4e3f2a73e1
6
+ metadata.gz: b9637813305ee0238da49f3ff3d4ee98ba044663608147dde509bf9613b70e45034fc0273d910150de8b59d3b9c96bd0bf1cbe1e8d31dff4fc35d0381a244b39
7
+ data.tar.gz: 2c4dca99bdebc43a6d779b31d1d511b0a766fc19d888dd28e798bb6cf6f684b36195c356a1be384dcc973e4db148029eccf4e0468451334934daf23b92321981
data/README.md CHANGED
@@ -137,37 +137,47 @@ embed the video (iframe) or link to the video (url).
137
137
 
138
138
  ### File
139
139
 
140
+ * **driver** - name of driver used (e.g. vimeo, youtube, quizlet, etc.)
141
+ * **remote_id** - id of media provided by the driver
140
142
  * **url** - this is a URL to the file that can be retrieved without requiring any additional authentication (no sessions, cookies, etc.)
141
143
  * **text** - the filename
142
144
  * **content_type** - content or MIME type of the file to be retrieved
143
145
 
144
146
  ### IFrame
145
147
 
146
- * **url** - this is used as the 'src' attribute of the embedded iframe
147
- * **title** - this is used as the 'title' attribute of the embedded iframe
148
- * **width** - this is used as the 'width' style of the embedded iframe
149
- * **height** - this is used as the 'height' style of the embedded iframe
148
+ * **driver** - name of driver used (e.g. vimeo, youtube, quizlet, etc.)
149
+ * **remote_id** - id of media provided by the driver
150
+ * **url** - this is used as the 'src' attribute of the embedded iframe
151
+ * **title** - this is used as the 'title' attribute of the embedded iframe
152
+ * **width** - this is used as the 'width' style of the embedded iframe
153
+ * **height** - this is used as the 'height' style of the embedded iframe
150
154
 
151
155
  ### Image URL
152
156
 
153
- * **url** - this is used as the 'src' attribute of the embedded image tag
154
- * **text** - this is used as the 'alt' attribute of the embedded image tag
155
- * **width** - this is used as the 'width' style of the embedded image tag
156
- * **height** - this is used as the 'height' style of the embedded image tag
157
+ * **driver** - name of driver used (e.g. vimeo, youtube, quizlet, etc.)
158
+ * **remote_id** - id of media provided by the driver
159
+ * **url** - this is used as the 'src' attribute of the embedded image tag
160
+ * **text** - this is used as the 'alt' attribute of the embedded image tag
161
+ * **width** - this is used as the 'width' style of the embedded image tag
162
+ * **height** - this is used as the 'height' style of the embedded image tag
157
163
 
158
164
  ### OEmbed
159
165
 
160
- * **url** - this is the oEmbed resource URL
161
- * **endpoint** - this is the oEmbed API endpoint URL
166
+ * **driver** - name of driver used (e.g. vimeo, youtube, quizlet, etc.)
167
+ * **remote_id** - id of media provided by the driver
168
+ * **url** - this is the oEmbed resource URL
169
+ * **endpoint** - this is the oEmbed API endpoint URL
162
170
 
163
171
  ### URL
164
172
 
165
- * **url** - The url. Likely used as the 'href' attribute of the inserted link
166
- * **text** - this is the suggested text for the inserted link. If the user has already selected
167
- some content before opening this dialog, the link will wrap that content and this
168
- value may be ignored
169
- * **title** - this is used as the 'title' attribute of the inserted link
170
- * **target** - this is used as the 'target' attribute of the inserted link
173
+ * **driver** - name of driver used (e.g. vimeo, youtube, quizlet, etc.)
174
+ * **remote_id** - id of media provided by the driver
175
+ * **url** - The url. Likely used as the 'href' attribute of the inserted link
176
+ * **text** - this is the suggested text for the inserted link. If the user has already selected
177
+ some content before opening this dialog, the link will wrap that content and this
178
+ value may be ignored
179
+ * **title** - this is used as the 'title' attribute of the inserted link
180
+ * **target** - this is used as the 'target' attribute of the inserted link
171
181
 
172
182
  ## Drivers
173
183
 
@@ -1,4 +1,5 @@
1
1
  require "active_support"
2
+
2
3
  require "active_support/core_ext/object/blank"
3
4
  require "active_support/core_ext/string/inflections"
4
5
  require "active_model"
@@ -3,7 +3,7 @@ module ActivePublicResources
3
3
  class BaseReturnType
4
4
  include ::ActiveModel::Serialization
5
5
 
6
- attr_accessor :url, :return_type, :driver
6
+ attr_accessor :url, :return_type, :driver, :remote_id
7
7
 
8
8
  def initialize(args)
9
9
  args.each do |k,v|
@@ -96,12 +96,14 @@ module ActivePublicResources
96
96
  # Return Types
97
97
  video.return_types << APR::ReturnTypes::Url.new(
98
98
  :driver => DRIVER_NAME,
99
+ :media_id => data['youtube_id'],
99
100
  :url => video.url,
100
101
  :text => video.title,
101
102
  :title => video.title
102
103
  )
103
104
  video.return_types << APR::ReturnTypes::Iframe.new(
104
105
  :driver => DRIVER_NAME,
106
+ :remote_id => data['youtube_id'],
105
107
  :url => "https://www.youtube.com/embed/#{data['youtube_id']}?feature=oembed",
106
108
  :text => video.title,
107
109
  :title => video.title,
@@ -121,6 +123,7 @@ module ActivePublicResources
121
123
 
122
124
  exercise.return_types << APR::ReturnTypes::Url.new(
123
125
  :driver => DRIVER_NAME,
126
+ :remote_id => data['global_id'],
124
127
  :url => exercise.url,
125
128
  :text => exercise.title,
126
129
  :title => exercise.title
@@ -66,6 +66,7 @@ module ActivePublicResources
66
66
 
67
67
  quiz.return_types << APR::ReturnTypes::Url.new(
68
68
  :driver => DRIVER_NAME,
69
+ :remote_id => quiz.id,
69
70
  :url => quiz.url,
70
71
  :text => quiz.title,
71
72
  :title => quiz.title
@@ -80,7 +81,9 @@ module ActivePublicResources
80
81
  spacerace: "Space Race" }.each do |k,v|
81
82
 
82
83
  quiz.return_types << APR::ReturnTypes::Iframe.new(
83
- :url => "https://quizlet.com/#{data['id']}/#{k}/embedv2",
84
+ :driver => DRIVER_NAME,
85
+ :remote_id => quiz.id,
86
+ :url => "https://quizlet.com/#{quiz.id}/#{k}/embedv2",
84
87
  :text => v,
85
88
  :title => quiz.title,
86
89
  :width => "100%",
@@ -83,13 +83,15 @@ module ActivePublicResources
83
83
  # Return Types
84
84
  video.return_types << APR::ReturnTypes::Url.new(
85
85
  :driver => DRIVER_NAME,
86
+ :remote_id => video.id,
86
87
  :url => video.url,
87
88
  :text => video.title,
88
89
  :title => video.title
89
90
  )
90
91
  video.return_types << APR::ReturnTypes::Iframe.new(
91
92
  :driver => DRIVER_NAME,
92
- :url => "https://www.schooltube.com/embed/#{data['vkey']}",
93
+ :remote_id => video.id,
94
+ :url => "https://www.schooltube.com/embed/#{video.id}",
93
95
  :text => video.title,
94
96
  :title => video.title,
95
97
  :width => 640,
@@ -164,12 +164,14 @@ module ActivePublicResources
164
164
  # Return Types
165
165
  video.return_types << APR::ReturnTypes::Url.new(
166
166
  :driver => DRIVER_NAME,
167
+ :remote_id => video.id,
167
168
  :url => video.url,
168
169
  :text => video.title,
169
170
  :title => video.title
170
171
  )
171
172
  video.return_types << APR::ReturnTypes::Iframe.new(
172
173
  :driver => DRIVER_NAME,
174
+ :remote_id => video.id,
173
175
  :url => "https://player.vimeo.com/video/#{data['id']}",
174
176
  :text => video.title,
175
177
  :title => video.title,
@@ -97,13 +97,15 @@ module ActivePublicResources
97
97
  # Return Types
98
98
  video.return_types << APR::ReturnTypes::Url.new(
99
99
  :driver => DRIVER_NAME,
100
+ :remote_id => video.id,
100
101
  :url => video.url,
101
102
  :text => video.title,
102
103
  :title => video.title
103
104
  )
104
105
  video.return_types << APR::ReturnTypes::Iframe.new(
105
106
  :driver => DRIVER_NAME,
106
- :url => "https://www.youtube.com/embed/#{video_id}?feature=oembed",
107
+ :remote_id => video.id,
108
+ :url => "https://www.youtube.com/embed/#{video.id}?feature=oembed",
107
109
  :text => video.title,
108
110
  :title => video.title,
109
111
  :width => 640,
@@ -1,3 +1,3 @@
1
1
  module ActivePublicResources
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,16 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe APR::Drivers::Driver do
4
4
 
5
- it "should raises NotImplementedError" do
6
- class APR::Drivers::Foo < APR::Drivers::Driver
7
- end
8
- [:perform_request].each do |mthd|
9
- expect {
10
- APR::Drivers::Foo.new.send(mthd)
11
- }.to raise_error(NotImplementedError)
12
- end
13
- end
14
-
15
5
  it "should not raise error when methods are overridden" do
16
6
  class APR::Drivers::Foo < APR::Drivers::Driver
17
7
  def perform_request(*args); end
@@ -80,6 +80,7 @@ describe APR::Drivers::KhanAcademy do
80
80
 
81
81
  rt_iframe = video.return_types[1]
82
82
  rt_iframe.driver.should eq(APR::Drivers::KhanAcademy::DRIVER_NAME)
83
+ rt_iframe.remote_id.should eq('9KR1bad76qg')
83
84
  rt_iframe.return_type.should eq('iframe')
84
85
  rt_iframe.url.should eq("https://www.youtube.com/embed/9KR1bad76qg?feature=oembed")
85
86
  rt_url.title.should eq("Institutions")
@@ -98,6 +99,7 @@ describe APR::Drivers::KhanAcademy do
98
99
 
99
100
  ex_rt_url = exercise.return_types[0]
100
101
  ex_rt_url.driver.should eq(APR::Drivers::KhanAcademy::DRIVER_NAME)
102
+ ex_rt_url.remote_id.should eq('exd53ad0de')
101
103
  ex_rt_url.return_type.should eq('url')
102
104
  ex_rt_url.url.should eq("http://www.khanacademy.org/exercise/social-structures---passage-1")
103
105
  ex_rt_url.title.should eq("Social structures - Passage 1")
@@ -36,6 +36,7 @@ describe APR::Drivers::Quizlet do
36
36
  quiz.created_date.strftime("%Y-%m-%d").should eq("2013-05-25")
37
37
 
38
38
  quiz.return_types[0].driver.should eq(APR::Drivers::Quizlet::DRIVER_NAME)
39
+ quiz.return_types[0].remote_id.should eq(23752218)
39
40
  quiz.return_types.map(&:url).should eq([
40
41
  "http://quizlet.com/23752218/dogs-flash-cards/",
41
42
  "https://quizlet.com/23752218/flashcards/embedv2",
@@ -20,6 +20,7 @@ describe APR::Drivers::Schooltube do
20
20
  results.items.length.should eq(25)
21
21
 
22
22
  item = results.items.first
23
+ item.id.should eq('60f374fdba394a70b4ad')
23
24
  item.kind.should eq("video")
24
25
  item.title.should eq("Fun - Educational School Trips - Call American Tours & Travel")
25
26
  item.description.should match /customizing your next student/
@@ -34,6 +35,7 @@ describe APR::Drivers::Schooltube do
34
35
 
35
36
  rt_url = item.return_types[0]
36
37
  rt_url.driver.should eq(APR::Drivers::Schooltube::DRIVER_NAME)
38
+ rt_url.remote_id.should eq("60f374fdba394a70b4ad")
37
39
  rt_url.return_type.should eq('url')
38
40
  rt_url.url.should eq("http://bit.ly/pk3Sxs")
39
41
  rt_url.title.should eq("Fun - Educational School Trips - Call American Tours & Travel")
@@ -42,6 +44,7 @@ describe APR::Drivers::Schooltube do
42
44
  rt_iframe.return_type.should eq('iframe')
43
45
  rt_iframe.url.should eq("https://www.schooltube.com/embed/60f374fdba394a70b4ad")
44
46
  rt_iframe.driver.should eq(APR::Drivers::Schooltube::DRIVER_NAME)
47
+ rt_iframe.remote_id.should eq("60f374fdba394a70b4ad")
45
48
  rt_iframe.title.should eq("Fun - Educational School Trips - Call American Tours & Travel")
46
49
 
47
50
  item.width.should eq(640)
@@ -55,12 +55,14 @@ describe APR::Drivers::Vimeo do
55
55
 
56
56
  rt_url = item.return_types[0]
57
57
  rt_url.driver.should eq(APR::Drivers::Vimeo::DRIVER_NAME)
58
+ rt_url.remote_id.should eq("67741947")
58
59
  rt_url.return_type.should eq('url')
59
60
  rt_url.url.should eq("http://vimeo.com/67741947")
60
61
  rt_url.title.should eq("Kynect 'education'")
61
62
 
62
63
  rt_iframe = item.return_types[1]
63
64
  rt_iframe.driver.should eq(APR::Drivers::Vimeo::DRIVER_NAME)
65
+ rt_iframe.remote_id.should eq("67741947")
64
66
  rt_iframe.return_type.should eq('iframe')
65
67
  rt_iframe.url.should eq("https://player.vimeo.com/video/67741947")
66
68
  rt_url.title.should eq("Kynect 'education'")
@@ -36,12 +36,14 @@ describe APR::Drivers::Youtube do
36
36
 
37
37
  rt_url = item.return_types[0]
38
38
  rt_url.driver.should eq(APR::Drivers::Youtube::DRIVER_NAME)
39
+ rt_url.remote_id.should eq("y_ZmM7zPLyI")
39
40
  rt_url.return_type.should eq('url')
40
41
  rt_url.url.should eq("https://www.youtube.com/watch?v=y_ZmM7zPLyI&feature=youtube_gdata_player")
41
42
  rt_url.title.should eq("Why I Hate School But Love Education||Spoken Word")
42
43
 
43
44
  rt_iframe = item.return_types[1]
44
45
  rt_iframe.driver.should eq(APR::Drivers::Youtube::DRIVER_NAME)
46
+ rt_iframe.remote_id.should eq("y_ZmM7zPLyI")
45
47
  rt_iframe.return_type.should eq('iframe')
46
48
  rt_iframe.url.should eq("https://www.youtube.com/embed/y_ZmM7zPLyI?feature=oembed")
47
49
  rt_url.title.should eq("Why I Hate School But Love Education||Spoken Word")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_public_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Berry