mints 0.0.19 → 0.0.22

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
@@ -1,11 +1,11 @@
1
1
  module Pages
2
2
  ##
3
- # == Pages
3
+ # == Content Pages
4
4
  #
5
5
 
6
6
  ###
7
7
  # === Get page groups.
8
- # Get page groups.
8
+ # Get content page groups.
9
9
  #
10
10
  # ==== Example
11
11
  # @data = @mints_user.get_page_groups
@@ -14,7 +14,7 @@ module Pages
14
14
  end
15
15
 
16
16
  # === Get pages.
17
- # Get a collection of pages.
17
+ # Get a collection of content pages.
18
18
  #
19
19
  # ==== Example
20
20
  # @data = @mints_user.get_pages
@@ -23,7 +23,7 @@ module Pages
23
23
  end
24
24
 
25
25
  # === Get page.
26
- # Get a page.
26
+ # Get a content page.
27
27
  #
28
28
  # ==== Parameters
29
29
  # id:: (Integer) -- Page id.
@@ -35,7 +35,7 @@ module Pages
35
35
  end
36
36
 
37
37
  # === Create page.
38
- # Create a page with data.
38
+ # Create a content page with data.
39
39
  #
40
40
  # ==== Parameters
41
41
  # data:: (Hash) -- Data to be submited.
@@ -52,7 +52,7 @@ module Pages
52
52
  end
53
53
 
54
54
  # === Update page.
55
- # Update a page info.
55
+ # Update a content page info.
56
56
  #
57
57
  # ==== Parameters
58
58
  # id:: (Integer) -- Page id.
@@ -68,7 +68,7 @@ module Pages
68
68
  end
69
69
 
70
70
  # === Delete page.
71
- # Delete a page.
71
+ # Delete a content page.
72
72
  #
73
73
  # ==== Parameters
74
74
  # id:: (Integer) -- Page id.
data/lib/user.rb CHANGED
@@ -48,7 +48,7 @@ module Mints
48
48
 
49
49
  attr_reader :client
50
50
  def initialize(host, api_key, session_token = nil, debug = false)
51
- @client = Mints::Client.new(host, api_key, 'user', session_token, nil, debug)
51
+ @client = Mints::Client.new(host, api_key, 'user', session_token, nil, nil, debug)
52
52
  end
53
53
 
54
54
  def login(email, password)
metadata CHANGED
@@ -1,22 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mints
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-02 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 1.8.3
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 1.8.3
@@ -24,9 +21,6 @@ dependencies:
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: 1.8.3
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
26
  version: 1.8.3
@@ -34,80 +28,80 @@ dependencies:
34
28
  name: httparty
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
31
+ - - ">="
38
32
  - !ruby/object:Gem::Version
39
33
  version: 0.18.0
40
- - - ">="
34
+ - - "~>"
41
35
  - !ruby/object:Gem::Version
42
36
  version: 0.18.0
43
37
  type: :runtime
44
38
  prerelease: false
45
39
  version_requirements: !ruby/object:Gem::Requirement
46
40
  requirements:
47
- - - "~>"
41
+ - - ">="
48
42
  - !ruby/object:Gem::Version
49
43
  version: 0.18.0
50
- - - ">="
44
+ - - "~>"
51
45
  - !ruby/object:Gem::Version
52
46
  version: 0.18.0
53
47
  - !ruby/object:Gem::Dependency
54
48
  name: redis
55
49
  requirement: !ruby/object:Gem::Requirement
56
50
  requirements:
57
- - - "~>"
51
+ - - ">="
58
52
  - !ruby/object:Gem::Version
59
53
  version: 4.2.2
60
- - - ">="
54
+ - - "~>"
61
55
  - !ruby/object:Gem::Version
62
56
  version: 4.2.2
63
57
  type: :runtime
64
58
  prerelease: false
65
59
  version_requirements: !ruby/object:Gem::Requirement
66
60
  requirements:
67
- - - "~>"
61
+ - - ">="
68
62
  - !ruby/object:Gem::Version
69
63
  version: 4.2.2
70
- - - ">="
64
+ - - "~>"
71
65
  - !ruby/object:Gem::Version
72
66
  version: 4.2.2
73
67
  - !ruby/object:Gem::Dependency
74
68
  name: addressable
75
69
  requirement: !ruby/object:Gem::Requirement
76
70
  requirements:
77
- - - "~>"
71
+ - - ">="
78
72
  - !ruby/object:Gem::Version
79
73
  version: 2.7.0
80
- - - ">="
74
+ - - "~>"
81
75
  - !ruby/object:Gem::Version
82
76
  version: 2.7.0
83
77
  type: :runtime
84
78
  prerelease: false
85
79
  version_requirements: !ruby/object:Gem::Requirement
86
80
  requirements:
87
- - - "~>"
81
+ - - ">="
88
82
  - !ruby/object:Gem::Version
89
83
  version: 2.7.0
90
- - - ">="
84
+ - - "~>"
91
85
  - !ruby/object:Gem::Version
92
86
  version: 2.7.0
93
87
  - !ruby/object:Gem::Dependency
94
88
  name: rails-reverse-proxy
95
89
  requirement: !ruby/object:Gem::Requirement
96
90
  requirements:
97
- - - "~>"
91
+ - - ">="
98
92
  - !ruby/object:Gem::Version
99
93
  version: 0.9.1
100
- - - ">="
94
+ - - "~>"
101
95
  - !ruby/object:Gem::Version
102
96
  version: 0.9.1
103
97
  type: :runtime
104
98
  prerelease: false
105
99
  version_requirements: !ruby/object:Gem::Requirement
106
100
  requirements:
107
- - - "~>"
101
+ - - ">="
108
102
  - !ruby/object:Gem::Version
109
103
  version: 0.9.1
110
- - - ">="
104
+ - - "~>"
111
105
  - !ruby/object:Gem::Version
112
106
  version: 0.9.1
113
107
  description:
@@ -124,8 +118,10 @@ files:
124
118
  - lib/generators/mints_config.yml.erb
125
119
  - lib/generators/mints_contact_controller.rb
126
120
  - lib/generators/mints_files_generator.rb
121
+ - lib/generators/mints_link.rb
127
122
  - lib/generators/mints_public_controller.rb
128
123
  - lib/generators/mints_user_controller.rb
124
+ - lib/generators/short_link_controller.rb
129
125
  - lib/mints.rb
130
126
  - lib/mints/controllers/admin_base_controller.rb
131
127
  - lib/mints/controllers/base_api_controller.rb
@@ -214,8 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
210
  - !ruby/object:Gem::Version
215
211
  version: '0'
216
212
  requirements: []
217
- rubyforge_project:
218
- rubygems_version: 2.7.6.2
213
+ rubygems_version: 3.0.3.1
219
214
  signing_key:
220
215
  specification_version: 4
221
216
  summary: MINTS gem allows to connect your Rails App to MINTS.CLOUD