active_public_resources 0.0.5 → 0.1.0

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: 8d94da6bf6d98a2df49cf5926e172f1b305eaa93
4
- data.tar.gz: acc6e80bc6de3c4a10b1d58cf647e766652e706d
3
+ metadata.gz: ea460bb501af9bbb08231a84510177ff3761ef52
4
+ data.tar.gz: 68fb85e323706aee67764043f335d85278ded269
5
5
  SHA512:
6
- metadata.gz: 5165bfcd7899db6749812002df5d01b8703fcb236bc5944d571769c394de263be57a7ea05e4cf50dc8d22b1bdb9bcbe47866a075c511cc14f370aaad5cce480b
7
- data.tar.gz: d69c267f299c135c7ef2fd069c0e30c31bfcc3be60148bdf1536f5e2d9b8980d574d609ce300da9fa49b520e5946267409e022c890711dbfcd962bcc02bf697a
6
+ metadata.gz: 321135a83f8c692fa0cb79cce1d14d7c47e47fff6bd137e91a6e1ad0f5cf9511497c5729dc2088aeb8b4bd25b81575b8beb382bf375b3d6298b0251c16270b28
7
+ data.tar.gz: eb7a94808c82a9a89fc154a0aa7f4ea9d1a2e918937b30deec61b7f42ea8cee9046a4cc8e88bcada8040afc0b023799063e912fc4eb788938b3bef4e3f2a73e1
@@ -14,4 +14,4 @@ module ActivePublicResources
14
14
  end
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -3,7 +3,7 @@ module ActivePublicResources
3
3
  class BaseReturnType
4
4
  include ::ActiveModel::Serialization
5
5
 
6
- attr_accessor :url, :return_type
6
+ attr_accessor :url, :return_type, :driver
7
7
 
8
8
  def initialize(args)
9
9
  args.each do |k,v|
@@ -16,4 +16,4 @@ module ActivePublicResources
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -4,6 +4,7 @@ module ActivePublicResources
4
4
  module Drivers
5
5
  class KhanAcademy < Driver
6
6
 
7
+ DRIVER_NAME = "khan_academy"
7
8
  BASE_URL = "https://www.khanacademy.org/api/v1/"
8
9
 
9
10
  def perform_request(request_criteria)
@@ -94,11 +95,13 @@ module ActivePublicResources
94
95
 
95
96
  # Return Types
96
97
  video.return_types << APR::ReturnTypes::Url.new(
98
+ :driver => DRIVER_NAME,
97
99
  :url => video.url,
98
100
  :text => video.title,
99
101
  :title => video.title
100
102
  )
