pedrofranceschi-phtwitvid 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/phtwitvid.rb +28 -2
  2. data/phtwitvid.gemspec +1 -1
  3. metadata +3 -2
data/lib/phtwitvid.rb CHANGED
@@ -34,7 +34,33 @@ class PHTwitVid
34
34
  )
35
35
  f.close
36
36
  xml = XmlSimple.xml_in(response.body, { 'KeyAttr' => 'name' })
37
- return xml['media_url']
37
+ return {'media_url' => xml['media_url'].to_s, 'media_id' => xml['media_id'].to_s}
38
38
  end
39
-
39
+
40
+ def delete(token, video_id)
41
+ params = { :query => {:token => token, :media_id => video_id}}
42
+ response = HTTParty.post("#{$api_url}/delete", params)
43
+ xml = XmlSimple.xml_in(response.body, { 'KeyAttr' => 'name' })
44
+ return xml['rsp stat']
45
+ end
46
+
47
+ def embed(video_id, width, height)
48
+ if width == nil || height == nil
49
+ width = '425'
50
+ height = '344'
51
+ end
52
+ return "<object width=\"#{width}\" height=\"#{height}\">
53
+ <param name=\"movie\" value=\"http://www.twitvid.com/player/#{video_id}>\"></param>
54
+ <param name=\"allowFullScreen\" value=\"true\"></param>
55
+ <embed type=\"application/x-shockwave-flash\" src=\"http://www.twitvid.com/player/#{video_id}\" quality=\"high\" allowscriptaccess=\"always\" allowNetworking=\"all\" allowfullscreen=\"true\" wmode=\"transparent\" height=\"#{height}\" width=\"#{width}\">
56
+ </object>"
57
+ end
58
+
59
+ def create_playlist(token, playlist_name)
60
+ params = { :query => {:token => token, :playlistName => playlist_name}}
61
+ response = HTTParty.post("#{$api_url}/createPlaylist", params)
62
+ xml = XmlSimple.xml_in(response.body, { 'KeyAttr' => 'name' })
63
+ return {'playlist_url' => xml['playlist_url'].to_s, 'playlist_id' => xml['playlist_id'].to_s}
64
+ end
65
+
40
66
  end
data/phtwitvid.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{phtwitvid}
3
- s.version = "0.1"
3
+ s.version = "0.1.1"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["pH (Pedro Henrique Cavallieri Franceschi)"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pedrofranceschi-phtwitvid
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pH (Pedro Henrique Cavallieri Franceschi)
@@ -56,6 +56,7 @@ files:
56
56
  - lib/phtwitvid.rb
57
57
  has_rdoc: false
58
58
  homepage: http://www.iBlogeek.com
59
+ licenses:
59
60
  post_install_message:
60
61
  rdoc_options: []
61
62
 
@@ -76,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
77
  requirements: []
77
78
 
78
79
  rubyforge_project:
79
- rubygems_version: 1.2.0
80
+ rubygems_version: 1.3.5
80
81
  signing_key:
81
82
  specification_version: 2
82
83
  summary: A Library for TwitVid integration written in Ruby.