helix 0.0.4.8.pre → 0.0.4.9.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/helix.rb +1 -0
- data/lib/helix/document.rb +28 -0
- data/lib/helix/downloadable.rb +18 -0
- data/lib/helix/durationed.rb +0 -9
- data/lib/helix/has_signatures.rb +1 -0
- data/lib/helix/media.rb +1 -1
- data/spec/document_spec.rb +7 -5
- data/spec/media_spec.rb +1 -1
- data/spec/paginates_spec.rb +1 -1
- metadata +35 -36
- data/spec/audio_playlist_spec.rb +0 -0
- data/spec/video_playlist_spec.rb +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWY5OTNjMjY3NTE4ZWVhMTk0MWRjYTRmNTY2NGQwYzRiNjk2MWJjYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmZkNGU3NDhlY2IxNjI2ODc1ZmU3YTJkODNmODdhYWFjMmM3Y2IyZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzU4M2RmYzY2MDc5ZTk2NWY4OTFkMGRhNmM4MDA2ZDE3ZTRmNTVlNDE5YTBm
|
10
|
+
MzE3OWNjMzljNWVhYTg3NjU0NTlmMWE5YjhiYTRjOTMyMjM2NGUzNzdhYzA3
|
11
|
+
ZDNmYWJkMDYwYmY4MWE3ZTA0ODYyMWIxMzU5OGU5M2EwNGFlOGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzI2NTFkMzk0NjBhYjA4NzE5NTBlOGJjYTI0OWE1ZmNjZDljYjZjNzU0NzQ1
|
14
|
+
OTU2YjE4NGU0MTA2ZjVjZmJhOThiMTZjYzQ3NmJhMGExYjRiYmY3NTNlZmI4
|
15
|
+
NzliOWUzYzY5M2VkN2ExMWM1N2FlYjk4MmIzMTVlNTcxNzczNjM=
|
data/lib/helix.rb
CHANGED
data/lib/helix/document.rb
CHANGED
@@ -14,6 +14,34 @@ module Helix
|
|
14
14
|
# @return [Symbol] Name of the class.
|
15
15
|
def self.resource_label_sym; :document; end
|
16
16
|
|
17
|
+
# Used to download data for the given Document.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# document = Helix::Document.find("239c59483d346")
|
21
|
+
# document_data = document.download #=> xDC\xF1?\xE9*?\xFF\xD9
|
22
|
+
# File.open("my_document.mp4", "w") { |f| f.puts document_data }
|
23
|
+
#
|
24
|
+
# @param [Hash] opts a hash of options for building URL
|
25
|
+
# @return [String] Raw document data, save it to a file
|
26
|
+
def download(opts={})
|
27
|
+
generic_download(opts.merge(action: :file))
|
28
|
+
end
|
29
|
+
|
30
|
+
# Used to play the given Document.
|
31
|
+
#
|
32
|
+
# The definition of what "play" means for Documents
|
33
|
+
# may vary by specific type.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# document = Helix::Document.find("239c59483d346")
|
37
|
+
# document_data = document.play #=> xDC\xF1?\xE9*?\xFF\xD9
|
38
|
+
#
|
39
|
+
# @param [Hash] opts a hash of options for building URL
|
40
|
+
# @return [String] Raw document data
|
41
|
+
def play(opts={})
|
42
|
+
generic_download(opts.merge(action: :play))
|
43
|
+
end
|
44
|
+
|
17
45
|
end
|
18
46
|
|
19
47
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Helix
|
2
|
+
|
3
|
+
module Downloadable
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def generic_download(opts)
|
8
|
+
content_type = opts[:content_type] || ''
|
9
|
+
url = config.build_url( action: opts[:action],
|
10
|
+
content_type: content_type,
|
11
|
+
guid: guid,
|
12
|
+
resource_label: plural_resource_label )
|
13
|
+
RestClient.get(url, params: {signature: config.signature(:view)})
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/lib/helix/durationed.rb
CHANGED
@@ -2,15 +2,6 @@ module Helix
|
|
2
2
|
|
3
3
|
module Durationed
|
4
4
|
|
5
|
-
def generic_download(opts)
|
6
|
-
content_type = opts[:content_type] || ''
|
7
|
-
url = config.build_url( action: opts[:action],
|
8
|
-
content_type: content_type,
|
9
|
-
guid: guid,
|
10
|
-
resource_label: plural_resource_label )
|
11
|
-
RestClient.get(url, params: {signature: config.signature(:view)})
|
12
|
-
end
|
13
|
-
|
14
5
|
module ClassMethods
|
15
6
|
|
16
7
|
# Used to import tracks from a URL into the Twistage system.
|
data/lib/helix/has_signatures.rb
CHANGED
data/lib/helix/media.rb
CHANGED
data/spec/document_spec.rb
CHANGED
@@ -2,14 +2,14 @@ require File.expand_path('../spec_helper', __FILE__)
|
|
2
2
|
require 'helix'
|
3
3
|
|
4
4
|
describe Helix::Document do
|
5
|
-
let(:klass) { Helix::Document }
|
6
5
|
|
6
|
+
klass = Helix::Document
|
7
7
|
subject { klass }
|
8
8
|
mods = [ Helix::Base, Helix::Media ]
|
9
9
|
mods.each { |mod| its(:ancestors) { should include(mod) } }
|
10
|
-
its(:guid_name)
|
11
|
-
its(:resource_label_sym) { should be(:document)
|
12
|
-
its(:plural_resource_label) { should eq('documents')
|
10
|
+
its(:guid_name) { should eq('document_id') }
|
11
|
+
its(:resource_label_sym) { should be(:document) }
|
12
|
+
its(:plural_resource_label) { should eq('documents') }
|
13
13
|
[:find, :create, :all, :find_all, :where].each do |crud_call|
|
14
14
|
it { should respond_to(crud_call) }
|
15
15
|
end
|
@@ -19,12 +19,14 @@ describe Helix::Document do
|
|
19
19
|
### INSTANCE METHODS
|
20
20
|
|
21
21
|
describe "an instance" do
|
22
|
-
|
22
|
+
obj = klass.new({'document_id' => 'some_document_guid'})
|
23
23
|
subject { obj }
|
24
24
|
its(:resource_label_sym) { should be(:document) }
|
25
25
|
[:destroy, :update].each do |crud_call|
|
26
26
|
it { should respond_to(crud_call) }
|
27
27
|
end
|
28
|
+
it_behaves_like "downloads", obj
|
29
|
+
it_behaves_like "plays", obj
|
28
30
|
end
|
29
31
|
|
30
32
|
### CLASS METHODS
|
data/spec/media_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe Helix::Media do
|
|
31
31
|
Helix::Video => :video,
|
32
32
|
}
|
33
33
|
|
34
|
-
mods = [ Helix::RESTful, Helix::Uploadable ]
|
34
|
+
mods = [ Helix::RESTful, Helix::Uploadable, Helix::Downloadable ]
|
35
35
|
mods.each { |mod| its(:ancestors) { should include(mod) } }
|
36
36
|
|
37
37
|
describe ".create" do
|
data/spec/paginates_spec.rb
CHANGED
@@ -43,7 +43,7 @@ describe Helix::Paginates do
|
|
43
43
|
non_final_response = double(String, headers: {is_last_page: 'false'})
|
44
44
|
RestClient.should_receive(:get).once { non_final_response }
|
45
45
|
@klass.stub(:parse_response_by_url_format).with(non_final_response, :a_url) { {label => [:non_final]} }
|
46
|
-
@klass.send(meth, :a_url, label, opts)
|
46
|
+
@klass.send(meth, :a_url, label, opts)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4.
|
4
|
+
version: 0.0.4.9.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Twistage, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -59,50 +59,49 @@ extensions: []
|
|
59
59
|
extra_rdoc_files: []
|
60
60
|
files:
|
61
61
|
- lib/helix.rb
|
62
|
-
- lib/helix/album.rb
|
63
|
-
- lib/helix/audio_playlist.rb
|
64
62
|
- lib/helix/base.rb
|
65
|
-
- lib/helix/builds_urls.rb
|
66
|
-
- lib/helix/config.rb
|
67
|
-
- lib/helix/document.rb
|
68
|
-
- lib/helix/durationed.rb
|
69
|
-
- lib/helix/exceptions.rb
|
70
|
-
- lib/helix/has_signatures.rb
|
71
|
-
- lib/helix/hash_ext.rb
|
72
|
-
- lib/helix/image.rb
|
73
|
-
- lib/helix/library.rb
|
74
|
-
- lib/helix/media.rb
|
75
|
-
- lib/helix/object_ext.rb
|
76
63
|
- lib/helix/paginates.rb
|
77
|
-
- lib/helix/
|
64
|
+
- lib/helix/audio_playlist.rb
|
65
|
+
- lib/helix/image.rb
|
78
66
|
- lib/helix/restful.rb
|
67
|
+
- lib/helix/hash_ext.rb
|
68
|
+
- lib/helix/library.rb
|
69
|
+
- lib/helix/user.rb
|
70
|
+
- lib/helix/has_signatures.rb
|
71
|
+
- lib/helix/uploadable.rb
|
72
|
+
- lib/helix/downloadable.rb
|
79
73
|
- lib/helix/statistics.rb
|
74
|
+
- lib/helix/document.rb
|
75
|
+
- lib/helix/durationed.rb
|
76
|
+
- lib/helix/object_ext.rb
|
77
|
+
- lib/helix/video_playlist.rb
|
78
|
+
- lib/helix/media.rb
|
79
|
+
- lib/helix/video.rb
|
80
|
+
- lib/helix/album.rb
|
81
|
+
- lib/helix/builds_urls.rb
|
80
82
|
- lib/helix/tag.rb
|
83
|
+
- lib/helix/playlist.rb
|
81
84
|
- lib/helix/track.rb
|
82
|
-
- lib/helix/
|
83
|
-
- lib/helix/
|
84
|
-
- lib/helix/video.rb
|
85
|
-
- lib/helix/video_playlist.rb
|
86
|
-
- spec/_integration_spec.rb
|
87
|
-
- spec/album_spec.rb
|
88
|
-
- spec/audio_playlist_spec.rb
|
89
|
-
- spec/base_spec.rb
|
90
|
-
- spec/config_spec.rb
|
91
|
-
- spec/document_spec.rb
|
85
|
+
- lib/helix/exceptions.rb
|
86
|
+
- lib/helix/config.rb
|
92
87
|
- spec/durationed_spec.rb
|
93
|
-
- spec/
|
94
|
-
- spec/image_spec.rb
|
88
|
+
- spec/document_spec.rb
|
95
89
|
- spec/library_spec.rb
|
96
|
-
- spec/media_spec.rb
|
97
|
-
- spec/paginates_spec.rb
|
98
|
-
- spec/playlist_spec.rb
|
99
90
|
- spec/spec_helper.rb
|
100
|
-
- spec/
|
91
|
+
- spec/config_spec.rb
|
92
|
+
- spec/base_spec.rb
|
93
|
+
- spec/playlist_spec.rb
|
94
|
+
- spec/video_spec.rb
|
101
95
|
- spec/tag_spec.rb
|
102
|
-
- spec/track_spec.rb
|
103
96
|
- spec/user_spec.rb
|
104
|
-
- spec/
|
105
|
-
- spec/
|
97
|
+
- spec/_integration_spec.rb
|
98
|
+
- spec/album_spec.rb
|
99
|
+
- spec/image_spec.rb
|
100
|
+
- spec/helix_spec.rb
|
101
|
+
- spec/statistics_spec.rb
|
102
|
+
- spec/paginates_spec.rb
|
103
|
+
- spec/media_spec.rb
|
104
|
+
- spec/track_spec.rb
|
106
105
|
- LICENSE
|
107
106
|
- README.md
|
108
107
|
homepage: https://github.com/Twistage/helix/
|
@@ -125,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
124
|
version: 1.3.1
|
126
125
|
requirements: []
|
127
126
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.1.
|
127
|
+
rubygems_version: 2.1.9
|
129
128
|
signing_key:
|
130
129
|
specification_version: 4
|
131
130
|
summary: Wrapper library for the video API
|
data/spec/audio_playlist_spec.rb
DELETED
File without changes
|
data/spec/video_playlist_spec.rb
DELETED
File without changes
|