101
103
  video.return_types << APR::ReturnTypes::Iframe.new(
104
+ :driver => DRIVER_NAME,
102
105
  :url => "https://www.youtube.com/embed/#{data['youtube_id']}?feature=oembed",
103
106
  :text => video.title,
104
107
  :title => video.title,
@@ -117,6 +120,7 @@ module ActivePublicResources
117
120
  exercise.url = data['ka_url']
118
121
 
119
122
  exercise.return_types << APR::ReturnTypes::Url.new(
123
+ :driver => DRIVER_NAME,
120
124
  :url => exercise.url,
121
125
  :text => exercise.title,
122
126
  :title => exercise.title
@@ -3,6 +3,8 @@ require 'net/https'
3
3
  module ActivePublicResources
4
4
  module Drivers
5
5
  class Quizlet < Driver
6
+
7
+ DRIVER_NAME = "quizlet"
6
8
 
7
9
  def initialize(config_options={})
8
10
  validate_options(config_options, [:client_id])
@@ -63,6 +65,7 @@ module ActivePublicResources
63
65
  # Return Types
64
66
 
65
67
  quiz.return_types << APR::ReturnTypes::Url.new(
68
+ :driver => DRIVER_NAME,
66
69
  :url => quiz.url,
67
70
  :text => quiz.title,
68
71
  :title => quiz.title
@@ -4,6 +4,8 @@ module ActivePublicResources
4
4
  module Drivers
5
5
  class Schooltube < Driver
6
6
 
7
+ DRIVER_NAME="schooltube"
8
+
7
9
  def perform_request(request_criteria)
8
10
  request_criteria.validate_presence!([:query])
9
11
  uri = URI('http://www.schooltube.com/api/v1/video/search/')
@@ -80,11 +82,13 @@ module ActivePublicResources
80
82
 
81
83
  # Return Types
82
84
  video.return_types << APR::ReturnTypes::Url.new(
85
+ :driver => DRIVER_NAME,
83
86
  :url => video.url,
84
87
  :text => video.title,
85
88
  :title => video.title
86
89
  )
87
90
  video.return_types << APR::ReturnTypes::Iframe.new(
91
+ :driver => DRIVER_NAME,
88
92
  :url => "https://www.schooltube.com/embed/#{data['vkey']}",
89
93
  :text => video.title,
90
94
  :title => video.title,
@@ -5,6 +5,7 @@ module ActivePublicResources
5
5
  class Vimeo < Driver
6
6
  attr_reader :client
7
7
 
8
+ DRIVER_NAME = "vimeo"
8
9
  DEFAULT_CRITERIA = {
9
10
  :page => 1,
10
11
  :per_page => 25,
@@ -162,11 +163,13 @@ module ActivePublicResources
162
163
 
163
164
  # Return Types
164
165
  video.return_types << APR::ReturnTypes::Url.new(
166
+ :driver => DRIVER_NAME,
165
167
  :url => video.url,
166
168
  :text => video.title,
167
169
  :title => video.title
168
170
  )
169
171
  video.return_types << APR::ReturnTypes::Iframe.new(
172
+ :driver => DRIVER_NAME,
170
173
  :url => "https://player.vimeo.com/video/#{data['id']}",
171
174
  :text => video.title,
172
175
  :title => video.title,
@@ -4,6 +4,8 @@ module ActivePublicResources
4
4
  module Drivers
5
5
  class Youtube < Driver
6
6
 
7
+ DRIVER_NAME = "youtube"
8
+
7
9
  def perform_request(request_criteria)
8
10
  request_criteria.validate_presence!([:query])
9
11
 
@@ -94,11 +96,13 @@ module ActivePublicResources
94
96
 
95
97
  # Return Types
96
98
  video.return_types << APR::ReturnTypes::Url.new(
99
+ :driver => DRIVER_NAME,
97
100
  :url => video.url,
98
101
  :text => video.title,
99
102
  :title => video.title
100
103
  )
101
104
  video.return_types << APR::ReturnTypes::Iframe.new(
105
+ :driver => DRIVER_NAME,
102
106
  :url => "https://www.youtube.com/embed/#{video_id}?feature=oembed",
103
107
  :text => video.title,
104
108
  :title => video.title,
@@ -1,3 +1,3 @@
1
1
  module ActivePublicResources
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -45,4 +45,4 @@ describe APR::Drivers::Driver do
45
45
  end
46
46
  end
47
47
 
48
- end
48
+ end
@@ -73,11 +73,13 @@ describe APR::Drivers::KhanAcademy do
73
73
  video.username.should eq("Sydney Brown")
74
74
 
75
75
  rt_url = video.return_types[0]
76
+ rt_url.driver.should eq(APR::Drivers::KhanAcademy::DRIVER_NAME)
76
77
  rt_url.return_type.should eq('url')
77
78
  rt_url.url.should eq("http://www.youtube.com/watch?v=9KR1bad76qg&feature=youtube_gdata_player")
78
79
  rt_url.title.should eq("Institutions")
79
80
 
80
81
  rt_iframe = video.return_types[1]
82
+ rt_iframe.driver.should eq(APR::Drivers::KhanAcademy::DRIVER_NAME)
81
83
  rt_iframe.return_type.should eq('iframe')
82
84
  rt_iframe.url.should eq("https://www.youtube.com/embed/9KR1bad76qg?feature=oembed")
83
85
  rt_url.title.should eq("Institutions")
@@ -95,6 +97,7 @@ describe APR::Drivers::KhanAcademy do
95
97
  exercise.url.should eq("http://www.khanacademy.org/exercise/social-structures---passage-1")
96
98
 
97
99
  ex_rt_url = exercise.return_types[0]
100
+ ex_rt_url.driver.should eq(APR::Drivers::KhanAcademy::DRIVER_NAME)
98
101
  ex_rt_url.return_type.should eq('url')
99
102
  ex_rt_url.url.should eq("http://www.khanacademy.org/exercise/social-structures---passage-1")
100
103
  ex_rt_url.title.should eq("Social structures - Passage 1")
@@ -103,4 +106,4 @@ describe APR::Drivers::KhanAcademy do
103
106
  end
104
107
  end
105
108
 
106
- end
109
+ end
@@ -35,6 +35,7 @@ describe APR::Drivers::Quizlet do
35
35
  quiz.url.should eq("http://quizlet.com/23752218/dogs-flash-cards/")
36
36
  quiz.created_date.strftime("%Y-%m-%d").should eq("2013-05-25")
37
37
 
38
+ quiz.return_types[0].driver.should eq(APR::Drivers::Quizlet::DRIVER_NAME)
38
39
  quiz.return_types.map(&:url).should eq([
39
40
  "http://quizlet.com/23752218/dogs-flash-cards/",
40
41
  "https://quizlet.com/23752218/flashcards/embedv2",
@@ -47,4 +48,4 @@ describe APR::Drivers::Quizlet do
47
48
  end
48
49
  end
49
50
 
50
- end
51
+ end
@@ -33,6 +33,7 @@ describe APR::Drivers::Schooltube do
33
33
  item.username.should eq("StudentGroupTravel")
34
34
 
35
35
  rt_url = item.return_types[0]
36
+ rt_url.driver.should eq(APR::Drivers::Schooltube::DRIVER_NAME)
36
37
  rt_url.return_type.should eq('url')
37
38
  rt_url.url.should eq("http://bit.ly/pk3Sxs")
38
39
  rt_url.title.should eq("Fun - Educational School Trips - Call American Tours & Travel")
@@ -40,11 +41,12 @@ describe APR::Drivers::Schooltube do
40
41
  rt_iframe = item.return_types[1]
41
42
  rt_iframe.return_type.should eq('iframe')
42
43
  rt_iframe.url.should eq("https://www.schooltube.com/embed/60f374fdba394a70b4ad")
43
- rt_url.title.should eq("Fun - Educational School Trips - Call American Tours & Travel")
44
+ rt_iframe.driver.should eq(APR::Drivers::Schooltube::DRIVER_NAME)
45
+ rt_iframe.title.should eq("Fun - Educational School Trips - Call American Tours & Travel")
44
46
 
45
47
  item.width.should eq(640)
46
48
  item.height.should eq(360)
47
49
  end
48
50
  end
49
51
 
50
- end
52
+ end
@@ -54,11 +54,13 @@ describe APR::Drivers::Vimeo do
54
54
  item.username.should eq("Jens & Anna")
55
55
 
56
56
  rt_url = item.return_types[0]
57
+ rt_url.driver.should eq(APR::Drivers::Vimeo::DRIVER_NAME)
57
58
  rt_url.return_type.should eq('url')
58
59
  rt_url.url.should eq("http://vimeo.com/67741947")
59
60
  rt_url.title.should eq("Kynect 'education'")
60
61
 
61
62
  rt_iframe = item.return_types[1]
63
+ rt_iframe.driver.should eq(APR::Drivers::Vimeo::DRIVER_NAME)
62
64
  rt_iframe.return_type.should eq('iframe')
63
65
  rt_iframe.url.should eq("https://player.vimeo.com/video/67741947")
64
66
  rt_url.title.should eq("Kynect 'education'")
@@ -68,4 +70,4 @@ describe APR::Drivers::Vimeo do
68
70
  end
69
71
  end
70
72
 
71
- end
73
+ end
@@ -35,11 +35,13 @@ describe APR::Drivers::Youtube do
35
35
  item.return_types.count.should eq(2)
36
36
 
37
37
  rt_url = item.return_types[0]
38
+ rt_url.driver.should eq(APR::Drivers::Youtube::DRIVER_NAME)
38
39
  rt_url.return_type.should eq('url')
39
40
  rt_url.url.should eq("https://www.youtube.com/watch?v=y_ZmM7zPLyI&feature=youtube_gdata_player")
40
41
  rt_url.title.should eq("Why I Hate School But Love Education||Spoken Word")
41
42
 
42
43
  rt_iframe = item.return_types[1]
44
+ rt_iframe.driver.should eq(APR::Drivers::Youtube::DRIVER_NAME)
43
45
  rt_iframe.return_type.should eq('iframe')
44
46
  rt_iframe.url.should eq("https://www.youtube.com/embed/y_ZmM7zPLyI?feature=oembed")
45
47
  rt_url.title.should eq("Why I Hate School But Love Education||Spoken Word")
@@ -49,4 +51,4 @@ describe APR::Drivers::Youtube do
49
51
  end
50
52
  end
51
53
 
52
- end
54
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_public_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Berry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-16 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.1.11
161
+ rubygems_version: 2.2.1
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Normalized searching and browsing of public resources