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



67
68
69
# File 'lib/vzaar/api.rb', line 67

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



75
76
77
# File 'lib/vzaar/api.rb', line 75

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


79
80
81
82
83
# File 'lib/vzaar/api.rb', line 79

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



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

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

#process_video(opts = {}) ⇒ Object



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

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

#s3_upload(file_path) ⇒ Object



85
86
87
88
89
# File 'lib/vzaar/api.rb', line 85

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
# File 'lib/vzaar/api.rb', line 41

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

#upload_audio(opts = {}) ⇒ Object



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

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

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



71
72
73
# File 'lib/vzaar/api.rb', line 71

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

#upload_video(opts = {}) ⇒ Object



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

def upload_video(opts={})
  uploader = Uploader.new(conn, signature, 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