Class: Vzaar::Api

Inherits:
Struct
  • Object
show all
Defined in:
lib/vzaar/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



2
3
4
# File 'lib/vzaar/api.rb', line 2

def options
  @options
end

Instance Method Details

#account_type(account_type_id, opts = {}) ⇒ Object



12
13
14
15
# File 'lib/vzaar/api.rb', line 12

def (, opts={})
  _opts = opts.merge(account_type_id: )
  Request::AccountType.new(conn, _opts).execute
end

#add_subtitle(video_id, opts = {}) ⇒ Object



69
70
71
# File 'lib/vzaar/api.rb', line 69

def add_subtitle(video_id, opts={})
  Request::AddSubtitle.new(conn, opts.merge(video_id: video_id)).execute
end

#connObject



3
4
5
# File 'lib/vzaar/api.rb', line 3

def conn
  @conn ||= Connection.new(options)
end

#delete_video(video_id, opts = {}) ⇒ Object



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

def delete_video(video_id, opts={})
  Request::DeleteVideo.new(conn, opts.merge(video_id: video_id)).execute
end

#edit_video(video_id, opts = {}) ⇒ Object



37
38
39
# File 'lib/vzaar/api.rb', line 37

def edit_video(video_id, opts={})
  Request::EditVideo.new(conn, opts.merge(video_id: video_id)).execute
end

#generate_thumbnail(video_id, opts = {}) ⇒ Object



77
78
79
# File 'lib/vzaar/api.rb', line 77

def generate_thumbnail(video_id, opts={})
  Request::GenerateThumbnail.new(conn, opts.merge(video_id: video_id)).execute
end

TODO: remove



82
83
84
85
86
# File 'lib/vzaar/api.rb', line 82

def link_upload(url, opts={})
  sig = signature
  _opts = opts.merge({ guid: sig.guid, key: sig.key, url: url })
  Request::LinkUpload.new(conn, _opts).execute
end

#process_audio(opts = {}) ⇒ Object



50
51
52
# File 'lib/vzaar/api.rb', line 50

def process_audio(opts={})
  Request::ProcessAudio.new(conn, opts).execute
end

#process_video(opts = {}) ⇒ Object



46
47
48
# File 'lib/vzaar/api.rb', line 46

def process_video(opts={})
  Request::ProcessVideo.new(conn, opts).execute
end

#s3_upload(file_path) ⇒ Object

TODO: remove



89
90
91
92
93
# File 'lib/vzaar/api.rb', line 89

def s3_upload(file_path)
  uploader = Uploader.new(conn, signature, path: file_path)
  uploader.upload
  uploader.processing_params
end

#signature(opts = {}) ⇒ Object



41
42
43
44
# File 'lib/vzaar/api.rb', line 41

def signature(opts={})
  opts.delete(:format)
  Request::Signature.new(conn, opts).execute
end

#upload_audio(opts = {}) ⇒ Object



54
55
56
57
58
59
# File 'lib/vzaar/api.rb', line 54

def upload_audio(opts={})
  uploader = Uploader.new(conn, signature(opts), opts)
  uploader.upload do |u|
    process_audio(u.processing_params)
  end
end

#upload_thumbnail(video_id, opts = {}) ⇒ Object



73
74
75
# File 'lib/vzaar/api.rb', line 73

def upload_thumbnail(video_id, opts={})
  Request::UploadThumbnail.new(conn, opts.merge(video_id: video_id)).execute
end

#upload_video(opts = {}) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/vzaar/api.rb', line 61

def upload_video(opts={})
  sig = signature(opts)
  uploader = Uploader.new(conn, sig, opts)
  uploader.upload do |u|
    process_video(u.processing_params)
  end
end

#user_details(login, opts = {}) ⇒ Object



17
18
19
# File 'lib/vzaar/api.rb', line 17

def user_details(, opts={})
  Request::UserDetails.new(conn, opts.merge(login: )).execute
end

#video_details(video_id, opts = {}) ⇒ Object



21
22
23
# File 'lib/vzaar/api.rb', line 21

def video_details(video_id, opts={})
  Request::VideoDetails.new(conn, opts.merge(video_id: video_id)).execute
end

#video_list(login, opts = {}) ⇒ Object



25
26
27
# File 'lib/vzaar/api.rb', line 25

def video_list(, opts={})
  Request::VideoList.new(conn, opts.merge(login: )).execute
end

#videos(opts = {}) ⇒ Object



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

def videos(opts={})
  video_list(conn., opts.merge({ authenticated: true }))
end

#whoami(opts = {}) ⇒ Object



7
8
9
10
# File 'lib/vzaar/api.rb', line 7

def whoami(opts={})
  resource = Request::WhoAmI.new(conn, opts).execute
  resource.
end