Class: ShutterstockRuby::Videos
Overview
A class to hold all videos related code.
Instance Attribute Summary
Attributes inherited from Connections
#configuration
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Connections
#get, #initialize, #post
Class Method Details
.details(id, options = {}) ⇒ Object
35
36
37
|
# File 'lib/shutterstock-ruby/videos.rb', line 35
def details(id, options = {})
client.details(id, options)
end
|
.purchase(id, subscription_id, size, options = {}) ⇒ Object
39
40
41
|
# File 'lib/shutterstock-ruby/videos.rb', line 39
def purchase(id, subscription_id, size, options = {})
client.purchase(id, subscription_id, size, options)
end
|
.search(query, options = {}) ⇒ Object
31
32
33
|
# File 'lib/shutterstock-ruby/videos.rb', line 31
def search(query, options = {})
client.search(query, options)
end
|
Instance Method Details
#details(id, options = {}) ⇒ Object
9
10
11
|
# File 'lib/shutterstock-ruby/videos.rb', line 9
def details(id, options = {})
JSON.parse(get('/videos', { id: id }.merge(options)))
end
|
#download(licence) ⇒ Object
26
27
28
|
# File 'lib/shutterstock-ruby/videos.rb', line 26
def download(licence)
JSON.parse(post("/videos/licenses/#{licence}/downloads", {}.to_json))
end
|
#licenses(video_id, license, options = {}) ⇒ Object
21
22
23
24
|
# File 'lib/shutterstock-ruby/videos.rb', line 21
def licenses(video_id, license, options = {})
params = { video_id: video_id, license: license }
JSON.parse(get("/videos/licenses", params.merge(options)))
end
|
#purchase(id, subscription_id, size, options = {}) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/shutterstock-ruby/videos.rb', line 13
def purchase(id, subscription_id, size, options = {})
params = { subscription_id: subscription_id, size: size }
metadata = options.delete(:metadata) || {}
body = { videos: [ { video_id: id }.merge(metadata)] }.to_json
JSON.parse(post("/videos/licenses", body, params, options))
end
|
#search(query, options = {}) ⇒ Object
5
6
7
|
# File 'lib/shutterstock-ruby/videos.rb', line 5
def search(query, options = {})
JSON.parse(get('/videos/search', { query: query }.merge(options)))
end
|