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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +11 -11
  3. data/lib/client.rb +19 -10
  4. data/lib/contact/content/content.rb +4 -4
  5. data/lib/contact/ecommerce/ecommerce.rb +4 -4
  6. data/lib/contact.rb +1 -1
  7. data/lib/cxf/controllers/concerns/cxf_clients.rb +4 -4
  8. data/lib/cxf/helpers/contact_auth_helper.rb +1 -1
  9. data/lib/pub/config/config.rb +6 -6
  10. data/lib/pub/content/assets.rb +2 -2
  11. data/lib/pub/content/content.rb +13 -9
  12. data/lib/pub/content/content_prints.rb +95 -0
  13. data/lib/pub/content/print_versions.rb +98 -0
  14. data/lib/pub/ecommerce/ecommerce.rb +6 -6
  15. data/lib/pub.rb +1 -0
  16. data/lib/user/config/config.rb +10 -0
  17. data/lib/user/config/docs.rb +11 -0
  18. data/lib/user/config/exports.rb +43 -0
  19. data/lib/user/config/logs.rb +85 -0
  20. data/lib/user/config/password.rb +7 -0
  21. data/lib/user/config/relationships.rb +17 -31
  22. data/lib/user/config/seeds.rb +4 -48
  23. data/lib/user/config/system_settings.rb +5 -5
  24. data/lib/user/config/views.rb +24 -0
  25. data/lib/user/content/assets.rb +27 -221
  26. data/lib/user/content/bundles.rb +96 -0
  27. data/lib/user/content/content.rb +12 -6
  28. data/lib/user/content/instances.rb +37 -0
  29. data/lib/user/content/message_templates.rb +114 -0
  30. data/lib/user/content/print_versions.rb +18 -0
  31. data/lib/user/content/prints.rb +96 -0
  32. data/lib/user/content/templates.rb +28 -0
  33. data/lib/user/{crm → customer-data}/companies.rb +6 -6
  34. data/lib/user/{crm → customer-data}/contacts.rb +43 -18
  35. data/lib/user/customer-data/customer_data.rb +17 -0
  36. data/lib/user/customer-data/profiles.rb +93 -0
  37. data/lib/user/customer-data/segments.rb +93 -0
  38. data/lib/user/customer-data/workflow_steps.rb +127 -0
  39. data/lib/user/customer-data/workflows.rb +115 -0
  40. data/lib/user/ecommerce/ecommerce.rb +6 -24
  41. data/lib/user/ecommerce/item_codes.rb +89 -0
  42. data/lib/user/ecommerce/order_templates.rb +89 -0
  43. data/lib/user/ecommerce/orders.rb +205 -0
  44. data/lib/user/helpers/helpers.rb +0 -96
  45. data/lib/user.rb +2 -3
  46. metadata +22 -24
  47. data/lib/user/contacts/contacts.rb +0 -22
  48. data/lib/user/content/stories.rb +0 -110
  49. data/lib/user/content/story_templates.rb +0 -97
  50. data/lib/user/crm/crm.rb +0 -9
  51. data/lib/user/ecommerce/item_prices.rb +0 -89
  52. data/lib/user/ecommerce/locations.rb +0 -171
  53. data/lib/user/ecommerce/price_lists.rb +0 -75
  54. data/lib/user/ecommerce/product_templates.rb +0 -106
  55. data/lib/user/ecommerce/product_variations.rb +0 -133
  56. data/lib/user/ecommerce/product_versions.rb +0 -107
  57. data/lib/user/ecommerce/products.rb +0 -156
  58. data/lib/user/ecommerce/skus.rb +0 -90
  59. data/lib/user/ecommerce/taxes.rb +0 -84
  60. data/lib/user/ecommerce/variant_options.rb +0 -71
  61. data/lib/user/ecommerce/variant_values.rb +0 -74
  62. data/lib/user/ecommerce/vouchers.rb +0 -90
  63. data/lib/user/helpers/object_activities.rb +0 -85
  64. data/lib/user/helpers/object_folders.rb +0 -84
  65. data/lib/user/helpers/user_folders.rb +0 -85
