mints 0.0.27 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/lib/client.rb +287 -385
- data/lib/contact/config/appointments.rb +201 -0
- data/lib/contact/config/config.rb +7 -0
- data/lib/contact/content/content.rb +7 -0
- data/lib/contact/content/conversations.rb +121 -0
- data/lib/contact/ecommerce/ecommerce.rb +12 -0
- data/lib/contact/ecommerce/order_items.rb +19 -0
- data/lib/contact/ecommerce/order_items_groups.rb +95 -0
- data/lib/contact/ecommerce/orders.rb +133 -0
- data/lib/contact.rb +57 -607
- data/lib/errors.rb +4 -2
- data/lib/generators/mints_assets_controller.rb +4 -1
- data/lib/generators/mints_config.yml.erb +0 -2
- data/lib/generators/mints_contact_controller.rb +4 -1
- data/lib/generators/mints_files_generator.rb +16 -13
- data/lib/generators/mints_link.rb +9 -6
- data/lib/generators/mints_public_controller.rb +4 -1
- data/lib/generators/mints_user_controller.rb +3 -0
- data/lib/generators/short_link_controller.rb +4 -1
- data/lib/mints/controllers/admin_base_controller.rb +5 -3
- data/lib/mints/controllers/base_api_controller.rb +6 -4
- data/lib/mints/controllers/base_controller.rb +5 -3
- data/lib/mints/controllers/concerns/mints_clients.rb +4 -2
- data/lib/mints/controllers/concerns/read_config_file.rb +3 -1
- data/lib/mints/controllers/contact_api_controller.rb +12 -10
- data/lib/mints/controllers/public_api_controller.rb +10 -8
- data/lib/mints/controllers/user_api_controller.rb +11 -9
- data/lib/mints/helpers/contact_auth_helper.rb +3 -1
- data/lib/mints/helpers/mints_helper.rb +39 -38
- data/lib/mints/helpers/proxy_controllers_methods.rb +24 -24
- data/lib/mints/helpers/user_auth_helper.rb +5 -3
- data/lib/mints.rb +12 -10
- data/lib/pub.rb +75 -93
- data/lib/user/config/api_keys.rb +63 -61
- data/lib/user/config/appointments.rb +217 -215
- data/lib/user/config/attribute_groups.rb +74 -72
- data/lib/user/config/attributes.rb +83 -81
- data/lib/user/config/calendars.rb +88 -86
- data/lib/user/config/config.rb +31 -63
- data/lib/user/config/public_folders.rb +105 -104
- data/lib/user/config/relationships.rb +135 -132
- data/lib/user/config/roles.rb +76 -79
- data/lib/user/config/seeds.rb +52 -51
- data/lib/user/config/system_settings.rb +50 -49
- data/lib/user/config/tags.rb +57 -59
- data/lib/user/config/taxonomies.rb +115 -119
- data/lib/user/config/teams.rb +69 -68
- data/lib/user/config/users.rb +72 -71
- data/lib/user/contacts/contacts.rb +21 -20
- data/lib/user/content/assets.rb +275 -280
- data/lib/user/content/content.rb +236 -235
- data/lib/user/content/content_instances.rb +138 -138
- data/lib/user/content/content_templates.rb +105 -103
- data/lib/user/content/conversations.rb +195 -193
- data/lib/user/content/dam.rb +85 -80
- data/lib/user/content/forms.rb +231 -233
- data/lib/user/content/message_templates.rb +154 -151
- data/lib/user/content/messages.rb +89 -87
- data/lib/user/content/pages.rb +84 -82
- data/lib/user/content/stories.rb +101 -101
- data/lib/user/content/story_templates.rb +90 -88
- data/lib/user/content/story_versions.rb +117 -117
- data/lib/user/crm/companies.rb +106 -106
- data/lib/user/crm/contacts.rb +287 -292
- data/lib/user/crm/crm.rb +21 -19
- data/lib/user/crm/deals.rb +105 -103
- data/lib/user/crm/favorites.rb +16 -13
- data/lib/user/crm/segments.rb +123 -123
- data/lib/user/crm/users.rb +22 -20
- data/lib/user/crm/workflow_step_objects.rb +86 -84
- data/lib/user/crm/workflow_steps.rb +47 -45
- data/lib/user/crm/workflows.rb +67 -65
- data/lib/user/ecommerce/ecommerce.rb +29 -27
- data/lib/user/ecommerce/item_prices.rb +84 -81
- data/lib/user/ecommerce/locations.rb +162 -160
- data/lib/user/ecommerce/order_items_groups.rb +110 -106
- data/lib/user/ecommerce/order_statuses.rb +26 -24
- data/lib/user/ecommerce/orders.rb +253 -246
- data/lib/user/ecommerce/price_lists.rb +70 -68
- data/lib/user/ecommerce/product_templates.rb +101 -99
- data/lib/user/ecommerce/product_variations.rb +124 -120
- data/lib/user/ecommerce/products.rb +162 -159
- data/lib/user/ecommerce/skus.rb +87 -85
- data/lib/user/ecommerce/taxes.rb +81 -79
- data/lib/user/ecommerce/variant_options.rb +68 -66
- data/lib/user/ecommerce/variant_values.rb +71 -69
- data/lib/user/helpers/helpers.rb +104 -101
- data/lib/user/helpers/object_activities.rb +80 -78
- data/lib/user/helpers/object_folders.rb +78 -76
- data/lib/user/helpers/user_folders.rb +79 -77
- data/lib/user/marketing/marketing.rb +116 -113
- data/lib/user/profile/profile.rb +96 -103
- data/lib/user.rb +32 -41
- metadata +50 -43
- data/lib/user/config/importers.rb +0 -184
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Contacts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
end
|
|
4
|
+
##
|
|
5
|
+
# == Contact Auth
|
|
6
|
+
#
|
|
7
|
+
# === Change password no auth.
|
|
8
|
+
# Change password to an email without auth.
|
|
9
|
+
#
|
|
10
|
+
# ==== Parameters
|
|
11
|
+
# data:: (Hash) -- Data to be submitted.
|
|
12
|
+
#
|
|
13
|
+
# ==== Example
|
|
14
|
+
# data = {
|
|
15
|
+
# password: '12345678',
|
|
16
|
+
# email: 'email@example.com'
|
|
17
|
+
# }
|
|
18
|
+
# @data = @mints_user.change_password_no_auth(data)
|
|
19
|
+
def change_password_no_auth(data)
|
|
20
|
+
@client.raw('post', '/contacts/change-password-no-auth', nil, data_transform(data))
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/user/content/assets.rb
CHANGED
|
@@ -1,299 +1,294 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def get_assets(options = nil, use_post = true)
|
|
29
|
-
return get_query_results("/content/assets", options, use_post)
|
|
30
|
-
end
|
|
3
|
+
module Assets
|
|
4
|
+
##
|
|
5
|
+
# == Assets
|
|
6
|
+
#
|
|
7
|
+
# === Get assets.
|
|
8
|
+
# Get a collection of assets.
|
|
9
|
+
#
|
|
10
|
+
# ==== Parameters
|
|
11
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
12
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
|
13
|
+
#
|
|
14
|
+
# ==== First Example
|
|
15
|
+
# @data = @mints_user.get_assets
|
|
16
|
+
#
|
|
17
|
+
# ==== Second Example
|
|
18
|
+
# options = { fields: 'id, title' }
|
|
19
|
+
# @data = @mints_user.get_assets(options)
|
|
20
|
+
#
|
|
21
|
+
# ==== Third Example
|
|
22
|
+
# options = { fields: 'id, title' }
|
|
23
|
+
# @data = @mints_user.get_assets(options, true)
|
|
24
|
+
def get_assets(options = nil, use_post = true)
|
|
25
|
+
get_query_results('/content/assets', options, use_post)
|
|
26
|
+
end
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
# === Get asset.
|
|
29
|
+
# Get a asset info.
|
|
30
|
+
#
|
|
31
|
+
# ==== Parameters
|
|
32
|
+
# id:: (Integer) -- Asset id.
|
|
33
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
34
|
+
#
|
|
35
|
+
# ==== First Example
|
|
36
|
+
# @data = @mints_user.get_asset(1)
|
|
37
|
+
#
|
|
38
|
+
# ==== Second Example
|
|
39
|
+
# options = {
|
|
40
|
+
# fields: 'id, title'
|
|
41
|
+
# }
|
|
42
|
+
# @data = @mints_user.get_asset(1, options)
|
|
43
|
+
def get_asset(id, options = nil)
|
|
44
|
+
@client.raw('get', "/content/assets/#{id}", options)
|
|
45
|
+
end
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
# === Create asset.
|
|
48
|
+
# Create a asset with data.
|
|
49
|
+
#
|
|
50
|
+
# ==== Parameters
|
|
51
|
+
# data:: (Hash) -- Data to be submitted.
|
|
52
|
+
#
|
|
53
|
+
# ==== Example
|
|
54
|
+
# data = {
|
|
55
|
+
# title: 'New Asset',
|
|
56
|
+
# slug: 'new-asset',
|
|
57
|
+
# }
|
|
58
|
+
# @data = @mints_user.create_asset(data)
|
|
59
|
+
def create_asset(data)
|
|
60
|
+
@client.raw('post', '/content/assets', nil, data_transform(data))
|
|
61
|
+
end
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
63
|
+
# === Update asset.
|
|
64
|
+
# Update a asset info.
|
|
65
|
+
#
|
|
66
|
+
# ==== Parameters
|
|
67
|
+
# id:: (Integer) -- Asset id.
|
|
68
|
+
# data:: (Hash) -- Data to be submitted.
|
|
69
|
+
#
|
|
70
|
+
# ==== Example
|
|
71
|
+
# data = {
|
|
72
|
+
# title: 'New Asset Modified',
|
|
73
|
+
# slug: 'new-asset'
|
|
74
|
+
# }
|
|
75
|
+
# @data = @mints_user.update_asset(5, data)
|
|
76
|
+
def update_asset(id, data)
|
|
77
|
+
@client.raw('put', "/content/assets/#{id}", nil, data_transform(data))
|
|
78
|
+
end
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
# === Delete asset.
|
|
81
|
+
# Delete a asset.
|
|
82
|
+
#
|
|
83
|
+
# ==== Parameters
|
|
84
|
+
# id:: (Integer) -- Asset id.
|
|
85
|
+
#
|
|
86
|
+
# ==== Example
|
|
87
|
+
# @data = @mints_user.delete_asset(6)
|
|
88
|
+
def delete_asset(id)
|
|
89
|
+
@client.raw('delete', "/content/assets/#{id}")
|
|
90
|
+
end
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
92
|
+
# === Get asset link info.
|
|
93
|
+
# Get information of an asset by url.
|
|
94
|
+
#
|
|
95
|
+
# ==== Parameters
|
|
96
|
+
# data:: (Hash) -- Data to be submitted.
|
|
97
|
+
#
|
|
98
|
+
# ==== Example
|
|
99
|
+
# data = {
|
|
100
|
+
# link: 'https://www.example.com/img/img.jpg'
|
|
101
|
+
# }
|
|
102
|
+
# @data = @mints_user.get_asset_link_info(data.to_json)
|
|
103
|
+
def get_asset_link_info(data)
|
|
104
|
+
@client.raw('post', '/content/assets/getLinkInfo', nil, data)
|
|
105
|
+
end
|
|
110
106
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
107
|
+
# === Download asset.
|
|
108
|
+
# Get information of an asset.
|
|
109
|
+
#
|
|
110
|
+
# ==== Parameters
|
|
111
|
+
# id:: (Integer) -- Asset id.
|
|
112
|
+
#
|
|
113
|
+
# ==== Example
|
|
114
|
+
# @data = @mints_user.download_asset(2)
|
|
115
|
+
def download_asset(id)
|
|
116
|
+
# FIXME: File not found at path, error in result but method works
|
|
117
|
+
@client.raw('get', "/content/assets/download/#{id}")
|
|
118
|
+
end
|
|
122
119
|
|
|
120
|
+
def get_asset_thumbnails(id)
|
|
123
121
|
# FIXME: Returns json invalid token
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
#end
|
|
127
|
-
|
|
128
|
-
# === Get asset usage.
|
|
129
|
-
# Get usage of an asset.
|
|
130
|
-
#
|
|
131
|
-
# ==== Parameters
|
|
132
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
133
|
-
def get_asset_usage(options)
|
|
134
|
-
@client.raw("get", "/content/assets/usage", options)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
# === Get asset info.
|
|
138
|
-
# Get info of an asset.
|
|
139
|
-
#TODO: Research if is an asset or many assets
|
|
140
|
-
#
|
|
141
|
-
# ==== Parameters
|
|
142
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
143
|
-
def get_asset_info(options)
|
|
144
|
-
@client.raw("get", "/content/assets/getAssetInfo", options)
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
# === Get asset doc types.
|
|
148
|
-
# Get doc types of assets.
|
|
149
|
-
def get_asset_doc_types
|
|
150
|
-
@client.raw("get", "/content/assets/docTypes")
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
# === Get asset public route.
|
|
154
|
-
# Get public route of assets.
|
|
155
|
-
def get_asset_public_route
|
|
156
|
-
@client.raw("get", "/content/assets/publicRoute")
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
# === Upload asset.
|
|
160
|
-
# Upload an asset. It can be images, documents and videos.
|
|
161
|
-
#
|
|
162
|
-
# ==== Parameters
|
|
163
|
-
# data:: (Hash) -- Data to be submitted.
|
|
164
|
-
#
|
|
165
|
-
# ==== First Example (with files)
|
|
166
|
-
#
|
|
167
|
-
#
|
|
168
|
-
# ==== Second Example (with urls)
|
|
169
|
-
# data = {
|
|
170
|
-
# "title": "asset title",
|
|
171
|
-
# "description": "asset description",
|
|
172
|
-
# "link": "https://link/example",
|
|
173
|
-
# "url-type": "url-image",
|
|
174
|
-
# "slug": "slug",
|
|
175
|
-
# "type": "link",
|
|
176
|
-
# "father_id": 1
|
|
177
|
-
# }
|
|
178
|
-
# @data = @mints_user.upload_asset(data.to_json)
|
|
179
|
-
#
|
|
180
|
-
# ==== Third Example (with video)
|
|
181
|
-
# data = {
|
|
182
|
-
# "title": "Video Title",
|
|
183
|
-
# "fileType": "video/mp4",
|
|
184
|
-
# "type": "video",
|
|
185
|
-
# "slug": "video-slug",
|
|
186
|
-
# "status": "not-uploaded",
|
|
187
|
-
# "ext": "mp4",
|
|
188
|
-
# "size": 29605264,
|
|
189
|
-
# "access_token": "access_token",
|
|
190
|
-
# "name": "Video Title",
|
|
191
|
-
# "videoData": {
|
|
192
|
-
# "id": 80313307,
|
|
193
|
-
# "name": "Video Title",
|
|
194
|
-
# "type": "video",
|
|
195
|
-
# "created": "2021-10-19T19:18:17+00:00",
|
|
196
|
-
# "updated": "2021-10-19T19:18:17+00:00",
|
|
197
|
-
# "duration": 191.936133,
|
|
198
|
-
# "hashed_id": "hashed_id",
|
|
199
|
-
# "progress": 0.14285714285714285,
|
|
200
|
-
# "status": "queued",
|
|
201
|
-
# "thumbnail": {
|
|
202
|
-
# "url": "https://www.example.com/img/img.jpg",
|
|
203
|
-
# "width": 200,
|
|
204
|
-
# "height": 120
|
|
205
|
-
# },
|
|
206
|
-
# "account_id": 1234567
|
|
207
|
-
# }
|
|
208
|
-
# }
|
|
209
|
-
# @data = @mints_user.upload_asset(data.to_json)
|
|
210
|
-
def upload_asset(data) #TODO: Research a way to upload a File accross sdk
|
|
211
|
-
@client.raw("post", "/content/assets/upload", nil, data)
|
|
212
|
-
end
|
|
213
|
-
|
|
122
|
+
@client.raw('get', "/content/assets/thumbnails/#{id}")
|
|
123
|
+
end
|
|
214
124
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
125
|
+
# === Get asset usage.
|
|
126
|
+
# Get usage of an asset.
|
|
127
|
+
#
|
|
128
|
+
# ==== Parameters
|
|
129
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
130
|
+
def get_asset_usage(options)
|
|
131
|
+
@client.raw('get', '/content/assets/usage', options)
|
|
132
|
+
end
|
|
218
133
|
|
|
134
|
+
# === Get asset info.
|
|
135
|
+
# Get info of an asset.
|
|
136
|
+
# TODO: Research if is an asset or many assets
|
|
137
|
+
#
|
|
138
|
+
# ==== Parameters
|
|
139
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
140
|
+
def get_asset_info(options)
|
|
141
|
+
@client.raw('get', '/content/assets/getAssetInfo', options)
|
|
142
|
+
end
|
|
219
143
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
226
|
-
def get_asset_sizes(options)
|
|
227
|
-
@client.raw("get", "/content/assets/sizes", options)
|
|
228
|
-
end
|
|
144
|
+
# === Get asset doc types.
|
|
145
|
+
# Get doc types of assets.
|
|
146
|
+
def get_asset_doc_types
|
|
147
|
+
@client.raw('get', '/content/assets/docTypes')
|
|
148
|
+
end
|
|
229
149
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
#
|
|
236
|
-
# ==== Example
|
|
237
|
-
# @data = @mints_user.get_asset_sizes(2)
|
|
238
|
-
def get_asset_size(id) #FIXME: wrong number of arguments (given 1, expected 0)
|
|
239
|
-
@client.raw("get", "/content/assets/sizes/#{id}")
|
|
240
|
-
end
|
|
150
|
+
# === Get asset public route.
|
|
151
|
+
# Get public route of assets.
|
|
152
|
+
def get_asset_public_route
|
|
153
|
+
@client.raw('get', '/content/assets/publicRoute')
|
|
154
|
+
end
|
|
241
155
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
156
|
+
# === Upload asset.
|
|
157
|
+
# Upload an asset. It can be images, documents and videos.
|
|
158
|
+
#
|
|
159
|
+
# ==== Parameters
|
|
160
|
+
# data:: (Hash) -- Data to be submitted.
|
|
161
|
+
#
|
|
162
|
+
# ==== First Example (with files)
|
|
163
|
+
#
|
|
164
|
+
#
|
|
165
|
+
# ==== Second Example (with urls)
|
|
166
|
+
# data = {
|
|
167
|
+
# title: 'asset title',
|
|
168
|
+
# description: 'asset description',
|
|
169
|
+
# link: 'https://link/example',
|
|
170
|
+
# url-type: 'url-image',
|
|
171
|
+
# slug: 'slug',
|
|
172
|
+
# type: 'link',
|
|
173
|
+
# father_id: 1
|
|
174
|
+
# }
|
|
175
|
+
# @data = @mints_user.upload_asset(data.to_json)
|
|
176
|
+
#
|
|
177
|
+
# ==== Third Example (with video)
|
|
178
|
+
# data = {
|
|
179
|
+
# title: 'Video Title',
|
|
180
|
+
# fileType: 'video/mp4',
|
|
181
|
+
# type: 'video',
|
|
182
|
+
# slug: 'video-slug',
|
|
183
|
+
# status: 'not-uploaded',
|
|
184
|
+
# ext: 'mp4',
|
|
185
|
+
# size: 29605264,
|
|
186
|
+
# access_token: 'access_token',
|
|
187
|
+
# name: 'Video Title',
|
|
188
|
+
# videoData: {
|
|
189
|
+
# id: 80313307,
|
|
190
|
+
# name: 'Video Title',
|
|
191
|
+
# type: 'video',
|
|
192
|
+
# created: '2021-10-19T19:18:17+00:00',
|
|
193
|
+
# updated: '2021-10-19T19:18:17+00:00',
|
|
194
|
+
# duration: 191.936133,
|
|
195
|
+
# hashed_id: 'hashed_id',
|
|
196
|
+
# progress: 0.14285714285714285,
|
|
197
|
+
# status: 'queued',
|
|
198
|
+
# thumbnail: {
|
|
199
|
+
# url: 'https://www.example.com/img/img.jpg',
|
|
200
|
+
# width: 200,
|
|
201
|
+
# height: 120
|
|
202
|
+
# },
|
|
203
|
+
# account_id: 1234567
|
|
204
|
+
# }
|
|
205
|
+
# }
|
|
206
|
+
# @data = @mints_user.upload_asset(data.to_json)
|
|
207
|
+
def upload_asset(data)
|
|
208
|
+
# TODO: Research a way to upload a File across sdk
|
|
209
|
+
@client.raw('post', '/content/assets/upload', nil, data)
|
|
210
|
+
end
|
|
270
211
|
|
|
212
|
+
##
|
|
213
|
+
# == Sizes
|
|
214
|
+
#
|
|
215
|
+
# === Get asset sizes.
|
|
216
|
+
# Get a collection of sizes of an asset.
|
|
217
|
+
#
|
|
218
|
+
# ==== Parameters
|
|
219
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
|
220
|
+
# FIXME: Double get asset sizes method!
|
|
221
|
+
def get_asset_sizes(options)
|
|
222
|
+
@client.raw('get', '/content/assets/sizes', options)
|
|
223
|
+
end
|
|
271
224
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
225
|
+
# === Get asset sizes.
|
|
226
|
+
# Get sizes of an asset.
|
|
227
|
+
#
|
|
228
|
+
# ==== Parameters
|
|
229
|
+
# id:: (Integer) Asset id.
|
|
230
|
+
#
|
|
231
|
+
# ==== Example
|
|
232
|
+
# @data = @mints_user.get_asset_sizes(2)
|
|
233
|
+
def get_asset_size(id)
|
|
234
|
+
# FIXME: wrong number of arguments (given 1, expected 0)
|
|
235
|
+
@client.raw('get', "/content/assets/sizes/#{id}")
|
|
236
|
+
end
|
|
275
237
|
|
|
238
|
+
# === Create asset size.
|
|
239
|
+
# Create an asset size by data.
|
|
240
|
+
#
|
|
241
|
+
# ==== Parameters
|
|
242
|
+
# data:: (Hash) -- Data to be submitted.
|
|
243
|
+
#
|
|
244
|
+
# ==== Example
|
|
245
|
+
# data = {
|
|
246
|
+
# aspectRadio: 'custom',
|
|
247
|
+
# assetId: 23,
|
|
248
|
+
# drawPosData: {
|
|
249
|
+
# pos: {
|
|
250
|
+
# sx: 100,
|
|
251
|
+
# sy: 100,
|
|
252
|
+
# swidth: 200,
|
|
253
|
+
# sheight: 200
|
|
254
|
+
# }
|
|
255
|
+
# },
|
|
256
|
+
# width: 100,
|
|
257
|
+
# height: 100,
|
|
258
|
+
# slug: 'fuji_size_slug',
|
|
259
|
+
# title: 'fuji_size',
|
|
260
|
+
# variationId: 'original'
|
|
261
|
+
# }
|
|
262
|
+
# @data = @mints_user.create_asset_size(data.to_json)
|
|
263
|
+
def create_asset_size(data)
|
|
264
|
+
@client.raw('post', '/content/assets/sizes', nil, data)
|
|
265
|
+
end
|
|
276
266
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
267
|
+
##
|
|
268
|
+
# == Variations
|
|
269
|
+
#
|
|
270
|
+
# === Get asset variation.
|
|
271
|
+
# Get variation of an asset.
|
|
272
|
+
#
|
|
273
|
+
# ==== Parameters
|
|
274
|
+
# id:: (Integer) Asset variation id.
|
|
275
|
+
#
|
|
276
|
+
# ==== Example
|
|
277
|
+
# @data = @mints_user.get_asset_sizes(2)
|
|
278
|
+
# TODO: Research if is an asset id or an variation id
|
|
279
|
+
def get_asset_variation(id)
|
|
280
|
+
# FIXME: Id 1 and 4: Trying to get property 'path' of non-object maybe json conversion is bad
|
|
281
|
+
# FIXME: Id 2 and 3: File not found at path maybe doesnt exist
|
|
282
|
+
@client.raw('get', "/content/assets/variation/#{id}")
|
|
283
|
+
end
|
|
290
284
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
end
|
|
285
|
+
# === Generate asset variation.
|
|
286
|
+
# Create an asset variation of an existing asset.
|
|
287
|
+
#
|
|
288
|
+
# ==== Parameters
|
|
289
|
+
# data:: (Hash) -- Data to be submitted.
|
|
290
|
+
def generate_asset_variation(data)
|
|
291
|
+
# FIXME: Trying to get property 'width' of non-object
|
|
292
|
+
@client.raw('post', '/content/assets/generate-asset-variations', nil, data)
|
|
293
|
+
end
|
|
294
|
+
end
|