Module: Ooyala::ClassMethods

Defined in:
lib/ooyala.rb

Instance Method Summary collapse

Instance Method Details

#api_codes(partner, secret) ⇒ Object

Raises:



24
25
26
27
# File 'lib/ooyala.rb', line 24

def api_codes(partner, secret)
  raise NoAPICodes if partner.blank? || secret.blank?
  ooyala_options[:api_codes] = {:partner => partner, :secret => secret}
end

#edit(embed_code, options = {}) ⇒ Object

TODO make an instance method Options:

title

String

description

String

status

String - “live”, “paused” or “deleted” - Setting status to deleted deletes the video or channel.

hostedAt

String - The URL for the main page the video or channel is embedded on.

Raises:



59
60
61
62
63
64
65
66
67
# File 'lib/ooyala.rb', line 59

def edit(embed_code, options={})
  raise NoEmmbedCode if embed_code.blank?
  status_options = ['live', 'paused', 'deleted']
  if options["status"]
    raise InvalidStatus unless status_options.include?(options["status"])
  end
  opts = {"embedCode" => embed_code}.merge(options)
  self.get("/edit", :query => opts)
end

#metadata(embed_code, action, options = {}) ⇒ Object

TODO make an instance method

Actions
“add”, “query”, “delete_id”, “delete_query”
Add opts

director, actor, genre (multiple in an array)

Search opts

rows, op (OR, AND), and same as Add action but with asterisks for fuzzy searching

Delete ID opts

guid

Delete Query opts

same as search (delete metadata)

Raises:



76
77
78
79
80
81
82
83
84
# File 'lib/ooyala.rb', line 76

def (embed_code, action, options={})
  raise NoEmmbedCode if embed_code.blank?
  raise InvalidAction unless ["add", "query", "delete_id", "delete_query"].include?(action)
  if options["genre"].is_a?(Array)
    options["genre"] = options["genre"].join("\0")
  end
  opts = {"embedCode" => embed_code, "metaMode" => action}.merge(options)
  self.get("/metadata", :query => opts)
end

#query(options = {}) ⇒ Object



29
30
31
# File 'lib/ooyala.rb', line 29

def query(options={})
  self.get("/query", :query => options)
end

#query_channel(channel_embed_code, options = {}) ⇒ Object



37
38
39
40
# File 'lib/ooyala.rb', line 37

def query_channel(channel_embed_code, options = {})
  opts = {'channelEmbedCode' => channel_embed_code, 'mode' => 'list'}.merge(options)
  self.get("/channels", :query => opts)
end

#query_channel_listObject



33
34
35
# File 'lib/ooyala.rb', line 33

def query_channel_list
  self.query('contentType' => 'Channel')
end

#thumbnails(embed_code, options = {}) ⇒ Object

Options:

rage
String

“0-4”

resolution
String

“320x240”

Raises:



46
47
48
49
50
# File 'lib/ooyala.rb', line 46

def thumbnails(embed_code, options={})
  raise NoEmmbedCode if embed_code.blank?
  opts = {"embedCode" => embed_code, "range" =>"0-25", "resolution" =>"600x400"}.merge(options)      
  self.get("/thumbnails", :query  => opts)
end