viddler 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,83 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class ViddlerVideoTest < Test::Unit::TestCase
4
+
5
+ ATTRIBUTES = [:id,
6
+ :url,
7
+ :title,
8
+ :description,
9
+ :tags,
10
+ :thumbnail_url,
11
+ :author,
12
+ :length_seconds,
13
+ :view_count,
14
+ :upload_time,
15
+ :comment_count,
16
+ :permissions,
17
+ :comments,
18
+ :width,
19
+ :height]
20
+
21
+ def setup
22
+ @attributes = { "permalink" => "http://www.viddler.com/explore/mockaquinho/videos/2/",
23
+ "title" => "01_Vitinho",
24
+ "author" => "mockaquinho",
25
+ "upload_time" => "1227747942000",
26
+ "comment_count" => 0,
27
+ "url" => "http://www.viddler.com/explore/mockaquinho/videos/2/",
28
+ "id" => "6a2babb2",
29
+ "length_seconds" => 865,
30
+ "description" => "Vitinho pop star. Desde 07/12/2007.",
31
+ "height" => 480,
32
+ "made_public_time" => "1227750542000",
33
+ "width" => 640,
34
+ "view_count" => 3,
35
+ "thumbnail_url" => "http://cdn-thumbs.viddler.com/thumbnail_2_6a2babb2.jpg",
36
+ "tags" => {"global" => "pop"}
37
+ }
38
+ @video = Viddler::Video.new(@attributes)
39
+ end
40
+
41
+
42
+ def test_accessors_and_initialize
43
+ expected_attributes = @attributes.merge("upload_time" => Time.at(1227747942000.to_i/1000), "tags" => ["pop"])
44
+ ATTRIBUTES.each do |field|
45
+ assert_equal expected_attributes[field.to_s], @video.send(field), "The expected value for #{field} is #{expected_attributes[field.to_s]} but got: #{@video.send(field)}"
46
+ end
47
+ end
48
+
49
+ def test_embed_code_without_options
50
+ expected_embed_code = File.read(File.dirname(__FILE__) + '/fixtures/embed_code.txt')
51
+ assert_equal expected_embed_code, @video.embed_code
52
+ end
53
+
54
+ def test_equals_when_should_be_equals
55
+ second_video = Viddler::Video.new("id" => "6a2babb2")
56
+ assert_equal second_video, @video
57
+ end
58
+
59
+ def test_equals_when_should_not_be_equals
60
+ second_video = Viddler::Video.new("id" => "6a2babb3")
61
+ assert_not_equal second_video, @video
62
+ end
63
+
64
+ def test_eql_when_should_be_equals
65
+ second_video = Viddler::Video.new("id" => "6a2babb2")
66
+ assert @video.eql?(second_video)
67
+ end
68
+
69
+ def test_eql_when_should_not_be_equals
70
+ second_video = Viddler::Video.new("id" => "6a2babb3")
71
+ assert !@video.eql?(second_video)
72
+ end
73
+
74
+ def test_hash
75
+ assert_equal 6, @video.hash
76
+ end
77
+
78
+ def test_comparison
79
+ second_video = Viddler::Video.new("title" => "02_Vitinho", "id" => "6a2babb2")
80
+ assert_equal [second_video, @video], [@video, second_video].sort
81
+ end
82
+
83
+ end
File without changes
@@ -0,0 +1,98 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{viddler}
8
+ s.version = "0.3.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ilya Sabanin"]
12
+ s.date = %q{2010-11-08}
13
+ s.description = %q{Ruby wrapper around Viddler.com[http://www.viddler.com] API.
14
+
15
+ == FEATURES:
16
+
17
+ Currently implemented API methods:
18
+
19
+ * viddler.videos.getRecordToken
20
+ * viddler.users.register
21
+ * viddler.users.auth
22
+ * viddler.users.getProfile
23
+ * viddler.users.setProfile
24
+ * viddler.users.setOptions
25
+ * viddler.videos.upload
26
+ * viddler.videos.getStatus
27
+ * viddler.videos.getDetails
28
+ * viddler.videos.getDetailsByUrl
29
+ * viddler.videos.setDetails
30
+ * viddler.videos.getByUser
31
+ * viddler.videos.getByTag
32
+ * viddler.videos.getFeatured
33
+ }
34
+ s.email = %q{ilya.sabanin@gmail.com}
35
+ s.extra_rdoc_files = [
36
+ "README.txt"
37
+ ]
38
+ s.files = [
39
+ ".bundle/config",
40
+ ".gitignore",
41
+ ".rvmrc",
42
+ "Gemfile",
43
+ "Gemfile.lock",
44
+ "History.txt",
45
+ "License.txt",
46
+ "README.txt",
47
+ "Rakefile",
48
+ "VERSION",
49
+ "lib/ext/array.rb",
50
+ "lib/ext/hash.rb",
51
+ "lib/ext/open_struct.rb",
52
+ "lib/viddler.rb",
53
+ "lib/viddler/api_spec.rb",
54
+ "lib/viddler/base.rb",
55
+ "lib/viddler/comment.rb",
56
+ "lib/viddler/multipart_params.rb",
57
+ "lib/viddler/request.rb",
58
+ "lib/viddler/user.rb",
59
+ "lib/viddler/version.rb",
60
+ "lib/viddler/video.rb",
61
+ "test/fixtures/embed_code.txt",
62
+ "test/test_helper.rb",
63
+ "test/test_viddler.rb",
64
+ "test/video.rb",
65
+ "tmp/.gitignore",
66
+ "viddler.gemspec"
67
+ ]
68
+ s.homepage = %q{http://viddler.rubyforge.org}
69
+ s.rdoc_options = ["--charset=UTF-8"]
70
+ s.require_paths = ["lib"]
71
+ s.rubygems_version = %q{1.3.7}
72
+ s.summary = %q{Ruby wrapper around Viddler.com API.}
73
+ s.test_files = [
74
+ "test/test_helper.rb",
75
+ "test/test_viddler.rb",
76
+ "test/video.rb"
77
+ ]
78
+
79
+ if s.respond_to? :specification_version then
80
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
81
+ s.specification_version = 3
82
+
83
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
84
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.rc"])
85
+ s.add_runtime_dependency(%q<rest-client>, [">= 0"])
86
+ s.add_runtime_dependency(%q<mime-types>, [">= 0"])
87
+ else
88
+ s.add_dependency(%q<activesupport>, [">= 3.0.0.rc"])
89
+ s.add_dependency(%q<rest-client>, [">= 0"])
90
+ s.add_dependency(%q<mime-types>, [">= 0"])
91
+ end
92
+ else
93
+ s.add_dependency(%q<activesupport>, [">= 3.0.0.rc"])
94
+ s.add_dependency(%q<rest-client>, [">= 0"])
95
+ s.add_dependency(%q<mime-types>, [">= 0"])
96
+ end
97
+ end
98
+
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viddler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Ilya Sabanin
@@ -9,31 +14,91 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2008-05-16 00:00:00 +08:00
17
+ date: 2010-11-08 00:00:00 -08:00
13
18
  default_executable:
14
- dependencies: []
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activesupport
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 3
30
+ - 0
31
+ - 0
32
+ - rc
33
+ version: 3.0.0.rc
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rest-client
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: mime-types
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ type: :runtime
61
+ version_requirements: *id003
62
+ description: |
63
+ Ruby wrapper around Viddler.com[http://www.viddler.com] API.
64
+
65
+ == FEATURES:
66
+
67
+ Currently implemented API methods:
68
+
69
+ * viddler.videos.getRecordToken
70
+ * viddler.users.register
71
+ * viddler.users.auth
72
+ * viddler.users.getProfile
73
+ * viddler.users.setProfile
74
+ * viddler.users.setOptions
75
+ * viddler.videos.upload
76
+ * viddler.videos.getStatus
77
+ * viddler.videos.getDetails
78
+ * viddler.videos.getDetailsByUrl
79
+ * viddler.videos.setDetails
80
+ * viddler.videos.getByUser
81
+ * viddler.videos.getByTag
82
+ * viddler.videos.getFeatured
15
83
 
16
- description: Ruby wrapper around Viddler.com API.
17
- email:
18
- - ilya.sabanin@gmail.com
84
+ email: ilya.sabanin@gmail.com
19
85
  executables: []
20
86
 
21
87
  extensions: []
22
88
 
23
89
  extra_rdoc_files:
24
- - History.txt
25
- - License.txt
26
- - Manifest.txt
27
90
  - README.txt
28
- - website/index.txt
29
91
  files:
92
+ - .bundle/config
93
+ - .gitignore
94
+ - .rvmrc
95
+ - Gemfile
96
+ - Gemfile.lock
30
97
  - History.txt
31
98
  - License.txt
32
- - Manifest.txt
33
99
  - README.txt
34
100
  - Rakefile
35
- - config/hoe.rb
36
- - config/requirements.rb
101
+ - VERSION
37
102
  - lib/ext/array.rb
38
103
  - lib/ext/hash.rb
39
104
  - lib/ext/open_struct.rb
@@ -46,49 +111,45 @@ files:
46
111
  - lib/viddler/user.rb
47
112
  - lib/viddler/version.rb
48
113
  - lib/viddler/video.rb
49
- - log/debug.log
50
- - script/console
51
- - script/destroy
52
- - script/generate
53
- - script/txt2html
54
- - setup.rb
55
- - tasks/deployment.rake
56
- - tasks/environment.rake
57
- - tasks/website.rake
114
+ - test/fixtures/embed_code.txt
58
115
  - test/test_helper.rb
59
116
  - test/test_viddler.rb
60
- - website/index.html
61
- - website/index.txt
62
- - website/javascripts/rounded_corners_lite.inc.js
63
- - website/stylesheets/screen.css
64
- - website/template.html.erb
117
+ - test/video.rb
118
+ - tmp/.gitignore
119
+ - viddler.gemspec
65
120
  has_rdoc: true
66
121
  homepage: http://viddler.rubyforge.org
122
+ licenses: []
123
+
67
124
  post_install_message:
68
125
  rdoc_options:
69
- - --main
70
- - README.txt
126
+ - --charset=UTF-8
71
127
  require_paths:
72
128
  - lib
73
129
  required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
74
131
  requirements:
75
132
  - - ">="
76
133
  - !ruby/object:Gem::Version
134
+ segments:
135
+ - 0
77
136
  version: "0"
78
- version:
79
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
80
139
  requirements:
81
140
  - - ">="
82
141
  - !ruby/object:Gem::Version
142
+ segments:
143
+ - 0
83
144
  version: "0"
84
- version:
85
145
  requirements: []
86
146
 
87
- rubyforge_project: viddler
88
- rubygems_version: 1.1.0
147
+ rubyforge_project:
148
+ rubygems_version: 1.3.7
89
149
  signing_key:
90
- specification_version: 2
150
+ specification_version: 3
91
151
  summary: Ruby wrapper around Viddler.com API.
92
152
  test_files:
93
153
  - test/test_helper.rb
94
154
  - test/test_viddler.rb
155
+ - test/video.rb
@@ -1,35 +0,0 @@
1
- History.txt
2
- License.txt
3
- Manifest.txt
4
- README.txt
5
- Rakefile
6
- config/hoe.rb
7
- config/requirements.rb
8
- lib/ext/array.rb
9
- lib/ext/hash.rb
10
- lib/ext/open_struct.rb
11
- lib/viddler.rb
12
- lib/viddler/api_spec.rb
13
- lib/viddler/base.rb
14
- lib/viddler/comment.rb
15
- lib/viddler/multipart_params.rb
16
- lib/viddler/request.rb
17
- lib/viddler/user.rb
18
- lib/viddler/version.rb
19
- lib/viddler/video.rb
20
- log/debug.log
21
- script/console
22
- script/destroy
23
- script/generate
24
- script/txt2html
25
- setup.rb
26
- tasks/deployment.rake
27
- tasks/environment.rake
28
- tasks/website.rake
29
- test/test_helper.rb
30
- test/test_viddler.rb
31
- website/index.html
32
- website/index.txt
33
- website/javascripts/rounded_corners_lite.inc.js
34
- website/stylesheets/screen.css
35
- website/template.html.erb
@@ -1,70 +0,0 @@
1
- require 'viddler/version'
2
-
3
- AUTHOR = 'Ilya Sabanin' # can also be an array of Authors
4
- EMAIL = 'ilya.sabanin@gmail.com'
5
- DESCRIPTION = 'Ruby wrapper around Viddler.com API.'
6
- GEM_NAME = 'viddler' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = 'viddler' # The unix name for your project
8
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
-
11
- @config_file = "~/.rubyforge/user-config.yml"
12
- @config = nil
13
- RUBYFORGE_USERNAME = "unknown"
14
- def rubyforge_username
15
- unless @config
16
- begin
17
- @config = YAML.load(File.read(File.expand_path(@config_file)))
18
- rescue
19
- puts <<-EOS
20
- ERROR: No rubyforge config file found: #{@config_file}
21
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
22
- - See http://newgem.rubyforge.org/rubyforge.html for more details
23
- EOS
24
- exit
25
- end
26
- end
27
- RUBYFORGE_USERNAME.replace @config["username"]
28
- end
29
-
30
-
31
- REV = nil
32
- # UNCOMMENT IF REQUIRED:
33
- # REV = YAML.load(`svn info`)['Revision']
34
- VERS = Viddler::VERSION::STRING + (REV ? ".#{REV}" : "")
35
- RDOC_OPTS = ['--quiet', '--title', 'viddler documentation',
36
- "--opname", "index.html",
37
- "--line-numbers",
38
- "--main", "README",
39
- "--inline-source"]
40
-
41
- class Hoe
42
- def extra_deps
43
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
- @extra_deps
45
- end
46
- end
47
-
48
- # Generate all the Rake tasks
49
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
50
- $hoe = Hoe.new(GEM_NAME, VERS) do |p|
51
- p.developer(AUTHOR, EMAIL)
52
- p.description = DESCRIPTION
53
- p.summary = DESCRIPTION
54
- p.url = HOMEPATH
55
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
56
- p.test_globs = ["test/**/test_*.rb"]
57
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
58
-
59
- # == Optional
60
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
61
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
62
-
63
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
64
-
65
- end
66
-
67
- CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
68
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
69
- $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
70
- $hoe.rsync_args = '-av --delete --ignore-errors'