cxf 0.0.4 → 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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +11 -11
  3. data/lib/client.rb +2 -2
  4. data/lib/contact/content/content.rb +4 -4
  5. data/lib/contact/ecommerce/ecommerce.rb +4 -4
  6. data/lib/pub/config/config.rb +6 -6
  7. data/lib/pub/ecommerce/ecommerce.rb +6 -6
  8. data/lib/user/config/config.rb +10 -0
  9. data/lib/user/config/docs.rb +11 -0
  10. data/lib/user/config/exports.rb +43 -0
  11. data/lib/user/config/logs.rb +85 -0
  12. data/lib/user/config/password.rb +7 -0
  13. data/lib/user/config/relationships.rb +17 -31
  14. data/lib/user/config/seeds.rb +4 -48
  15. data/lib/user/config/system_settings.rb +5 -5
  16. data/lib/user/config/views.rb +24 -0
  17. data/lib/user/content/assets.rb +27 -221
  18. data/lib/user/content/bundles.rb +96 -0
  19. data/lib/user/content/content.rb +6 -0
  20. data/lib/user/content/instances.rb +37 -0
  21. data/lib/user/content/message_templates.rb +114 -0
  22. data/lib/user/content/print_versions.rb +18 -0
  23. data/lib/user/content/prints.rb +96 -0
  24. data/lib/user/content/templates.rb +28 -0
  25. data/lib/user/{crm → customer-data}/companies.rb +6 -6
  26. data/lib/user/{crm → customer-data}/contacts.rb +43 -18
  27. data/lib/user/customer-data/customer_data.rb +17 -0
  28. data/lib/user/customer-data/profiles.rb +93 -0
  29. data/lib/user/customer-data/segments.rb +93 -0
  30. data/lib/user/customer-data/workflow_steps.rb +127 -0
  31. data/lib/user/customer-data/workflows.rb +115 -0
  32. data/lib/user/ecommerce/ecommerce.rb +6 -22
  33. data/lib/user/ecommerce/item_codes.rb +89 -0
  34. data/lib/user/ecommerce/order_templates.rb +89 -0
  35. data/lib/user/ecommerce/orders.rb +205 -0
  36. data/lib/user/helpers/helpers.rb +0 -96
  37. data/lib/user.rb +2 -3
  38. metadata +18 -19
  39. data/lib/user/contacts/contacts.rb +0 -22
  40. data/lib/user/crm/crm.rb +0 -9
  41. data/lib/user/ecommerce/item_prices.rb +0 -89
  42. data/lib/user/ecommerce/price_lists.rb +0 -75
  43. data/lib/user/ecommerce/product_templates.rb +0 -106
  44. data/lib/user/ecommerce/product_variations.rb +0 -133
  45. data/lib/user/ecommerce/product_versions.rb +0 -107
  46. data/lib/user/ecommerce/products.rb +0 -156
  47. data/lib/user/ecommerce/skus.rb +0 -90
  48. data/lib/user/ecommerce/taxes.rb +0 -84
  49. data/lib/user/ecommerce/variant_options.rb +0 -71
  50. data/lib/user/ecommerce/variant_values.rb +0 -74
  51. data/lib/user/ecommerce/vouchers.rb +0 -90
  52. data/lib/user/helpers/object_activities.rb +0 -85
  53. data/lib/user/helpers/object_folders.rb +0 -84
  54. data/lib/user/helpers/user_folders.rb +0 -85
@@ -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 = { fields: 'id, title' }
15
+ # options = {
16
+ # fields: 'id, slug'
17
+ # }
19
18
  # @data = @cxf_user.get_assets(options)
20
19
  #
21
20
  # ==== Third Example
22
- # options = { fields: 'id, title' }
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) -- Asset id.
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, title'
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
- # title: 'New Asset',
56
- # slug: 'new-asset',
60
+ # user_id: 1,
61
+ # slug: "new-asset",
62
+ # asset_template_id: 1
57
63
  # }