@@ -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
@@ -54,6 +54,34 @@ module Templates
54
54
  @client.raw('post', '/content/templates', options, data_transform(data))
55
55
  end
56
56
 
57
+ # === Create variant option for template.
58
+ # Create a variant option for a template with data.
59
+ #
60
+ # ==== Parameters
61
+ # id:: (Integer) -- template id.
62
+ # data:: (Hash) -- Data to be submitted.
63
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
64
+ #
65
+ # ==== Example
66
+ # data = {
67
+ # variant_option_id: 1
68
+ # }
69
+ # @data = @cxf_user.create_template_variant_option(1, data)
70
+ def create_template_variant_option(id, data, options = nil)
71
+ @client.raw('post', "/content/templates/#{id}/variant-option", options, data_transform(data))
72
+ end
73
+
74
+ # === Delete variant option from template.
75
+ # Delete a variant option from a template.
76
+ #
77
+ # ==== Parameters
78
+ # id:: (Integer) -- template id.
79
+ # data:: (Hash) -- Data to be submitted.
80
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
81
+ def delete_template_variant_option(id, data, options = nil)
82
+ @client.raw('delete', "/content/templates/#{id}/variant-option", options, data_transform(data))
83
+ end
84
+
57
85
  # === Update template.
58
86
  # Update a template info.
59
87
  #
@@ -12,7 +12,7 @@ module Companies
12
12
  # ==== Example
13
13
  # @data = @cxf_user.get_companies_support_data
14
14
  def get_companies_support_data
15
- @client.raw('get', '/crm/companies/support-data')
15
+ @client.raw('get', '/customer-data/companies/support-data')
16
16
  end
17
17
 
18
18
  # === Get companies.
@@ -33,7 +33,7 @@ module Companies
33
33
  # options = { fields: 'id, title', sort: '-id' }
34
34
  # @data = @cxf_user.get_companies(options, false)
35
35
  def get_companies(options = nil, use_post = true)
36
- get_query_results('/crm/companies', options, use_post)
36
+ get_query_results('/customer-data/companies', options, use_post)
37
37
  end
38
38
 
39
39
  # === Get company.
@@ -50,7 +50,7 @@ module Companies
50
50
  # options = { fields: 'id, title' }
51
51
  # @data = @cxf_user.get_company(21, options)
52
52
  def get_company(id, options = nil)
53
- @client.raw('get', "/crm/companies/#{id}", options)
53
+ @client.raw('get', "/customer-data/companies/#{id}", options)
54
54
  end
55
55
 
56
56
  # === Create company.
@@ -73,7 +73,7 @@ module Companies
73
73
  # }
74
74
  # @data = @cxf_user.create_company(data)
75
75
  def create_company(data, options = nil)
76
- @client.raw('post', '/crm/companies/', options, data_transform(data))
76
+ @client.raw('post', '/customer-data/companies/', options, data_transform(data))
77
77
  end
78
78
 
79
79
  # === Update company.
@@ -89,7 +89,7 @@ module Companies
89
89
  # }
90
90
  # @data = @cxf_user.update_company(23, data)
91
91
  def update_company(id, data, options = nil)
92
- @client.raw('put', "/crm/companies/#{id}", options, data_transform(data))
92
+ @client.raw('put', "/customer-data/companies/#{id}", options, data_transform(data))
93
93
  end
94
94
 
95
95
  ##
@@ -106,6 +106,6 @@ module Companies
106
106
  # data = { ids: %w[21 22] }
107
107
  # @data = @cxf_user.delete_companies(data)
108
108
  def delete_companies(data)
109
- @client.raw('delete', '/crm/companies/delete', nil, data_transform(data))
109
+ @client.raw('delete', '/customer-data/companies/delete', nil, data_transform(data))
110
110
  end
111
111
  end
@@ -11,7 +11,7 @@ module Contacts
11
11
  # ==== Example
