ubiquity-iconik 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +10 -0
- data/bin/console +17 -0
- data/bin/setup +8 -0
- data/exe/ubiquity-iconik +3 -0
- data/lib/ubiquity/iconik.rb +7 -0
- data/lib/ubiquity/iconik/api/client.rb +708 -0
- data/lib/ubiquity/iconik/api/client/http_client.rb +333 -0
- data/lib/ubiquity/iconik/api/client/paginator.rb +134 -0
- data/lib/ubiquity/iconik/api/client/requests.rb +2 -0
- data/lib/ubiquity/iconik/api/client/requests/base_request.rb +270 -0
- data/lib/ubiquity/iconik/api/utilities.rb +174 -0
- data/lib/ubiquity/iconik/version.rb +5 -0
- data/ubiquity-iconik.gemspec +27 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dc41c044ba6d0e56d1e5a8197a8bdbfa4ec81c87
|
4
|
+
data.tar.gz: 782d648bbdfb20965044d5d472d4e28eaa5ba04f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 418e71c8b7ca452f6136e5f580e5f074e95ce8f348ced28c150f859bd12878c5d7b6a303107a24e700606443852c1ed7fd1a6e620ac3e2542e9f59e94d93bc6b
|
7
|
+
data.tar.gz: 6f78abc996e83b01053be5c2cefee120bddefaec0b5e84925091f649ed26ad076ead492bb1f51768b7c34c72cf0240f5c72e1005bad3e6af5cf730e3bfb1a7df
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 John Whitson
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Ubiquity::Iconik
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ubiquity/iconik`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'ubiquity-iconik'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ubiquity-iconik
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/John Whitson/ubiquity-iconik.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'ubiquity/iconik'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
begin
|
11
|
+
require 'pry'
|
12
|
+
Pry.start
|
13
|
+
rescue LoadError => e
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
16
|
+
end
|
17
|
+
|
data/bin/setup
ADDED
data/exe/ubiquity-iconik
ADDED
@@ -0,0 +1,708 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'date'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
require 'ubiquity/iconik/api/client/http_client'
|
6
|
+
require 'ubiquity/iconik/api/client/requests'
|
7
|
+
require 'ubiquity/iconik/api/client/paginator'
|
8
|
+
|
9
|
+
module Ubiquity
|
10
|
+
module Iconik
|
11
|
+
module API
|
12
|
+
class Client
|
13
|
+
|
14
|
+
attr_accessor :http_client, :request, :response, :logger
|
15
|
+
|
16
|
+
def initialize(args = { })
|
17
|
+
@http_client = HTTPClient.new(args)
|
18
|
+
@logger = http_client.logger
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
# Exposes HTTP Methods
|
23
|
+
# @example http(:get, '/')
|
24
|
+
def http(method, *args)
|
25
|
+
@request = nil
|
26
|
+
@response = http_client.send(method, *args)
|
27
|
+
@request = http_client.request
|
28
|
+
response
|
29
|
+
end
|
30
|
+
|
31
|
+
def paginator
|
32
|
+
@paginator ||= Paginator.new(self) if @response
|
33
|
+
end
|
34
|
+
|
35
|
+
def process_request(request, options = nil)
|
36
|
+
@paginator = nil
|
37
|
+
@response = nil
|
38
|
+
@request = request
|
39
|
+
|
40
|
+
logger.warn { "Request is Missing Required Arguments: #{request.missing_required_arguments.inspect}" } unless request.missing_required_arguments.empty?
|
41
|
+
|
42
|
+
if ([:all, 'all'].include?(request.arguments[:page]))
|
43
|
+
request.arguments[:page] = 1
|
44
|
+
include_remaining_pages = true
|
45
|
+
else
|
46
|
+
include_remaining_pages = false
|
47
|
+
end
|
48
|
+
|
49
|
+
request.client = self unless request.client
|
50
|
+
options ||= request.options
|
51
|
+
logger.warn { "Request is Missing Required Arguments: #{request.missing_required_arguments.inspect}" } unless request.missing_required_arguments.empty?
|
52
|
+
|
53
|
+
return (options.fetch(:return_request, true) ? request : nil) unless options.fetch(:execute_request, true)
|
54
|
+
|
55
|
+
#@response = http_client.call_method(request.http_method, { :path => request.path, :query => request.query, :body => request.body }, options)
|
56
|
+
@response = request.execute
|
57
|
+
|
58
|
+
if include_remaining_pages
|
59
|
+
return paginator.include_remaining_pages
|
60
|
+
end
|
61
|
+
|
62
|
+
@response
|
63
|
+
end
|
64
|
+
|
65
|
+
def process_request_using_class(request_class, args, options = { })
|
66
|
+
@response = nil
|
67
|
+
@request = request_class.new(args, options.merge(:client => self))
|
68
|
+
process_request(request, options)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Tries to determine if the last request got a successful response
|
72
|
+
def success?
|
73
|
+
return unless @request
|
74
|
+
if @request.respond_to?(:success?)
|
75
|
+
@request.success?
|
76
|
+
else
|
77
|
+
_response = http_client.response
|
78
|
+
_response && _response.code.start_with?('2')
|
79
|
+
end
|
80
|
+
rescue => e
|
81
|
+
logger.error { "Exception executing method :success?. '#{e.message}'\n#{e.backtrace}" }
|
82
|
+
return false
|
83
|
+
end
|
84
|
+
|
85
|
+
# def success?
|
86
|
+
# request && (request.respond_to?(:success?) ? request.success? : (response && response.code.start_with?('2')))
|
87
|
+
# end
|
88
|
+
|
89
|
+
# Will try to return the most concise error message possible
|
90
|
+
#
|
91
|
+
# Example:
|
92
|
+
# {
|
93
|
+
# "invalidInput": {
|
94
|
+
# "id": "portal_mf734147",
|
95
|
+
# "context": "metadata-field",
|
96
|
+
# "value": null,
|
97
|
+
# "explanation": "The metadata value is invalid"
|
98
|
+
# },
|
99
|
+
# "conflict": null,
|
100
|
+
# "notAuthorized": null,
|
101
|
+
# "fileAlreadyExists": null,
|
102
|
+
# "licenseFault": null,
|
103
|
+
# "notFound": null,
|
104
|
+
# "internalServer": null,
|
105
|
+
# "forbidden": null,
|
106
|
+
# "notYetImplemented": null
|
107
|
+
# }
|
108
|
+
#
|
109
|
+
# will become
|
110
|
+
#
|
111
|
+
# {
|
112
|
+
# "invalidInput"=> {
|
113
|
+
# "id"=>"portal_mf734147",
|
114
|
+
# "context"=>"metadata-field",
|
115
|
+
# "value"=>nil,
|
116
|
+
# "explanation"=>"The metadata value is invalid"
|
117
|
+
# }
|
118
|
+
# }
|
119
|
+
def error
|
120
|
+
_response_parsed = http_client.response_parsed
|
121
|
+
if _response_parsed.is_a?(Hash)
|
122
|
+
_error = _response_parsed.delete_if { |k,v| v.nil? }
|
123
|
+
_error
|
124
|
+
else
|
125
|
+
_response = http_client.response
|
126
|
+
_response.body if _response.respond_to?(:body)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# ############################################################################################################## #
|
131
|
+
# @!group API Endpoints
|
132
|
+
|
133
|
+
# Start a job that creates sends an asset to Google Cloud Video Intelligence API
|
134
|
+
#
|
135
|
+
# @see https://app.iconik.io/docs/apidocs.html?url=/docs/transcode/spec/
|
136
|
+
def asset_analyze(args = { }, options = { })
|
137
|
+
_request = Requests::BaseRequest.new(
|
138
|
+
args,
|
139
|
+
{
|
140
|
+
:http_path => 'transcode/v1/analyze/assets/#{path_arguments[:asset_id]}/',
|
141
|
+
:http_method => :post,
|
142
|
+
:http_success_code => '201',
|
143
|
+
:body => args,
|
144
|
+
:parameters => [
|
145
|
+
{ :name => :asset_id, :aliases => [ :id ], :required => true, :send_in => :path },
|
146
|
+
]
|
147
|
+
}.merge(options)
|
148
|
+
)
|
149
|
+
process_request(_request, options)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Create a new asset
|
153
|
+
#
|
154
|
+
# @see https://app.iconik.io/docs/apidocs.html?url=/docs/assets/spec/#/default/post_v1_assets_
|
155
|
+
def asset_create(args = { }, options = { })
|
156
|
+
_request = Requests::BaseRequest.new(
|
157
|
+
args,
|
158
|
+
{
|
159
|
+
:http_path => 'assets/v1/assets/',
|
160
|
+
:http_method => :post,
|
161
|
+
:http_success_code => '201',
|
162
|
+
:body => args,
|
163
|
+
:parameters => [
|
164
|
+
]
|
165
|
+
}.merge(options)
|
166
|
+
)
|
167
|
+
process_request(_request, options)
|
168
|
+
end
|
169
|
+
|
170
|
+
def asset_delete(args = { }, options = { })
|
171
|
+
_request = Requests::BaseRequest.new(
|
172
|
+
args,
|
173
|
+
{
|
174
|
+
:http_path => 'assets/v1/assets/#{path_arguments[:asset_id]}/',
|
175
|
+
:http_method => :delete,
|
176
|
+
:http_success_code => '204',
|
177
|
+
:body => args,
|
178
|
+
:parameters => [
|
179
|
+
{ :name => :asset_id, :aliases => [ :id ], :required => true, :send_in => :path },
|
180
|
+
]
|
181
|
+
}.merge(options)
|
182
|
+
)
|
183
|
+
process_request(_request, options)
|
184
|
+
end
|
185
|
+
|
186
|
+
def asset_download_url_get(args = { }, options = { })
|
187
|
+
_request = Requests::BaseRequest.new(
|
188
|
+
args,
|
189
|
+
{
|
190
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/#{path_arguments[:file_id]}/download_url/',
|
191
|
+
:parameters => [
|
192
|
+
{ :name => :asset_id, :aliases => [ :id ], :required => true, :send_in => :path },
|
193
|
+
{ :name => :file_id, :required => true, :send_in => :path }
|
194
|
+
]
|
195
|
+
}.merge(options)
|
196
|
+
)
|
197
|
+
process_request(_request, options)
|
198
|
+
end
|
199
|
+
|
200
|
+
def asset_file_create(args = { }, options = { })
|
201
|
+
_request = Requests::BaseRequest.new(
|
202
|
+
args,
|
203
|
+
{
|
204
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/',
|
205
|
+
:http_method => :post,
|
206
|
+
:http_success_code => '201',
|
207
|
+
:body => args,
|
208
|
+
:parameters => [
|
209
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
210
|
+
|
211
|
+
{ :name => :file_set_id, :required => true },
|
212
|
+
{ :name => :file_date_create, :required => true },
|
213
|
+
{ :name => :file_date_modified, :required => true },
|
214
|
+
]
|
215
|
+
}.merge(options)
|
216
|
+
)
|
217
|
+
process_request(_request, options)
|
218
|
+
end
|
219
|
+
|
220
|
+
def asset_file_get(args = { }, options = { })
|
221
|
+
_request = Requests::BaseRequest.new(
|
222
|
+
args,
|
223
|
+
{
|
224
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/#{path_arguments[:file_id]}/',
|
225
|
+
:http_method => :get,
|
226
|
+
:http_success_code => '200',
|
227
|
+
:body => args,
|
228
|
+
:parameters => [
|
229
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
230
|
+
{ :name => :file_id, :aliases => [ :id ], :send_in => :path }
|
231
|
+
]
|
232
|
+
}.merge(options)
|
233
|
+
)
|
234
|
+
process_request(_request, options)
|
235
|
+
end
|
236
|
+
|
237
|
+
def asset_file_update(args = { }, options = { })
|
238
|
+
_request = Requests::BaseRequest.new(
|
239
|
+
args,
|
240
|
+
{
|
241
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/#{path_arguments[:file_id]}/',
|
242
|
+
:http_method => :patch,
|
243
|
+
:http_success_code => '201',
|
244
|
+
:body => args,
|
245
|
+
:parameters => [
|
246
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
247
|
+
{ :name => :file_id, :required => true, :send_in => :path },
|
248
|
+
|
249
|
+
{ :name => :file_set_id, :required => true },
|
250
|
+
{ :name => :file_date_create, :required => true },
|
251
|
+
{ :name => :file_date_modified, :required => true },
|
252
|
+
]
|
253
|
+
}.merge(options)
|
254
|
+
)
|
255
|
+
process_request(_request, options)
|
256
|
+
end
|
257
|
+
|
258
|
+
def asset_file_keyframes_create(args = { }, options = { })
|
259
|
+
_request = Requests::BaseRequest.new(
|
260
|
+
args,
|
261
|
+
{
|
262
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/#{path_arguments[:file_id]}/keyframes/',
|
263
|
+
:http_method => :post,
|
264
|
+
:http_success_code => '201',
|
265
|
+
:body => args,
|
266
|
+
:parameters => [
|
267
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
268
|
+
{ :name => :file_id, :required => true, :send_in => :path },
|
269
|
+
]
|
270
|
+
}.merge(options)
|
271
|
+
)
|
272
|
+
process_request(_request, options)
|
273
|
+
end
|
274
|
+
|
275
|
+
def asset_file_set_create(args = { }, options = { })
|
276
|
+
_request = Requests::BaseRequest.new(
|
277
|
+
args,
|
278
|
+
{
|
279
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/file_sets/',
|
280
|
+
:http_method => :post,
|
281
|
+
:http_success_code => '201',
|
282
|
+
:body => args,
|
283
|
+
:parameters => [
|
284
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
285
|
+
]
|
286
|
+
}.merge(options)
|
287
|
+
)
|
288
|
+
process_request(_request, options)
|
289
|
+
end
|
290
|
+
alias :asset_fileset_create :asset_file_set_create
|
291
|
+
|
292
|
+
def asset_files_get(args = { }, options = { })
|
293
|
+
_request = Requests::BaseRequest.new(
|
294
|
+
args,
|
295
|
+
{
|
296
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/files/',
|
297
|
+
:parameters => [
|
298
|
+
{ :name => :asset_id, :aliases => [ :id ], :required => true, :send_in => :path },
|
299
|
+
{ :name => :generate_signed_url, :send_in => :query }
|
300
|
+
]
|
301
|
+
}.merge(options)
|
302
|
+
)
|
303
|
+
process_request(_request, options)
|
304
|
+
end
|
305
|
+
|
306
|
+
def asset_format_create(args = { }, options = { })
|
307
|
+
_request = Requests::BaseRequest.new(
|
308
|
+
args,
|
309
|
+
{
|
310
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/',
|
311
|
+
:http_method => :post,
|
312
|
+
:http_success_code => '201',
|
313
|
+
:body => args,
|
314
|
+
:parameters => [
|
315
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
316
|
+
{ :name => :name, :default_value => 'ORIGINAL' },
|
317
|
+
{ :name => :metadata }
|
318
|
+
]
|
319
|
+
}.merge(options)
|
320
|
+
)
|
321
|
+
process_request(_request, options)
|
322
|
+
end
|
323
|
+
|
324
|
+
def asset_format_file_sets_get(args = { }, options = { })
|
325
|
+
_request = Requests::BaseRequest.new(
|
326
|
+
args,
|
327
|
+
{
|
328
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/#{path_arguments[:format_id]}/file_sets/',
|
329
|
+
:http_method => :get,
|
330
|
+
:http_success_code => '200',
|
331
|
+
:body => args,
|
332
|
+
:parameters => [
|
333
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
334
|
+
{ :name => :format_id, :aliases => [ :id ], :send_in => :path }
|
335
|
+
]
|
336
|
+
}.merge(options)
|
337
|
+
)
|
338
|
+
process_request(_request, options)
|
339
|
+
end
|
340
|
+
|
341
|
+
def asset_format_file_sets_sources_get(args = { }, options = { })
|
342
|
+
_request = Requests::BaseRequest.new(
|
343
|
+
args,
|
344
|
+
{
|
345
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/#{path_arguments[:format_id]}/file_sets/sources/',
|
346
|
+
:http_method => :get,
|
347
|
+
:http_success_code => '200',
|
348
|
+
:body => args,
|
349
|
+
:parameters => [
|
350
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
351
|
+
{ :name => :format_id, :aliases => [ :id ], :send_in => :path }
|
352
|
+
]
|
353
|
+
}.merge(options)
|
354
|
+
)
|
355
|
+
process_request(_request, options)
|
356
|
+
end
|
357
|
+
|
358
|
+
def asset_format_get_by_name(args = { }, options = { })
|
359
|
+
_request = Requests::BaseRequest.new(
|
360
|
+
args,
|
361
|
+
{
|
362
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/#{path_arguments[:format_name]}/',
|
363
|
+
:http_method => :get,
|
364
|
+
:http_success_code => '200',
|
365
|
+
:body => args,
|
366
|
+
:parameters => [
|
367
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
368
|
+
{ :name => :format_name, :aliases => [ :name ], :send_in => :path }
|
369
|
+
]
|
370
|
+
}.merge(options)
|
371
|
+
)
|
372
|
+
process_request(_request, options)
|
373
|
+
end
|
374
|
+
|
375
|
+
def asset_formats_get(args = { }, options = { })
|
376
|
+
_request = Requests::BaseRequest.new(
|
377
|
+
args,
|
378
|
+
{
|
379
|
+
:http_path => 'files/v1/assets/#{path_arguments[:asset_id]}/formats/',
|
380
|
+
:http_method => :get,
|
381
|
+
:http_success_code => '200',
|
382
|
+
:body => args,
|
383
|
+
:parameters => [
|
384
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
385
|
+
{ :name => :name, :default_value => 'ORIGINAL' },
|
386
|
+
{ :name => :metadata }
|
387
|
+
]
|
388
|
+
}.merge(options)
|
389
|
+
)
|
390
|
+
process_request(_request, options)
|
391
|
+
end
|
392
|
+
|
393
|
+
|
394
|
+
def asset_keyframes_get(args = { }, options = { })
|
395
|
+
|
396
|
+
end
|
397
|
+
|
398
|
+
def asset_metadata_set(args = { }, options = { })
|
399
|
+
_request = Requests::BaseRequest.new(
|
400
|
+
args,
|
401
|
+
{
|
402
|
+
:http_path => 'metadata/v1/assets/#{path_arguments[:asset_id]}/views/#{path_arguments[:view_id]}/',
|
403
|
+
:http_method => :put,
|
404
|
+
:http_success_code => '201',
|
405
|
+
:body => args,
|
406
|
+
:parameters => [
|
407
|
+
{ :name => :asset_id, :required => true, :send_in => :path },
|
408
|
+
{ :name => :view_id, :required => true, :send_in => :path },
|
409
|
+
{ :name => :metadata_values }
|
410
|
+
]
|
411
|
+
}.merge(options)
|
412
|
+
)
|
413
|
+
process_request(_request, options)
|
414
|
+
end
|
415
|
+
|
416
|
+
def assets_get(args = { }, options = { })
|
417
|
+
_request = Requests::BaseRequest.new(
|
418
|
+
args,
|
419
|
+
{
|
420
|
+
:http_path => 'assets/v1/assets/',
|
421
|
+
:default_parameter_send_in_value => :query,
|
422
|
+
:parameters => [
|
423
|
+
{ :name => :per_page },
|
424
|
+
{ :name => :page },
|
425
|
+
{ :name => :sort },
|
426
|
+
{ :name => :filter }
|
427
|
+
]
|
428
|
+
}.merge(options)
|
429
|
+
)
|
430
|
+
process_request(_request, options)
|
431
|
+
end
|
432
|
+
|
433
|
+
def assets_reindex(args = { }, options = { })
|
434
|
+
http(:post, 'assets/v1/assets/reindex/')
|
435
|
+
end
|
436
|
+
|
437
|
+
# Login by using email and password
|
438
|
+
# @see https://app.iconik.io/docs/apidocs.html?url=/docs/auth/spec/#/default/post_v1_auth_simple_login_
|
439
|
+
def auth_login_simple(args = { }, options = { })
|
440
|
+
_request = Requests::BaseRequest.new(
|
441
|
+
args,
|
442
|
+
{
|
443
|
+
:http_path => 'auth/v1/auth/simple/login/',
|
444
|
+
:http_method => :post,
|
445
|
+
:http_success_code => '201',
|
446
|
+
:parameters => [
|
447
|
+
{ :name => :email, :required => true },
|
448
|
+
{ :name => :password, :required => true }
|
449
|
+
]
|
450
|
+
}.merge(options)
|
451
|
+
)
|
452
|
+
process_request(_request, options)
|
453
|
+
end
|
454
|
+
|
455
|
+
# Check if auth token valid
|
456
|
+
# @see https://app.iconik.io/docs/apidocs.html?url=/docs/auth/spec/#/default/get_v1_auth_token_
|
457
|
+
# @deprecated
|
458
|
+
def auth_token_get(args = { }, options = { })
|
459
|
+
_token = args[:token] || token
|
460
|
+
_token = token.to_s if _token.respond_to?(:to_s)
|
461
|
+
http(:get, 'auth/v1/auth/token/', { :headers => { http_client.header_auth_key => _token } })
|
462
|
+
end
|
463
|
+
|
464
|
+
# Refresh token
|
465
|
+
# @see https://app.iconik.io/docs/apidocs.html?url=/docs/auth/spec/#/default/put_v1_auth_token_
|
466
|
+
# @deprecated
|
467
|
+
def auth_token_refresh(args = { }, options = { })
|
468
|
+
http(:put, 'auth/v1/auth/token/')
|
469
|
+
end
|
470
|
+
|
471
|
+
def collection_create(args = { }, options = { })
|
472
|
+
_request = Requests::BaseRequest.new(
|
473
|
+
args,
|
474
|
+
{
|
475
|
+
:http_path => 'assets/v1/collections/',
|
476
|
+
:http_method => :post,
|
477
|
+
:http_success_code => '201',
|
478
|
+
:body => args, # Passthrough all arguments passed to the request body
|
479
|
+
:parameters => [
|
480
|
+
{ :name => :title, :aliases => [:collection_title, :collection_name, :name ] },
|
481
|
+
{ :name => :description },
|
482
|
+
{ :name => :parent_id },
|
483
|
+
{ :name => :is_root },
|
484
|
+
{ :name => :date_created },
|
485
|
+
{ :name => :description }
|
486
|
+
]
|
487
|
+
}.merge(options)
|
488
|
+
)
|
489
|
+
process_request(_request, options)
|
490
|
+
end
|
491
|
+
|
492
|
+
def collection_delete(args = { }, options = { })
|
493
|
+
_request = Requests::BaseRequest.new(
|
494
|
+
args,
|
495
|
+
{
|
496
|
+
:http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/',
|
497
|
+
:http_method => :delete,
|
498
|
+
:http_success_code => '201',
|
499
|
+
:parameters => [
|
500
|
+
{ :name => :collection_id, :aliases => [ :id ], :send_in => :path }
|
501
|
+
]
|
502
|
+
}.merge(options)
|
503
|
+
)
|
504
|
+
process_request(_request, options)
|
505
|
+
end
|
506
|
+
|
507
|
+
def collection_replace(args = { }, options = { })
|
508
|
+
_request = Requests::BaseRequest.new(
|
509
|
+
args,
|
510
|
+
{
|
511
|
+
:http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/',
|
512
|
+
:http_method => :put,
|
513
|
+
:http_success_code => '200',
|
514
|
+
:parameters => [
|
515
|
+
{ :name => :collection_id, :aliases => [ :id ], :send_in => :path },
|
516
|
+
{ :name => :title, :aliases => [ :collection_title, :collection_name, :name ] },
|
517
|
+
{ :name => :description },
|
518
|
+
{ :name => :parent_id },
|
519
|
+
{ :name => :is_root },
|
520
|
+
{ :name => :date_created },
|
521
|
+
{ :name => :description }
|
522
|
+
]
|
523
|
+
}.merge(options)
|
524
|
+
)
|
525
|
+
process_request(_request, options)
|
526
|
+
end
|
527
|
+
|
528
|
+
def collection_update(args = { }, options = { })
|
529
|
+
_request = Requests::BaseRequest.new(
|
530
|
+
args,
|
531
|
+
{
|
532
|
+
:http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/',
|
533
|
+
:http_method => :patch,
|
534
|
+
:http_success_code => '200',
|
535
|
+
:parameters => [
|
536
|
+
{ :name => :collection_id, :aliases => [ :id ], :send_in => :path },
|
537
|
+
{ :name => :title, :aliases => [ :collection_title, :collection_name, :name ] },
|
538
|
+
{ :name => :description },
|
539
|
+
{ :name => :parent_id },
|
540
|
+
{ :name => :is_root },
|
541
|
+
{ :name => :date_created },
|
542
|
+
{ :name => :description }
|
543
|
+
]
|
544
|
+
}.merge(options)
|
545
|
+
)
|
546
|
+
process_request(_request, options)
|
547
|
+
end
|
548
|
+
|
549
|
+
def collection_get(args = { }, options = { })
|
550
|
+
_request = Requests::BaseRequest.new(
|
551
|
+
args,
|
552
|
+
{
|
553
|
+
:http_path => 'assets/v1/collections/#{arguments[:collection_id]}/',
|
554
|
+
:body => args,
|
555
|
+
:parameters => [
|
556
|
+
{ :name => :collection_id }
|
557
|
+
]
|
558
|
+
}.merge(options)
|
559
|
+
)
|
560
|
+
process_request(_request, options)
|
561
|
+
end
|
562
|
+
|
563
|
+
def collection_content_add(args = { }, options = { })
|
564
|
+
_request = Requests::BaseRequest.new(
|
565
|
+
args,
|
566
|
+
{
|
567
|
+
:http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/contents/',
|
568
|
+
:http_method => :post,
|
569
|
+
:http_success_code => '201',
|
570
|
+
:body => args,
|
571
|
+
:parameters => [
|
572
|
+
{ :name => :collection_id, :send_in => :path },
|
573
|
+
{ :name => :object_id },
|
574
|
+
{ :name => :object_type },
|
575
|
+
{ :name => :date_created },
|
576
|
+
]
|
577
|
+
}.merge(options)
|
578
|
+
)
|
579
|
+
process_request(_request, options)
|
580
|
+
end
|
581
|
+
|
582
|
+
|
583
|
+
def collection_contents_get(args = { }, options = { })
|
584
|
+
_request = Requests::BaseRequest.new(
|
585
|
+
args,
|
586
|
+
{
|
587
|
+
:http_path => 'assets/v1/collections/#{path_arguments[:collection_id]}/contents/',
|
588
|
+
:parameters => [
|
589
|
+
{ :name => :collection_id, :aliases => [ :id ], :send_in => :path },
|
590
|
+
{ :name => :content_types }, # Comma separated list of content types. Example - assets,collections
|
591
|
+
{ :name => :per_page },
|
592
|
+
{ :name => :page },
|
593
|
+
{ :name => :sort }, # A comma separated list of fieldnames with order. For example - first_name,asc;last_name,desc
|
594
|
+
{ :name => :filter }, # A comma separated list of fieldnames with order For example - first_name,eq,Vlad;last_name,eq,Gudkov
|
595
|
+
]
|
596
|
+
}.merge(options)
|
597
|
+
)
|
598
|
+
process_request(_request, options)
|
599
|
+
end
|
600
|
+
|
601
|
+
def collections_get(args = { }, options = { })
|
602
|
+
http(:get, 'assets/v1/collections/')
|
603
|
+
end
|
604
|
+
|
605
|
+
def collections_reindex(args = { }, options = { })
|
606
|
+
http(:post, 'assets/collections/reindex/')
|
607
|
+
end
|
608
|
+
|
609
|
+
def file_set_files_get(args = { }, options = { })
|
610
|
+
_request = Requests::BaseRequest.new(
|
611
|
+
args,
|
612
|
+
{
|
613
|
+
:http_path => 'files/v1/file_sets/#{path_arguments[:file_set_id]}/files/',
|
614
|
+
:parameters => [
|
615
|
+
{ :name => :file_set_id, :aliases => [ :id ], :send_in => :path },
|
616
|
+
]
|
617
|
+
}.merge(options)
|
618
|
+
)
|
619
|
+
process_request(_request, options)
|
620
|
+
end
|
621
|
+
|
622
|
+
def metadata_field_create(args = { }, options = { })
|
623
|
+
_request = Requests::BaseRequest.new(
|
624
|
+
args,
|
625
|
+
{
|
626
|
+
:http_path => 'files/v1/storages/',
|
627
|
+
:http_method => :post,
|
628
|
+
:http_success_code => '201',
|
629
|
+
:body => args,
|
630
|
+
:parameters => [
|
631
|
+
]
|
632
|
+
}.merge(options)
|
633
|
+
)
|
634
|
+
process_request(_request, options)
|
635
|
+
end
|
636
|
+
|
637
|
+
def storage_create(args = { }, options = { })
|
638
|
+
# http(:post, 'files/v1/storages/', args)
|
639
|
+
|
640
|
+
_request = Requests::BaseRequest.new(
|
641
|
+
args,
|
642
|
+
{
|
643
|
+
:http_path => 'files/v1/storages/',
|
644
|
+
:http_method => :post,
|
645
|
+
:http_success_code => '201',
|
646
|
+
:body => args,
|
647
|
+
:parameters => [
|
648
|
+
]
|
649
|
+
}.merge(options)
|
650
|
+
)
|
651
|
+
process_request(_request, options)
|
652
|
+
end
|
653
|
+
|
654
|
+
def storage_files_get(args = { }, options = { })
|
655
|
+
_request = Requests::BaseRequest.new(
|
656
|
+
args,
|
657
|
+
{
|
658
|
+
:http_path => 'files/v1/storages/#{path_arguments[:storage_id]}/files/',
|
659
|
+
:body => args,
|
660
|
+
:parameters => [
|
661
|
+
{ :name => :storage_id, :required => true, :send_in => :path },
|
662
|
+
{ :name => :path }
|
663
|
+
]
|
664
|
+
}.merge(options)
|
665
|
+
)
|
666
|
+
process_request(_request, options)
|
667
|
+
end
|
668
|
+
|
669
|
+
def storages_get(args = { }, options = { })
|
670
|
+
http(:get, 'files/v1/storages/')
|
671
|
+
end
|
672
|
+
|
673
|
+
def token
|
674
|
+
http_client.token
|
675
|
+
end
|
676
|
+
|
677
|
+
def token=(token_data)
|
678
|
+
http_client.token = token_data
|
679
|
+
end
|
680
|
+
|
681
|
+
def transcode(args = { }, options = { })
|
682
|
+
_request = Requests::BaseRequest.new(
|
683
|
+
args,
|
684
|
+
{
|
685
|
+
:http_path => 'transcode/v1/transcode/',
|
686
|
+
:http_method => :post,
|
687
|
+
:http_success_code => '201',
|
688
|
+
:parameters => [
|
689
|
+
]
|
690
|
+
}.merge(options)
|
691
|
+
)
|
692
|
+
process_request(_request, options)
|
693
|
+
end
|
694
|
+
|
695
|
+
# @!endgroup API Endpoints
|
696
|
+
# ############################################################################################################## #
|
697
|
+
|
698
|
+
# Client
|
699
|
+
end
|
700
|
+
|
701
|
+
# API
|
702
|
+
end
|
703
|
+
|
704
|
+
# Iconik
|
705
|
+
end
|
706
|
+
|
707
|
+
# Ubiquity
|
708
|
+
end
|