58
- # @data = @cxf_user.create_asset(data)
59
- def create_asset(data)
60
- @client.raw('post', '/content/assets', nil, data_transform(data))
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) -- Asset id.
76
+ # id:: (Integer) -- asset id.
68
77
  # data:: (Hash) -- Data to be submitted.
69
78
  #
70
79
  # ==== Example
71
80
  # data = {
72
- # title: 'New Asset Modified',
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('put', "/content/assets/#{id}", nil, data_transform(data))
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) -- Asset id.
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
@@ -7,6 +7,9 @@ require_relative './content_prints'
7
7
  require_relative './instances'
8
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
@@ -17,6 +20,9 @@ module Content
17
20
  include Instances
18
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
  #
@@ -0,0 +1,114 @@
1
+ # frozen_string_literal: true
2
+ module MessageTemplates
3
+
4
+ # === Get message_templates.
5
+ # Get a collection of message_templates.
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_message_templates
13
+ #
14
+ # ==== Second Example
15
+ # options = {
16
+ # fields: 'id, slug'
17
+ # }
18
+ # @data = @cxf_user.get_message_templates(options)
19
+ #
20
+ # ==== Third Example
21
+ # options = {
22
+ # fields: 'id, slug'
23
+ # }
24
+ # @data = @cxf_user.get_message_templates(options, true)
25
+ def get_message_templates(options = nil, use_post = true)
26
+ get_query_results('/content/message-templates', options, use_post)
27
+ end
28
+
29
+ # === Get message_template.
30
+ # Get a message_template info.
31
+ #
32
+ # ==== Parameters
33
+ # id:: (Integer) -- message_template 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_message_template(1)
38
+ #
39
+ # ==== Second Example
40
+ # options = {
41
+ # fields: 'id, slug'
42
+ # }
43
+ # @data = @cxf_user.get_message_template(1, options)
44
+ def get_message_template(id, options = nil)
45
+ @client.raw('get', "/content/message-templates/#{id}", options)
46
+ end
47
+
48
+ # === Create message_template.
49
+ # Create a message_template with data.
50
+ #
51
+ # ==== Parameters
52
+ # data:: (Hash) -- Data to be submitted.
53
+ #
54
+ # ==== Example
55
+ # data = {
56
+ # user_id: 1,
57
+ # slug: "new-message_template",
58
+ # message_template_template_id: 1
59
+ # }
60
+ #
61
+ # options = { fields: 'id,slug' }
62
+ #
63
+ # @data = @cxf_user.create_message_template(data, options)
64
+ def create_message_template(data, options = nil)
65
+ @client.raw('post', '/content/message-templates', options, data_transform(data))
66
+ end
67
+
68
+ # === Send message_template.
69
+ # Send a message using a message template with data.
70
+ #
71
+ # ==== Parameters
72
+ # data:: (Hash) -- Data to be submitted.
73
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
74
+ #
75
+ # ==== Example
76
+ # data = {
77
+ # user_id: 1,
78
+ # message_template_id: 2,
79
+ # content: "Hello, World!"
80
+ # }
81
+ # @data = @cxf_user.send_message_template(data)
82
+ def send_message_template(data, options = nil)
83
+ @client.raw('post', '/content/messages/send', options, data_transform(data))
84
+ end
85
+
86
+ # === Update message_template.
87
+ # Update a message_template info.
88
+ #
89
+ # ==== Parameters
90
+ # id:: (Integer) -- message_template id.
91
+ # data:: (Hash) -- Data to be submitted.
92
+ #
93
+ # ==== Example
94
+ # data = {
95
+ # user_id: 1,
96
+ # slug: 'new-message_template'
97
+ # }
98
+ # @data = @cxf_user.update_message_template(5, data)
99
+ def update_message_template(id, data, options = nil)
100
+ @client.raw('put', "/content/message-templates/#{id}", options, data_transform(data))
101
+ end
102
+
103
+ # === Delete message_template.
104
+ # Delete a message_template.
105
+ #
106
+ # ==== Parameters
107
+ # id:: (Integer) -- message_template id.
108
+ #
109
+ # ==== Example
110
+ # @data = @cxf_user.delete_message_template(6)
111
+ def delete_message_template(id)
112
+ @client.raw('delete', "/content/message-templates/#{id}")
113
+ end
114
+ end
@@ -62,6 +62,24 @@ module PrintVersions
62
62
  @client.raw('post', '/content/print-versions', options, data_transform(data))
