Module: Vodpod
- Defined in:
- lib/vodpod.rb,
lib/vodpod/tag.rb,
lib/vodpod/user.rb,
lib/vodpod/video.rb,
lib/vodpod/record.rb,
lib/vodpod/comment.rb,
lib/vodpod/version.rb,
lib/vodpod/collection.rb,
lib/vodpod/connection.rb,
lib/vodpod/record_set.rb,
lib/vodpod/collection_video.rb
Defined Under Namespace
Classes: Collection, CollectionVideo, Comment, Connection, Record, RecordSet, Tag, User, Video
Constant Summary collapse
- BASE_URI =
'http://api.vodpod.com/v2/'
- ROOT =
File.dirname(__FILE__)
- APP_NAME =
'Vodpod'
- APP_VERSION =
'2.0.0'
- APP_AUTHOR =
'Kyle Kingsbury'
- APP_EMAIL =
'[email protected]'
- APP_URL =
'http://aphyr.com/projects/show/ruby-vodpod-bindings'
- APP_COPYRIGHT =
'Copyright (c) 2009 Kyle Kingsbury <[email protected]>. All rights reserved.'
Class Method Summary collapse
-
.escape(s) ⇒ Object
Performs URI escaping so that you can construct proper query strings faster.
-
.start(params) {|c| ... } ⇒ Object
Creates a connection with the provided parameter hash, and yields it in a block if given.
Class Method Details
.escape(s) ⇒ Object
Performs URI escaping so that you can construct proper query strings faster. Use this rather than the cgi.rb version since it’s faster. (Stolen from Camping).
30 31 32 33 34 |
# File 'lib/vodpod.rb', line 30 def escape(s) s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) { '%'+$1.unpack('H2'*$1.size).join('%').upcase }.tr(' ', '+') end |
.start(params) {|c| ... } ⇒ Object
Creates a connection with the provided parameter hash, and yields it in a block if given. Returns the connection. Example:
Vodpod.start(:api_key => api_key, :auth_key => auth_key) do |v|
pod = v.pod('aphyr')
p pod.created_at
end
44 45 46 47 48 |
# File 'lib/vodpod.rb', line 44 def self.start(params) c = Connection.new params yield c if block_given? c end |