12
12
  # @data = @cxf_user.get_contacts_support_data
13
13
  def get_contacts_support_data
14
- @client.raw('get', '/crm/contacts/support-data')
14
+ @client.raw('get', '/customer-data/contacts/support-data')
15
15
  end
16
16
 
17
17
  ##
@@ -24,7 +24,7 @@ module Contacts
24
24
  # ==== Example
25
25
  # @data = @cxf_user.get_online_activity(5)
26
26
  def get_online_activity(id)
27
- @client.raw('get', "/crm/contacts/#{id}/online-activity")
27
+ @client.raw('get', "/customer-data/contacts/#{id}/online-activity")
28
28
  end
29
29
 
30
30
  ##
@@ -52,7 +52,7 @@ module Contacts
52
52
  # }
53
53
  # @data = @cxf_user.get_contacts(options, true)
54
54
  def get_contacts(options = nil, use_post = true)
55
- get_query_results('/crm/contacts', options, use_post)
55
+ get_query_results('/customer-data/contacts', options, use_post)
56
56
  end
57
57
 
58
58
  ##
@@ -73,7 +73,7 @@ module Contacts
73
73
  # }
74
74
  # @data = @cxf_user.get_contact(5, options)
75
75
  def get_contact(id, options = nil)
76
- @client.raw('get', "/crm/contacts/#{id}", options)
76
+ @client.raw('get', "/customer-data/contacts/#{id}", options)
77
77
  end
78
78
 
79
79
  ##
@@ -92,7 +92,32 @@ module Contacts
92
92
  # }
93
93
  # @data = @cxf_user.create_contact(data)
94
94
  def create_contact(data, options = nil)
95
- @client.raw('post', '/crm/contacts', options, data_transform(data))
95
+ @client.raw('post', '/customer-data/contacts', options, data_transform(data))
96
+ end
97
+
98
+ ##
99
+ # === Add contact profile.
100
+ # Add a profile to a contact.
101
+ #
102
+ # ==== Parameters
103
+ # contact_id:: (Integer) -- Contact id.
104
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
105
+ def add_contact_profile(contact_id, data, options = nil)
106
+ @client.raw('post', "/customer-data/contacts/#{contact_id}/add-profiles", options, data)
107
+ end
108
+
109
+ ##
110
+ # === Remove contact profile.
111
+ # Remove a profile from a contact.
112
+ #
113
+ # ==== Parameters
114
+ # contact_id:: (Integer) -- Contact id.
115
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
116
+ #
117
+ # ==== Example
118
+ # @data = @cxf_user.remove_contact_profile(4)
119
+ def remove_contact_profile(contact_id, options = nil)
120
+ @client.raw('post', "/customer-data/contacts/#{contact_id}/remove-profiles", options)
96
121
  end
97
122
 
98
123
  ##
@@ -110,7 +135,7 @@ module Contacts
110
135
  # }
111
136
  # @data = @cxf_user.update_contact(65, data)
112
137
  def update_contact(id, data, options = nil)
113
- @client.raw('put', "/crm/contacts/#{id}", options, data_transform(data))
138
+ @client.raw('put', "/customer-data/contacts/#{id}", options, data_transform(data))
114
139
  end
115
140
 
116
141
  ##
@@ -123,7 +148,7 @@ module Contacts
123
148
  # ==== Example
124
149
  # @data = @cxf_user.get_contact_deal(5)
125
150
  def get_contact_deal(contact_id)
126
- @client.raw('get', "/crm/contacts/#{contact_id}/deals")
151
+ @client.raw('get', "/customer-data/contacts/#{contact_id}/deals")
127
152
  end
128
153
 
129
154
  ##
@@ -138,7 +163,7 @@ module Contacts
138
163
  # data = { deal_id: 6 }
139
164
  # @data = @cxf_user.create_contact_deal(5, data.to_json)
140
165
  def create_contact_deal(contact_id, data)
141
- @client.raw('post', "/crm/contacts/#{contact_id}/deals", nil, data)
166
+ @client.raw('post', "/customer-data/contacts/#{contact_id}/deals", nil, data)
142
167
  end