63
63
  end
64
64
 
65
+ # === Create print version from existing print version.
66
+ # Create a new print version using data from an existing print version.
67
+ #
68
+ # ==== Parameters
69
+ # id:: (Integer) -- print version id.
70
+ # data:: (Hash) -- Data to be submitted.
71
+ # options:: (Hash) -- Optional parameters for the request.
72
+ #
73
+ # ==== Example
74
+ # data = {
75
+ # title: 'Copied print',
76
+ # slug: 'copied-print'
77
+ # }
78
+ # @data = @cxf_user.create_print_version_from_print_version(1, data)
79
+ def create_print_version_from_print_version(id, data, options = nil)
80
+ @client.raw('post', "/content/print-versions/#{id}/print-version", options, data_transform(data))
81
+ end
82
+
65
83
  # === CHECK THIS ===
66
84
  # def create_print_version_from_instance(id, data, options = nil)
67
85
  # @client.raw('post', "/content/print-versions/#{id}/print-version", options, data_transform(data))
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+ module Prints
3
+
4
+ # === Get prints.
5
+ # Get a collection of prints.
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_prints
13
+ #
14
+ # ==== Second Example
15
+ # options = {
16
+ # fields: 'id, slug'
17
+ # }
18
+ # @data = @cxf_user.get_prints(options)
19
+ #
20
+ # ==== Third Example
21
+ # options = {
22
+ # fields: 'id, slug'
23
+ # }
24
+ # @data = @cxf_user.get_prints(options, true)
25
+ def get_prints(options = nil, use_post = true)
26
+ get_query_results('/content/prints', options, use_post)
27
+ end
28
+
29
+ # === Get print.
30
+ # Get a print info.
31
+ #
32
+ # ==== Parameters
33
+ # id:: (Integer) -- print 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_print(1)
38
+ #
39
+ # ==== Second Example
40
+ # options = {
41
+ # fields: 'id, slug'
42
+ # }
43
+ # @data = @cxf_user.get_print(1, options)
44
+ def get_print(id, options = nil)
45
+ @client.raw('get', "/content/prints/#{id}", options)
46
+ end
47
+
48
+ # === Create print.
49
+ # Create a print with data.
50
+ #
51
+ # ==== Parameters
52
+ # data:: (Hash) -- Data to be submitted.
53
+ #
54
+ # ==== Example
55
+ # data = {
56
+ # user_id: 1,
57
+ # slug: "new-print",
58
+ # print_template_id: 1
59
+ # }
60
+ #
61
+ # options = { fields: 'id,slug' }
62
+ #
63
+ # @data = @cxf_user.create_print(data, options)
64
+ def create_print(data, options = nil)
65
+ @client.raw('post', '/content/prints', options, data_transform(data))
66
+ end
67
+
68
+ # === Update print.
69
+ # Update a print info.
70
+ #
71
+ # ==== Parameters
72
+ # id:: (Integer) -- print id.
73
+ # data:: (Hash) -- Data to be submitted.
74
+ #
75
+ # ==== Example
76
+ # data = {
77
+ # user_id: 1,
78
+ # slug: 'new-print'
79
+ # }
80
+ # @data = @cxf_user.update_print(5, data)
81
+ def update_print(id, data, options = nil)
82
+ @client.raw('put', "/content/prints/#{id}", options, data_transform(data))
83
+ end
84
+
85
+ # === Delete print.
86
+ # Delete a print.
87
+ #
88
+ # ==== Parameters
89
+ # id:: (Integer) -- print id.
90
+ #
91
+ # ==== Example
92
+ # @data = @cxf_user.delete_print(6)
93
+ def delete_print(id)
94
+ @client.raw('delete', "/content/prints/#{id}")
95
+ end
96
+ end