mints 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,10 @@
1
1
  module Assets
2
+
3
+
2
4
  ##
3
5
  # == Assets
4
6
  #
5
7
 
6
- def upload_asset(data)
7
- return @client.raw("post", "/content/assets/upload", nil, data)
8
- end
9
8
 
10
9
  # === Get asset link info.
11
10
  # Get information of an asset by url.
@@ -26,7 +25,7 @@ module Assets
26
25
  # Get information of an asset.
27
26
  #
28
27
  # ==== Parameters
29
- # * +id+ - [Integer] Asset id.
28
+ # id:: (Integer) -- Asset id.
30
29
  #
31
30
  # ==== Example
32
31
  # @data = @mints_user.download_asset(2)
@@ -34,65 +33,228 @@ module Assets
34
33
  return @client.raw("get", "/content/assets/download/#{id}")
35
34
  end
36
35
 
37
- def edit_asset_size(data) #TODO: Not tested
38
- return @client.raw("post", "/content/assets/editSize", nil, data)
36
+ # FIXME: Returns json invalid token
37
+ # def get_asset_thumbnails(id)
38
+ # return @client.raw("get", "/content/assets/thumbnails/#{id}")
39
+ #end
40
+
41
+ # === Get asset usage.
42
+ # Get usage of an asset.
43
+ #
44
+ # ==== Parameters
45
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
46
+ def get_asset_usage(options) #get, le mandas el asset id para saber donde lo has puesto
47
+ return @client.raw("get", "/content/assets/usage", options)
39
48
  end
40
49
 
41
- def upload_asset_variation(data) #FIXME: Call to a member function guessClientExtension() on null
42
- return @client.raw("post", "/content/assets/uploadVariation", nil, data)
50
+ # === Get asset info.
51
+ # Get info of an asset.
52
+ #TODO: Research if is an asset or many assets
53
+ #
54
+ # ==== Parameters
55
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
56
+ def get_asset_info(options)
57
+ return @client.raw("get", "/content/assets/getAssetInfo", options)
43
58
  end
44
59
 
45
- def create_asset_size(data) #FIXME: Trying to get property 'path' of non-object
46
- return @client.raw("post", "/content/assets/createSize", nil, data)
60
+ # === Get asset doc types.
61
+ # Get doc types of assets.
62
+ def get_asset_doc_types
63
+ return @client.raw("get", "/content/assets/docTypes")
47
64
  end
48
65
 
49
- def update_asset_variation(id, data) #TODO:
50
- return @client.raw("post", "/content/assets/updateVariation/#{id}", nil, data)
66
+ # === Get asset public route.
67
+ # Get public route of assets.
68
+ def get_asset_public_route
69
+ return @client.raw("get", "/content/assets/publicRoute")
51
70
  end
52
-
53
- def get_asset_sizes(id) #FIXME: wrong number of arguments (given 1, expected 0)
54
- return @client.raw("get", "/content/assets/sizes/#{id}")
71
+
72
+ # === Upload asset.
73
+ # Upload an asset. It can be images, documents and videos.
74
+ #
75
+ # ==== Parameters
76
+ # data:: (Hash) -- Data to be submited.
77
+ #
78
+ # ==== First Example (with files)
79
+ #
80
+ #
81
+ # ==== Second Example (with urls)
82
+ # data = {
83
+ # "title": "asset title",
84
+ # "description": "asset description",
85
+ # "link": "https://link/example",
86
+ # "url-type": "url-image",
87
+ # "slug": "slug",
88
+ # "type": "link",
89
+ # "father_id": 1
90
+ # }
91
+ # @data = @mints_user.upload_asset(data.to_json)
92
+ #
93
+ # ==== Third Example (with video)
94
+ # data = {
95
+ # "title": "Video Title",
96
+ # "fileType": "video/mp4",
97
+ # "type": "video",
98
+ # "slug": "video-slug",
99
+ # "status": "not-uploaded",
100
+ # "ext": "mp4",
101
+ # "size": 29605264,
102
+ # "access_token": "access_token",
103
+ # "name": "Video Title",
104
+ # "videoData": {
105
+ # "id": 80313307,
106
+ # "name": "Video Title",
107
+ # "type": "video",
108
+ # "created": "2021-10-19T19:18:17+00:00",
109
+ # "updated": "2021-10-19T19:18:17+00:00",
110
+ # "duration": 191.936133,
111
+ # "hashed_id": "hashed_id",
112
+ # "progress": 0.14285714285714285,
113
+ # "status": "queued",
114
+ # "thumbnail": {
115
+ # "url": "https://www.example.com/img/img.jpg",
116
+ # "width": 200,
117
+ # "height": 120
118
+ # },
119
+ # "account_id": 1234567
120
+ # }
121
+ # }
122
+ # @data = @mints_user.upload_asset(data.to_json)
123
+ def upload_asset(data) #TODO: Research a way to upload a File accross sdk
124
+ return @client.raw("post", "/content/assets/upload", nil, data)
55
125
  end
56
126
 
57
- def get_original_asset(id) #FIXME: Doesn't return JSON
58
- return @client.raw("get", "/content/assets/original/#{id}")
59
- end
60
127
 
61
- def get_asset_variation(id)
62
- #FIXME: Id 1 and 4: Trying to get property 'path' of non-object
63
- #FIXME: Id 2 and 3: File not found at path maybe doesnt exist
64
- return @client.raw("get", "/content/assets/variation/#{id}")
65
- end
128
+ ##
129
+ # == Sizes
130
+ #
66
131
 
132
+
133
+ #FIXME: Double get asset sizes method!
134
+ # === Get asset sizes.
135
+ # Get a collection of sizes of an asset.
136
+ #
137
+ # ==== Parameters
138
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
67
139
  def get_asset_sizes(options)