143
168
 
144
169
  ##
@@ -152,7 +177,7 @@ module Contacts
152
177
  # ==== Example
153
178
  # @data = @cxf_user.delete_contact_deal(5, 100)
154
179
  def delete_contact_deal(contact_id, deal_id)
155
- @client.raw('delete', "/crm/contacts/#{contact_id}/deals/#{deal_id}")
180
+ @client.raw('delete', "/customer-data/contacts/#{contact_id}/deals/#{deal_id}")
156
181
  end
157
182
 
158
183
  ##
@@ -167,7 +192,7 @@ module Contacts
167
192
  # ==== Example
168
193
  # @data = @cxf_user.get_contact_user(66)
169
194
  def get_contact_user(contact_id)
170
- @client.raw('get', "/crm/contacts/#{contact_id}/users")
195
+ @client.raw('get', "/customer-data/contacts/#{contact_id}/users")
171
196
  end
172
197
 
173
198
  ##
@@ -182,7 +207,7 @@ module Contacts
182
207
  # data = { user_id: 9 }
183
208
  # @data = @cxf_user.create_contact_user(66, data.to_json)
184
209
  def create_contact_user(contact_id, data)
185
- @client.raw('post', "/crm/contacts/#{contact_id}/users", nil, data)
210
+ @client.raw('post', "/customer-data/contacts/#{contact_id}/users", nil, data)
186
211
  end
187
212
 
188
213
  ##
@@ -196,7 +221,7 @@ module Contacts
196
221
  # ==== Example
197
222
  # @data = @cxf_user.delete_contact_user(153, 9)
198
223
  def delete_contact_user(contact_id, id)
199
- @client.raw('delete', "/crm/contacts/#{contact_id}/users/#{id}")
224
+ @client.raw('delete', "/customer-data/contacts/#{contact_id}/users/#{id}")
200
225
  end
201
226
 
202
227
  ##
@@ -209,7 +234,7 @@ module Contacts
209
234
  # ==== Example
210
235
  # @data = @cxf_user.get_contact_segments(1)
211
236
  def get_contact_segments(contact_id)
212
- @client.raw('get', "/crm/contacts/#{contact_id}/segments")
237
+ @client.raw('get', "/customer-data/contacts/#{contact_id}/segments")
213
238
  end
214
239
 
215
240
  ##
@@ -222,7 +247,7 @@ module Contacts
222
247
  # ==== Example
223
248
  # @data = @cxf_user.get_contact_submissions(146)
224
249
  def get_contact_submissions(contact_id)
225
- @client.raw('get', "/crm/contacts/#{contact_id}/submissions")
250
+ @client.raw('get', "/customer-data/contacts/#{contact_id}/submissions")
226
251
  end
227
252
 
228
253
  ##
@@ -235,7 +260,7 @@ module Contacts
235
260
  # ==== Example
236
261
  # @data = @cxf_user.get_contact_tags(1)
237
262
  def get_contact_tags(contact_id)
238
- @client.raw('get', "/crm/contacts/#{contact_id}/tags")
263
+ @client.raw('get', "/customer-data/contacts/#{contact_id}/tags")
239
264
  end
240
265
 
241
266
  ##
@@ -250,7 +275,7 @@ module Contacts
250
275
  # data = { mergeContactIds: [152] }
251
276
  # @data = @cxf_user.merge_contacts(151, data)
252
277
  def merge_contacts(id, data)
253
- @client.raw('post', "/crm/contacts/#{id}/merge", nil, data_transform(data))
278
+ @client.raw('post', "/customer-data/contacts/#{id}/merge", nil, data_transform(data))
254
279
  end
255
280
 
256
281
  ##
@@ -270,7 +295,7 @@ module Contacts
270
295
  # }
271
296
  # @data = @cxf_user.send_magic_links(data)
272
297
  def send_magic_links(data)
