Class: VzaarApi::Strategy::Video::Create

Inherits:
Object
  • Object
show all
Defined in:
lib/vzaar_api/strategy/video/create.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs, video_class) ⇒ Create



8
9
10
11
# File 'lib/vzaar_api/strategy/video/create.rb', line 8

def initialize(attrs, video_class)
  @attrs = attrs
  @video_class = video_class
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



6
7
8
# File 'lib/vzaar_api/strategy/video/create.rb', line 6

def attrs
  @attrs
end

#video_classObject (readonly)

Returns the value of attribute video_class.



6
7
8
# File 'lib/vzaar_api/strategy/video/create.rb', line 6

def video_class
  @video_class
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vzaar_api/strategy/video/create.rb', line 13

def execute
  case
  when attrs.has_key?(:guid)
    create_from_guid
  when attrs.has_key?(:path)
    create_from_path
  when attrs.has_key?(:url)
    create_from_url
  else
    raise Error.new('Invalid parameters: Expected one of :guid, :path, :url')
  end
end