Class: Videojuicer::Presentation

Inherits:
Object
  • Object
show all
Includes:
Exceptions, Resource, Resource::Embeddable, Resource::Taggable
Defined in:
lib/videojuicer/presentation.rb

Constant Summary collapse

@@asset_types =
%w(video flash image document audio)

Constants included from Resource::Embeddable

Resource::Embeddable::OEMBED_ENDPOINT

Instance Attribute Summary collapse

Attributes included from Configurable

#local_config

Instance Method Summary collapse

Methods included from Resource::Taggable

#tags, #tags=

Methods included from Resource::Embeddable

#embed_code, #embed_size, #oembed_payload

Methods included from Resource

#destroy, #errors, #errors=, #errors_on, included, #new_record?, #reload, #save, #to_json, #update_attributes, #valid?, #validate_committed_response, #validate_response

Methods included from Resource::Relationships::BelongsTo

included

Methods included from Resource::PropertyRegistry

#attr_clean!, #attr_dirty!, #attr_dirty?, #attr_get, #attr_set, #attributes, #attributes=, #clean_dirty_attributes!, #coerce_value, #default_attributes, #dirty_attribute_keys, #dirty_attributes, included, inherited, #initialize, #invalid_attributes, #returnable_attributes, #set_default_attributes

Methods included from Resource::Inferrable

included

Methods included from OAuth::ProxyFactory

#proxy_for

Methods included from Configurable

#api_version, #config, #configure!, #consumer_key, #consumer_secret, #host, #port, #protocol, #scope, #seed_name, #token, #token_secret, #user_id

Instance Attribute Details

#image_asset {|@image_asset| ... } ⇒ Object

get the thumbnail image associated with the presentation

Yields:



53
54
55
# File 'lib/videojuicer/presentation.rb', line 53

def image_asset
  @image_asset
end

Instance Method Details

#asset_idsObject



42
43
44
45
46
47
48
49
50
# File 'lib/videojuicer/presentation.rb', line 42

def asset_ids
  Videojuicer::SDKLiquidHelper::Filters::AssetBlock.reset!
  @@asset_types.each do |type|
    Liquid::Template.register_tag type, Videojuicer::SDKLiquidHelper::Filters::AssetBlock
  end
  @template = Liquid::Template.parse(document_content)
  @template.render
  return Videojuicer::SDKLiquidHelper::Filters::AssetBlock.asset_ids
end

#has_default_content?Boolean

Returns:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/videojuicer/presentation.rb', line 71

def has_default_content?
  return false if document_content.nil? or document_content.include? "<"
  
  asset_ids
  return false if video_assets.length > 1
  
  types = @@asset_types.dup
  types.delete "video"
  
  result = types.inject(true) do |memo, type|
    unless send("#{type}_asset_ids").nil?
      return false
    else
      true
    end
  end
  return result unless result
  
  #OMG MEGA HAX until I can schedule some time to fix it properly
  return false if document_content.include? "delivery"
  
  true
end


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

def permalink
  proxy = proxy_for(config)
  "#{proxy.host_stub}/presentations/#{id}.html?seed_name=#{seed_name}".gsub(":80/","/")
end