cxf 0.0.2 → 0.0.5
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 +11 -11
- data/lib/client.rb +19 -10
- data/lib/contact/content/content.rb +4 -4
- data/lib/contact/ecommerce/ecommerce.rb +4 -4
- data/lib/contact.rb +1 -1
- data/lib/cxf/controllers/concerns/cxf_clients.rb +4 -4
- data/lib/cxf/helpers/contact_auth_helper.rb +1 -1
- data/lib/pub/config/config.rb +6 -6
- data/lib/pub/content/assets.rb +2 -2
- data/lib/pub/content/content.rb +13 -9
- data/lib/pub/content/content_prints.rb +95 -0
- data/lib/pub/content/print_versions.rb +98 -0
- data/lib/pub/ecommerce/ecommerce.rb +6 -6
- data/lib/pub.rb +1 -0
- data/lib/user/config/config.rb +10 -0
- data/lib/user/config/docs.rb +11 -0
- data/lib/user/config/exports.rb +43 -0
- data/lib/user/config/logs.rb +85 -0
- data/lib/user/config/password.rb +7 -0
- data/lib/user/config/relationships.rb +17 -31
- data/lib/user/config/seeds.rb +4 -48
- data/lib/user/config/system_settings.rb +5 -5
- data/lib/user/config/views.rb +24 -0
- data/lib/user/content/assets.rb +27 -221
- data/lib/user/content/bundles.rb +96 -0
- data/lib/user/content/content.rb +12 -6
- data/lib/user/content/instances.rb +37 -0
- data/lib/user/content/message_templates.rb +114 -0
- data/lib/user/content/print_versions.rb +18 -0
- data/lib/user/content/prints.rb +96 -0
- data/lib/user/content/templates.rb +28 -0
- data/lib/user/{crm → customer-data}/companies.rb +6 -6
- data/lib/user/{crm → customer-data}/contacts.rb +43 -18
- data/lib/user/customer-data/customer_data.rb +17 -0
- data/lib/user/customer-data/profiles.rb +93 -0
- data/lib/user/customer-data/segments.rb +93 -0
- data/lib/user/customer-data/workflow_steps.rb +127 -0
- data/lib/user/customer-data/workflows.rb +115 -0
- data/lib/user/ecommerce/ecommerce.rb +6 -24
- data/lib/user/ecommerce/item_codes.rb +89 -0
- data/lib/user/ecommerce/order_templates.rb +89 -0
- data/lib/user/ecommerce/orders.rb +205 -0
- data/lib/user/helpers/helpers.rb +0 -96
- data/lib/user.rb +2 -3
- metadata +22 -24
- data/lib/user/contacts/contacts.rb +0 -22
- data/lib/user/content/stories.rb +0 -110
- data/lib/user/content/story_templates.rb +0 -97
- data/lib/user/crm/crm.rb +0 -9
- data/lib/user/ecommerce/item_prices.rb +0 -89
- data/lib/user/ecommerce/locations.rb +0 -171
- data/lib/user/ecommerce/price_lists.rb +0 -75
- data/lib/user/ecommerce/product_templates.rb +0 -106
- data/lib/user/ecommerce/product_variations.rb +0 -133
- data/lib/user/ecommerce/product_versions.rb +0 -107
- data/lib/user/ecommerce/products.rb +0 -156
- data/lib/user/ecommerce/skus.rb +0 -90
- data/lib/user/ecommerce/taxes.rb +0 -84
- data/lib/user/ecommerce/variant_options.rb +0 -71
- data/lib/user/ecommerce/variant_values.rb +0 -74
- data/lib/user/ecommerce/vouchers.rb +0 -90
- data/lib/user/helpers/object_activities.rb +0 -85
- data/lib/user/helpers/object_folders.rb +0 -84
- data/lib/user/helpers/user_folders.rb +0 -85
data/lib/user/config/seeds.rb
CHANGED
@@ -1,55 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Seeds
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
# === Apply seeds.
|
8
|
-
# Apply seeds.
|
9
|
-
#
|
10
|
-
# ==== Example
|
11
|
-
#
|
12
|
-
def apply_seeds(data, async: false)
|
13
|
-
url = '/config/seeds'
|
14
|
-
url = "#{url}?async" if async
|
15
|
-
@client.raw('post', url, nil, data)
|
4
|
+
def process_seed(data)
|
5
|
+
@client.raw('post', "/config/seeds", nil, data_transform(data))
|
16
6
|
end
|
17
7
|
|
18
|
-
|
19
|
-
|
20
|
-
#
|
21
|
-
# ==== Parameters
|
22
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
23
|
-
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
24
|
-
#
|
25
|
-
# ==== First Example
|
26
|
-
# @data = @cxf_user.get_seed_processes
|
27
|
-
#
|
28
|
-
# ==== Second Example
|
29
|
-
# options = {
|
30
|
-
# fields: 'id'
|
31
|
-
# }
|
32
|
-
# @data = @cxf_user.get_seed_processes(options)
|
33
|
-
def get_seed_processes(options = nil)
|
34
|
-
@client.raw('post', '/config/seed-processes', options)
|
35
|
-
end
|
36
|
-
|
37
|
-
# === Get seed process.
|
38
|
-
# Get a seed process info.
|
39
|
-
#
|
40
|
-
# ==== Parameters
|
41
|
-
# id:: (Integer) -- Seed process id.
|
42
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
43
|
-
#
|
44
|
-
# ==== First Example
|
45
|
-
# @data = @cxf_user.get_seed_process(1)
|
46
|
-
#
|
47
|
-
# ==== Second Example
|
48
|
-
# options = {
|
49
|
-
# fields: 'id, title'
|
50
|
-
# }
|
51
|
-
# @data = @cxf_user.get_seed_process(1, options)
|
52
|
-
def get_seed_process(id, options = nil)
|
53
|
-
@client.raw('get', "/config/seed-processes/#{id}", options)
|
8
|
+
def get_seed_process_status(id)
|
9
|
+
@client.raw('get', "/config/seeds/jobs/#{id}")
|
54
10
|
end
|
55
11
|
end
|
@@ -13,7 +13,7 @@ module SystemSettings
|
|
13
13
|
# }
|
14
14
|
# @data = @cxf_user.get_settings_by_keys(options)
|
15
15
|
def get_settings_by_keys(options)
|
16
|
-
@client.raw('get', '/config/settings/by-keys', options)
|
16
|
+
@client.raw('get', '/config/system-settings/by-keys', options)
|
17
17
|
end
|
18
18
|
|
19
19
|
# === Get settings.
|
@@ -22,7 +22,7 @@ module SystemSettings
|
|
22
22
|
# ==== Example
|
23
23
|
# @data = @cxf_user.get_settings
|
24
24
|
def get_settings
|
25
|
-
@client.raw('get', '/config/settings')
|
25
|
+
@client.raw('get', '/config/system-settings')
|
26
26
|
end
|
27
27
|
|
28
28
|
# === Create setting.
|
@@ -37,7 +37,7 @@ module SystemSettings
|
|
37
37
|
# }
|
38
38
|
# @data = @cxf_user.create_setting(data)
|
39
39
|
def create_setting(data)
|
40
|
-
@client.raw('post', '/config/settings', nil, data_transform(data))
|
40
|
+
@client.raw('post', '/config/system-settings', nil, data_transform(data))
|
41
41
|
end
|
42
42
|
|
43
43
|
# === Clear tag.
|
@@ -48,7 +48,7 @@ module SystemSettings
|
|
48
48
|
#
|
49
49
|
# ==== Example
|
50
50
|
# @data = @cxf_user.clear_tag(1)
|
51
|
-
def
|
52
|
-
@client.raw('
|
51
|
+
def clear_settings_cache
|
52
|
+
@client.raw('post', "/config/system-settings/clear-cache")
|
53
53
|
end
|
54
54
|
end
|
data/lib/user/config/views.rb
CHANGED
@@ -65,4 +65,28 @@ module Views
|
|
65
65
|
def update_view(id, data)
|
66
66
|
@client.raw('put', "/config/views/#{id}", nil, data_transform(data))
|
67
67
|
end
|
68
|
+
|
69
|
+
# === Get view query.
|
70
|
+
# Get a view query.
|
71
|
+
#
|
72
|
+
# ==== Parameters
|
73
|
+
# id_or_slug:: (String) -- The id or slug of the view to be queried.
|
74
|
+
#
|
75
|
+
# ==== Example
|
76
|
+
# @data = @cxf_user.get_view_query('view-slug')
|
77
|
+
def get_view_query(id_or_slug)
|
78
|
+
@client.raw('get', "/config/views/#{id_or_slug}/query")
|
79
|
+
end
|
80
|
+
|
81
|
+
# === Export view to BigQuery.
|
82
|
+
# Export a view to BigQuery using its id or slug.
|
83
|
+
#
|
84
|
+
# ==== Parameters
|
85
|
+
# id_or_slug:: (String) -- The id or slug of the view to be exported.
|
86
|
+
#
|
87
|
+
# ==== Example
|
88
|
+
# @data = @cxf_user.export_view_to_bigquery('view-slug')
|
89
|
+
def export_view_to_bigquery(id_or_slug)
|
90
|
+
@client.raw('post', "/config/views/#{id_or_slug}/export")
|
91
|
+
end
|
68
92
|
end
|
data/lib/user/content/assets.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
module Assets
|
4
|
-
|
5
|
-
# == Assets
|
6
|
-
#
|
3
|
+
|
7
4
|
# === Get assets.
|
8
5
|
# Get a collection of assets.
|
9
6
|
#
|
@@ -15,11 +12,15 @@ module Assets
|
|
15
12
|
# @data = @cxf_user.get_assets
|
16
13
|
#
|
17
14
|
# ==== Second Example
|
18
|
-
# options = {
|
15
|
+
# options = {
|
16
|
+
# fields: 'id, slug'
|
17
|
+
# }
|
19
18
|
# @data = @cxf_user.get_assets(options)
|
20
19
|
#
|
21
20
|
# ==== Third Example
|
22
|
-
# options = {
|
21
|
+
# options = {
|
22
|
+
# fields: 'id, slug'
|
23
|
+
# }
|
23
24
|
# @data = @cxf_user.get_assets(options, true)
|
24
25
|
def get_assets(options = nil, use_post = true)
|
25
26
|
get_query_results('/content/assets', options, use_post)
|
@@ -29,7 +30,7 @@ module Assets
|
|
29
30
|
# Get a asset info.
|
30
31
|
#
|
31
32
|
# ==== Parameters
|
32
|
-
# id:: (Integer) --
|
33
|
+
# id:: (Integer) -- asset id.
|
33
34
|
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
34
35
|
#
|
35
36
|
# ==== First Example
|
@@ -37,13 +38,17 @@ module Assets
|
|
37
38
|
#
|
38
39
|
# ==== Second Example
|
39
40
|
# options = {
|
40
|
-
# fields: 'id,
|
41
|
+
# fields: 'id, slug'
|
41
42
|
# }
|
42
43
|
# @data = @cxf_user.get_asset(1, options)
|
43
44
|
def get_asset(id, options = nil)
|
44
45
|
@client.raw('get', "/content/assets/#{id}", options)
|
45
46
|
end
|
46
47
|
|
48
|
+
def get_asset_usage(id, options = nil)
|
49
|
+
@client.raw('get', "/content/assets/#{id}/usage", options)
|
50
|
+
end
|
51
|
+
|
47
52
|
# === Create asset.
|
48
53
|
# Create a asset with data.
|
49
54
|
#
|
@@ -52,243 +57,44 @@ module Assets
|
|
52
57
|
#
|
53
58
|
# ==== Example
|
54
59
|
# data = {
|
55
|
-
#
|
56
|
-
# slug:
|
60
|
+
# user_id: 1,
|
61
|
+
# slug: "new-asset",
|
62
|
+
# asset_template_id: 1
|
57
63
|
# }
|
58
|
-
#
|
59
|
-
|
60
|
-
|
64
|
+
#
|
65
|
+
# options = { fields: 'id,slug' }
|
66
|
+
#
|
67
|
+
# @data = @cxf_user.create_asset(data, options)
|
68
|
+
def create_asset(data, options = nil)
|
69
|
+
@client.raw('post', '/content/assets', options, data_transform(data))
|
61
70
|
end
|
62
71
|
|
63
72
|
# === Update asset.
|
64
73
|
# Update a asset info.
|
65
74
|
#
|
66
75
|
# ==== Parameters
|
67
|
-
# id:: (Integer) --
|
76
|
+
# id:: (Integer) -- asset id.
|
68
77
|
# data:: (Hash) -- Data to be submitted.
|
69
78
|
#
|
70
79
|
# ==== Example
|
71
80
|
# data = {
|
72
|
-
#
|
81
|
+
# user_id: 1,
|
73
82
|
# slug: 'new-asset'
|
74
83
|
# }
|
75
84
|
# @data = @cxf_user.update_asset(5, data)
|
76
|
-
def update_asset(id, data)
|
77
|
-
@client.raw('
|
85
|
+
def update_asset(id, data, options = nil)
|
86
|
+
@client.raw('post', "/content/assets/#{id}", options, data_transform(data))
|
78
87
|
end
|
79
88
|
|
80
89
|
# === Delete asset.
|
81
90
|
# Delete a asset.
|
82
91
|
#
|
83
92
|
# ==== Parameters
|
84
|
-
# id:: (Integer) --
|
93
|
+
# id:: (Integer) -- asset id.
|
85
94
|
#
|
86
95
|
# ==== Example
|
87
96
|
# @data = @cxf_user.delete_asset(6)
|
88
97
|
def delete_asset(id)
|
89
98
|
@client.raw('delete', "/content/assets/#{id}")
|
90
99
|
end
|
91
|
-
|
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 = @cxf_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
|
106
|
-
|
107
|
-
# === Download asset.
|
108
|
-
# Get information of an asset.
|
109
|
-
#
|
110
|
-
# ==== Parameters
|
111
|
-
# id:: (Integer) -- Asset id.
|
112
|
-
#
|
113
|
-
# ==== Example
|
114
|
-
# @data = @cxf_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
|
119
|
-
|
120
|
-
def get_asset_thumbnails(id)
|
121
|
-
# FIXME: Returns json invalid token
|
122
|
-
@client.raw('get', "/content/assets/thumbnails/#{id}")
|
123
|
-
end
|
124
|
-
|
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
|
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
|
143
|
-
|
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
|
149
|
-
|
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
|
155
|
-
|
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 = @cxf_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 = @cxf_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
|
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
|
224
|
-
|
225
|
-
# === Get asset sizes.
|
226
|
-
# Get sizes of an asset.
|
227
|
-
#
|
228
|
-
# ==== Parameters
|
229
|
-
# id:: (Integer) Asset id.
|
230
|
-
#
|
231
|
-
# ==== Example
|
232
|
-
# @data = @cxf_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
|
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 = @cxf_user.create_asset_size(data.to_json)
|
263
|
-
def create_asset_size(data)
|
264
|
-
@client.raw('post', '/content/assets/sizes', nil, data)
|
265
|
-
end
|
266
|
-
|
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 = @cxf_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
|
284
|
-
|
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
100
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Bundles
|
3
|
+
|
4
|
+
# === Get bundles.
|
5
|
+
# Get a collection of bundles.
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
9
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
10
|
+
#
|
11
|
+
# ==== First Example
|
12
|
+
# @data = @cxf_user.get_bundles
|
13
|
+
#
|
14
|
+
# ==== Second Example
|
15
|
+
# options = {
|
16
|
+
# fields: 'id, slug'
|
17
|
+
# }
|
18
|
+
# @data = @cxf_user.get_bundles(options)
|
19
|
+
#
|
20
|
+
# ==== Third Example
|
21
|
+
# options = {
|
22
|
+
# fields: 'id, slug'
|
23
|
+
# }
|
24
|
+
# @data = @cxf_user.get_bundles(options, true)
|
25
|
+
def get_bundles(options = nil, use_post = true)
|
26
|
+
get_query_results('/content/bundles', options, use_post)
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Get bundle.
|
30
|
+
# Get a bundle info.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# id:: (Integer) -- bundle id.
|
34
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
35
|
+
#
|
36
|
+
# ==== First Example
|
37
|
+
# @data = @cxf_user.get_bundle(1)
|
38
|
+
#
|
39
|
+
# ==== Second Example
|
40
|
+
# options = {
|
41
|
+
# fields: 'id, slug'
|
42
|
+
# }
|
43
|
+
# @data = @cxf_user.get_bundle(1, options)
|
44
|
+
def get_bundle(id, options = nil)
|
45
|
+
@client.raw('get', "/content/bundles/#{id}", options)
|
46
|
+
end
|
47
|
+
|
48
|
+
# === Create bundle.
|
49
|
+
# Create a bundle with data.
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# data:: (Hash) -- Data to be submitted.
|
53
|
+
#
|
54
|
+
# ==== Example
|
55
|
+
# data = {
|
56
|
+
# user_id: 1,
|
57
|
+
# slug: "new-bundle",
|
58
|
+
# bundle_template_id: 1
|
59
|
+
# }
|
60
|
+
#
|
61
|
+
# options = { fields: 'id,slug' }
|
62
|
+
#
|
63
|
+
# @data = @cxf_user.create_bundle(data, options)
|
64
|
+
def create_bundle(data, options = nil)
|
65
|
+
@client.raw('post', '/content/bundles', options, data_transform(data))
|
66
|
+
end
|
67
|
+
|
68
|
+
# === Update bundle.
|
69
|
+
# Update a bundle info.
|
70
|
+
#
|
71
|
+
# ==== Parameters
|
72
|
+
# id:: (Integer) -- bundle id.
|
73
|
+
# data:: (Hash) -- Data to be submitted.
|
74
|
+
#
|
75
|
+
# ==== Example
|
76
|
+
# data = {
|
77
|
+
# user_id: 1,
|
78
|
+
# slug: 'new-bundle'
|
79
|
+
# }
|
80
|
+
# @data = @cxf_user.update_bundle(5, data)
|
81
|
+
def update_bundle(id, data, options = nil)
|
82
|
+
@client.raw('put', "/content/bundles/#{id}", options, data_transform(data))
|
83
|
+
end
|
84
|
+
|
85
|
+
# === Delete bundle.
|
86
|
+
# Delete a bundle.
|
87
|
+
#
|
88
|
+
# ==== Parameters
|
89
|
+
# id:: (Integer) -- bundle id.
|
90
|
+
#
|
91
|
+
# ==== Example
|
92
|
+
# @data = @cxf_user.delete_bundle(6)
|
93
|
+
def delete_bundle(id)
|
94
|
+
@client.raw('delete', "/content/bundles/#{id}")
|
95
|
+
end
|
96
|
+
end
|
data/lib/user/content/content.rb
CHANGED
@@ -1,22 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require_relative './assets'
|
3
|
-
require_relative './stories'
|
4
|
-
require_relative './print_versions'
|
5
|
-
require_relative './story_templates'
|
6
3
|
require_relative './blocks'
|
7
4
|
require_relative './block_templates'
|
5
|
+
require_relative './content_bundles'
|
6
|
+
require_relative './content_prints'
|
8
7
|
require_relative './instances'
|
8
|
+
require_relative './print_versions'
|
9
9
|
require_relative './templates'
|
10
|
+
require_relative './bundles'
|
11
|
+
require_relative './message_templates'
|
12
|
+
require_relative './prints'
|
10
13
|
|
11
14
|
module Content
|
12
15
|
include Assets
|
13
|
-
include Stories
|
14
|
-
include PrintVersions
|
15
|
-
include StoryTemplates
|
16
16
|
include Blocks
|
17
17
|
include BlockTemplates
|
18
|
+
include ContentBundles
|
19
|
+
include ContentPrints
|
18
20
|
include Instances
|
21
|
+
include PrintVersions
|
19
22
|
include Templates
|
23
|
+
include Bundles
|
24
|
+
include MessageTemplates
|
25
|
+
include Prints
|
20
26
|
|
21
27
|
# === Get public images url.
|
22
28
|
# Get public images url.
|
@@ -90,6 +90,43 @@ module Instances
|
|
90
90
|
@client.raw('post', "/content/instances/#{id}/print-version", options, data_transform(data))
|
91
91
|
end
|
92
92
|
|
93
|
+
def add_variant_value_to_instance(id, data, options = nil)
|
94
|
+
@client.raw('post', "/content/instances/#{id}/variant-value", options, data_transform(data))
|
95
|
+
end
|
96
|
+
|
97
|
+
# === Delete variant value from instance.
|
98
|
+
# Delete a variant value from a instance.
|
99
|
+
#
|
100
|
+
# ==== Parameters
|
101
|
+
# id:: (Integer) -- instance id.
|
102
|
+
# data:: (Hash) -- Data to be submitted.
|
103
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
104
|
+
def delete_variant_value_from_instance(id, data, options = nil)
|
105
|
+
@client.raw('delete', "/content/instances/#{id}/variant-value", options, data_transform(data))
|
106
|
+
end
|
107
|
+
|
108
|
+
# === Get instance variations.
|
109
|
+
# Get a collection of instance variations.
|
110
|
+
#
|
111
|
+
# ==== Parameters
|
112
|
+
# id:: (Integer) -- instance id.
|
113
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
114
|
+
#
|
115
|
+
def get_intance_variations(id, options = nil)
|
116
|
+
@client.raw('get', "/content/instances/#{id}/build-variations", options)
|
117
|
+
end
|
118
|
+
|
119
|
+
# === Create item code for instance.
|
120
|
+
# Create a item code for a instance with data.
|
121
|
+
#
|
122
|
+
# ==== Parameters
|
123
|
+
# id:: (Integer) -- instance id.
|
124
|
+
# data:: (Hash) -- Data to be submitted.
|
125
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
126
|
+
def create_item_code_for_instance(id, data, options = nil)
|
127
|
+
@client.raw('post', "/content/instances/#{id}/item-codes", options, data_transform(data))
|
128
|
+
end
|
129
|
+
|
93
130
|
# === Update instance.
|
94
131
|
# Update a instance info.
|
95
132
|
#
|