68
140
  return @client.raw("get", "/content/assets/getSizes", options)
69
141
  end
70
142
 
71
- def get_asset_usage(options)
72
- return @client.raw("get", "/content/assets/usage", options)
143
+ # === Get asset sizes.
144
+ # Get sizes of an asset.
145
+ #
146
+ # ==== Parameters
147
+ # id:: (Integer) Asset id.
148
+ #
149
+ # ==== Example
150
+ # @data = @mints_user.get_asset_sizes(2)
151
+ def get_asset_sizes(id) #FIXME: wrong number of arguments (given 1, expected 0)
152
+ return @client.raw("get", "/content/assets/sizes/#{id}")
73
153
  end
74
154
 
75
- def delete_asset_variation #TODO: Not tested
76
- return @client.raw("get", "/content/assets/deleteVariation")
155
+ # === Create asset size.
156
+ # Create an asset size by data.
157
+ #
158
+ # ==== Parameters
159
+ # data:: (Hash) -- Data to be submited.
160
+ #
161
+ # ==== Example
162
+ # data = {
163
+ # "aspectRadio": "custom",
164
+ # "assetId": 23,
165
+ # "drawPosData": {
166
+ # "pos": {
167
+ # "sx": 100,
168
+ # "sy": 100,
169
+ # "swidth": 200,
170
+ # "sheight": 200
171
+ # }
172
+ # },
173
+ # "width": 100,
174
+ # "height": 100,
175
+ # "slug": "fuji_size_slug",
176
+ # "title": "fuji_size",
177
+ # "variationId": "original"
178
+ # }
179
+ # @data = @mints_user.create_asset_size(data.to_json)
180
+ def create_asset_size(data)
181
+ return @client.raw("post", "/content/assets/createSize", nil, data)
182
+ end
183
+
184
+ # === Edit asset size.
185
+ # Edit an asset size.
186
+ #
187
+ # ==== Parameters
188
+ # data:: (Hash) -- Data to be submited.
189
+ def edit_asset_size(data) #TODO: Not tested
190
+ return @client.raw("post", "/content/assets/editSize", nil, data)
77
191
  end
78
192
 
193
+ # === Delete asset size.
79
194
  def delete_asset_size #TODO: Not tested
80
- return @client.raw("get", "/content/assets/deleteSize")
195
+ return @client.raw("get", "/content/assets/deleteSize") #DELETE OR GET?
81
196
  end
82
197
 
83
- def get_asset_info(options)
84
- return @client.raw("get", "/content/assets/getAssetInfo", options)
198
+
199
+ ##
200
+ # == Variations
201
+ #
202
+
203
+
204
+ # === Get asset variation.
205
+ # Get variation of an asset.
206
+ #
207
+ # ==== Parameters
208
+ # id:: (Integer) Asset variation id. #TODO: Research if is an asset id or an variation id
209
+ #
210
+ # ==== Example
211
+ # @data = @mints_user.get_asset_sizes(2)
212
+ def get_asset_variation(id)
213
+ #FIXME: Id 1 and 4: Trying to get property 'path' of non-object maybe json convertion is bad
214
+ #FIXME: Id 2 and 3: File not found at path maybe doesnt exist
215
+ return @client.raw("get", "/content/assets/variation/#{id}")
85
216
  end
86
217
 
218
+ # === Generate asset variation.
219
+ # Create an asset variation of an existing asset.
220
+ #
221
+ # ==== Parameters
222
+ # data:: (Hash) -- Data to be submited.
87
223
  def generate_asset_variation(data) #FIXME: Trying to get property 'width' of non-object
88
224
  return @client.raw("post", "/content/assets/generateAssetVariations", nil, data)
89
225
  end
90
226
 
91
- def get_asset_doc_types
92
- return @client.raw("get", "/content/assets/docTypes")
227
+ # === Upload asset variation.
228
+ #
229
+ # ==== Parameters
230
+ # data:: (Hash) -- Data to be submited.
231
+ def upload_asset_variation(data) #FIXME: Call to a member function guessClientExtension() on null
232
+ return @client.raw("post", "/content/assets/uploadVariation", nil, data)
93
233
  end
94
234
 
95
- def get_asset_public_route
96
- return @client.raw("get", "/content/assets/publicRoute")
235
+ # === Update asset variation.
236
+ #
237
+ # ==== Parameters
238
+ # data:: (Hash) -- Data to be submited.
239
+ def update_asset_variation(id, data) #TODO:
240
+ return @client.raw("post", "/content/assets/updateVariation/#{id}", nil, data)
241
+ end
242
+
243
+ # === Delete asset variation.
244
+ def delete_asset_variation #TODO: Not tested
245
+ return @client.raw("get", "/content/assets/deleteVariation") #DELETE OR GET?
97
246
  end
247
+
248
+
249
+
250
+
251
+
252
+ # === Get original asset.
253
+ #
254
+ # ==== Parameters
255
+ # id:: (Integer) Asset id.
256
+ def get_original_asset(id) #FIXME: Doesn't return JSON
257
+ return @client.raw("get", "/content/assets/original/#{id}")
258
+ end
259
+
98
260
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mints
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo
@@ -124,8 +124,10 @@ files:
124
124
  - lib/generators/mints_config.yml.erb
125
125
  - lib/generators/mints_contact_controller.rb
126
126
  - lib/generators/mints_files_generator.rb
127
+ - lib/generators/mints_link.rb
127
128
  - lib/generators/mints_public_controller.rb
128
129
  - lib/generators/mints_user_controller.rb
130
+ - lib/generators/short_link_controller.rb
129
131
  - lib/mints.rb
130
132
  - lib/mints/controllers/admin_base_controller.rb
131
133
  - lib/mints/controllers/base_api_controller.rb