273
- @client.raw('post', '/crm/contacts/send-magic-link', nil, data_transform(data))
298
+ @client.raw('post', '/customer-data/contacts/send-magic-link', nil, data_transform(data))
274
299
  end
275
300
 
276
301
  ##
@@ -289,6 +314,6 @@ module Contacts
289
314
  # @data = @cxf_user.delete_contacts(data)
290
315
  def delete_contacts(data)
291
316
  # TODO: ContactController.delete need a success output
292
- @client.raw('delete', '/crm/contacts/delete', nil, data_transform(data))
317
+ @client.raw('delete', '/customer-data/contacts/delete', nil, data_transform(data))
293
318
  end
294
319
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './companies'
4
+ require_relative './contacts'
5
+ require_relative './profiles'
6
+ require_relative './segments'
7
+ require_relative './workflows'
8
+ require_relative './workflow_steps'
9
+
10
+ module CustomerData
11
+ include Companies
12
+ include Contacts
13
+ include Profiles
14
+ include Segments
15
+ include Workflows
16
+ include WorkflowSteps
17
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Profiles
4
+ ##
5
+ # == Profiles
6
+ #
7
+
8
+ # === Get profiles.
9
+ # Get a collection of profiles.
10
+ #
11
+ # ==== Parameters
12
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
13
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
14
+ #
15
+ # ==== First Example
16
+ # @data = @cxf_user.get_profiles
17
+ #
18
+ # ==== Second Example
19
+ # options = { fields: 'id, title', sort: '-id' }
20
+ # @data = @cxf_user.get_profiles(options)
21
+ #
22
+ # ==== Third Example
23
+ # options = { fields: 'id, title', sort: '-id' }
24
+ # @data = @cxf_user.get_profiles(options, false)
25
+ def get_profiles(options = nil, use_post = true)
26
+ get_query_results('/customer-data/profiles', options, use_post)
27
+ end
28
+
29
+ # === Get profile.
30
+ # Get a profile info.
31
+ #
32
+ # ==== Parameters
33
+ # id:: (Integer) -- Company 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_profile(21)
38
+ #
39
+ # ==== Second Example
40
+ # options = { fields: 'id, title' }
41
+ # @data = @cxf_user.get_profile(21, options)
42
+ def get_profile(id, options = nil)
43
+ @client.raw('get', "/customer-data/profiles/#{id}", options)
44
+ end
45
+
46
+ # === Create profile.
47
+ # Create a profile with data.
48
+ #
49
+ # ==== Parameters
50
+ # data:: (Hash) -- Data to be submitted.
51
+ #
52
+ # ==== Example
53
+ # data = {
54
+ # example_field: 'example_value'
55
+ # }
56
+ # @data = @cxf_user.create_profile(data)
57
+ def create_profile(data, options = nil)
58
+ @client.raw('post', '/customer-data/profiles/', options, data_transform(data))
59
+ end
60
+
61
+ # === Update profile.
62
+ # Update a profile info.
63
+ #
64
+ # ==== Parameters
65
+ # id:: (Integer) -- Company id.
66
+ # data:: (Hash) -- Data to be submitted.
67
+ #
68
+ # ==== Example
69
+ # data = {
70
+ # example_field: 'example_value_modified'
71
+ # }
72
+ # @data = @cxf_user.update_profile(23, data)
73
+ def update_profile(id, data, options = nil)
74
+ @client.raw('put', "/customer-data/profiles/#{id}", options, data_transform(data))
75
+ end
76
+
77
+ ##
78
+ # == Profiles Bulk Actions
79
+ #
80
+
81
+ # === Delete Profiles.
82
+ # Delete a group of profiles.
83
+ #
84
+ # ==== Parameters
85
+ # data:: (Hash) -- Data to be submitted.
86
+ #
87
+ # ==== Example
88
+ # data = { ids: %w[21 22] }
89
+ # @data = @cxf_user.delete_profiles(data)
90
+ def delete_profiles(data)
91
+ @client.raw('delete', '/customer-data/profiles/delete', nil, data_transform(data))
92
+ end
93
+ end