Class: VzaarApi::Strategy::Subtitle::Create

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(video_id, attrs, klass) ⇒ Create

Returns a new instance of Create.



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

def initialize(video_id, attrs, klass)
  @attrs = attrs
  @video_id = video_id
  @klass = klass
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



5
6
7
# File 'lib/vzaar_api/strategy/subtitle/create.rb', line 5

def attrs
  @attrs
end

#klassObject (readonly)

Returns the value of attribute klass.



5
6
7
# File 'lib/vzaar_api/strategy/subtitle/create.rb', line 5

def klass
  @klass
end

#video_idObject (readonly)

Returns the value of attribute video_id.



5
6
7
# File 'lib/vzaar_api/strategy/subtitle/create.rb', line 5

def video_id
  @video_id
end

Instance Method Details

#executeObject



13
14
15
16
# File 'lib/vzaar_api/strategy/subtitle/create.rb', line 13

def execute
  res = attrs[:file] ? create_from_file : Lib::Api.new.post(url, attrs)
  klass.new res.data.merge(scope_id: video_id)
end