cxf 0.0.1
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 +7 -0
- data/Gemfile +12 -0
- data/README.md +395 -0
- data/lib/client.rb +447 -0
- data/lib/contact/config/config.rb +4 -0
- data/lib/contact/content/content.rb +4 -0
- data/lib/contact/ecommerce/ecommerce.rb +4 -0
- data/lib/contact.rb +284 -0
- data/lib/cxf/controllers/admin_base_controller.rb +17 -0
- data/lib/cxf/controllers/base_api_controller.rb +28 -0
- data/lib/cxf/controllers/base_controller.rb +54 -0
- data/lib/cxf/controllers/concerns/cxf_clients.rb +104 -0
- data/lib/cxf/controllers/concerns/read_config_file.rb +30 -0
- data/lib/cxf/controllers/contact_api_controller.rb +17 -0
- data/lib/cxf/controllers/public_api_controller.rb +14 -0
- data/lib/cxf/controllers/user_api_controller.rb +16 -0
- data/lib/cxf/helpers/contact_auth_helper.rb +86 -0
- data/lib/cxf/helpers/cxf_helper.rb +52 -0
- data/lib/cxf/helpers/proxy_controllers_methods.rb +144 -0
- data/lib/cxf/helpers/threads_helper.rb +109 -0
- data/lib/cxf/helpers/user_auth_helper.rb +74 -0
- data/lib/cxf.rb +15 -0
- data/lib/errors.rb +109 -0
- data/lib/generators/cxf_assets_controller.rb +7 -0
- data/lib/generators/cxf_config.yml.erb +27 -0
- data/lib/generators/cxf_contact_controller.rb +7 -0
- data/lib/generators/cxf_files_generator.rb +28 -0
- data/lib/generators/cxf_public_controller.rb +7 -0
- data/lib/generators/cxf_user_controller.rb +7 -0
- data/lib/pub/config/config.rb +6 -0
- data/lib/pub/content/assets.rb +16 -0
- data/lib/pub/content/content.rb +9 -0
- data/lib/pub/ecommerce/ecommerce.rb +6 -0
- data/lib/pub.rb +163 -0
- data/lib/user/config/attribute_groups.rb +79 -0
- data/lib/user/config/attributes.rb +88 -0
- data/lib/user/config/calendars.rb +91 -0
- data/lib/user/config/config.rb +23 -0
- data/lib/user/config/relationships.rb +141 -0
- data/lib/user/config/seeds.rb +55 -0
- data/lib/user/config/system_settings.rb +54 -0
- data/lib/user/config/tags.rb +61 -0
- data/lib/user/config/taxonomies.rb +120 -0
- data/lib/user/config/users.rb +77 -0
- data/lib/user/config/views.rb +68 -0
- data/lib/user/contacts/contacts.rb +22 -0
- data/lib/user/content/assets.rb +294 -0
- data/lib/user/content/block_templates.rb +72 -0
- data/lib/user/content/blocks.rb +109 -0
- data/lib/user/content/content.rb +174 -0
- data/lib/user/content/instances.rb +121 -0
- data/lib/user/content/print_versions.rb +129 -0
- data/lib/user/content/stories.rb +110 -0
- data/lib/user/content/story_templates.rb +97 -0
- data/lib/user/content/templates.rb +72 -0
- data/lib/user/crm/companies.rb +111 -0
- data/lib/user/crm/contacts.rb +294 -0
- data/lib/user/crm/crm.rb +9 -0
- data/lib/user/ecommerce/ecommerce.rb +29 -0
- data/lib/user/ecommerce/item_prices.rb +89 -0
- data/lib/user/ecommerce/locations.rb +171 -0
- data/lib/user/ecommerce/price_lists.rb +75 -0
- data/lib/user/ecommerce/product_templates.rb +106 -0
- data/lib/user/ecommerce/product_variations.rb +133 -0
- data/lib/user/ecommerce/product_versions.rb +107 -0
- data/lib/user/ecommerce/products.rb +156 -0
- data/lib/user/ecommerce/skus.rb +90 -0
- data/lib/user/ecommerce/taxes.rb +84 -0
- data/lib/user/ecommerce/variant_options.rb +71 -0
- data/lib/user/ecommerce/variant_values.rb +74 -0
- data/lib/user/ecommerce/vouchers.rb +90 -0
- data/lib/user/helpers/helpers.rb +116 -0
- data/lib/user/helpers/object_activities.rb +85 -0
- data/lib/user/helpers/object_folders.rb +84 -0
- data/lib/user/helpers/user_folders.rb +85 -0
- data/lib/user/marketing/marketing.rb +123 -0
- data/lib/user/profile/profile.rb +104 -0
- data/lib/user.rb +98 -0
- metadata +227 -0
@@ -0,0 +1,156 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Products
|
4
|
+
##
|
5
|
+
# == Product
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Update product variations config.
|
9
|
+
# Update config of product variations of a product.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# product_id:: (Integer) -- Product id.
|
13
|
+
# data:: (Hash) -- Data to be submitted.
|
14
|
+
#
|
15
|
+
def update_product_variations_config(product_id, data)
|
16
|
+
# TODO: Method doesnt work, research use
|
17
|
+
@client.raw('post', "/ecommerce/products/update-variations-config/#{product_id}", nil, data_transform(data))
|
18
|
+
end
|
19
|
+
|
20
|
+
# === Get product support data.
|
21
|
+
# Get support data used in products.
|
22
|
+
#
|
23
|
+
# ==== Example
|
24
|
+
# @data = @cxf_user.get_products_support_data
|
25
|
+
def get_products_support_data
|
26
|
+
@client.raw('get', '/ecommerce/products/support-data')
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Delete product.
|
30
|
+
# Delete a product.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# id:: (Integer) -- Product id.
|
34
|
+
#
|
35
|
+
def delete_product(id)
|
36
|
+
@client.raw('delete', "/ecommerce/products/#{id}")
|
37
|
+
end
|
38
|
+
|
39
|
+
# === Schedule product.
|
40
|
+
# Schedule a product.
|
41
|
+
#
|
42
|
+
# ==== Parameters
|
43
|
+
# id:: (Integer) -- Product id.
|
44
|
+
# data:: (Hash) -- Data to be submitted.
|
45
|
+
#
|
46
|
+
# ==== Example
|
47
|
+
# data = {
|
48
|
+
# scheduled_at: '1970-01-01 00:00:00'
|
49
|
+
# }
|
50
|
+
# @data = @cxf_user.schedule_product(2, data)
|
51
|
+
def schedule_product(id, data)
|
52
|
+
@client.raw('put', "/ecommerce/products/#{id}/schedule", nil, data_transform(data))
|
53
|
+
end
|
54
|
+
|
55
|
+
# === Get product variant options config.
|
56
|
+
# Get variant options config used in a product.
|
57
|
+
#
|
58
|
+
# ==== Parameters
|
59
|
+
# id:: (Integer) -- Product id.
|
60
|
+
#
|
61
|
+
# ==== Example
|
62
|
+
# @data = @cxf_user.get_product_variant_options_config(1)
|
63
|
+
def get_product_variant_options_config(id)
|
64
|
+
@client.raw('get', "/ecommerce/products/#{id}/variant-options-config")
|
65
|
+
end
|
66
|
+
|
67
|
+
# === Revert published product.
|
68
|
+
# Revert a published product.
|
69
|
+
#
|
70
|
+
# ==== Parameters
|
71
|
+
# id:: (Integer) -- Product id.
|
72
|
+
#
|
73
|
+
# ==== Example
|
74
|
+
# @data = @cxf_user.revert_published_product(2)
|
75
|
+
def revert_published_product(id)
|
76
|
+
@client.raw('get', "/ecommerce/products/#{id}/revert-published-data")
|
77
|
+
end
|
78
|
+
|
79
|
+
# === Get products.
|
80
|
+
# Get a collection of products.
|
81
|
+
#
|
82
|
+
# ==== Parameters
|
83
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
84
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
85
|
+
#
|
86
|
+
# ==== First Example
|
87
|
+
# @data = @cxf_user.get_products
|
88
|
+
#
|
89
|
+
# ==== Second Example
|
90
|
+
# options = {
|
91
|
+
# fields: 'id'
|
92
|
+
# }
|
93
|
+
# @data = @cxf_user.get_products(options)
|
94
|
+
#
|
95
|
+
# ==== Third Example
|
96
|
+
# options = {
|
97
|
+
# fields: 'id'
|
98
|
+
# }
|
99
|
+
# @data = @cxf_user.get_products(options, false)
|
100
|
+
def get_products(options = nil, use_post = true)
|
101
|
+
get_query_results('/ecommerce/products', options, use_post)
|
102
|
+
end
|
103
|
+
|
104
|
+
# === Get product.
|
105
|
+
# Get a product info.
|
106
|
+
#
|
107
|
+
# ==== Parameters
|
108
|
+
# id:: (Integer) -- Product id.
|
109
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
110
|
+
#
|
111
|
+
# ==== First Example
|
112
|
+
# @data = @cxf_user.get_product(3)
|
113
|
+
#
|
114
|
+
# ==== Second Example
|
115
|
+
# options = {
|
116
|
+
# fields: "slug"
|
117
|
+
# }
|
118
|
+
# @data = @cxf_user.get_product(3, options)
|
119
|
+
def get_product(id, options = nil)
|
120
|
+
@client.raw('get', "/ecommerce/products/#{id}", options)
|
121
|
+
end
|
122
|
+
|
123
|
+
# === Create product.
|
124
|
+
# Create a product with data.
|
125
|
+
#
|
126
|
+
# ==== Parameters
|
127
|
+
# data:: (Hash) -- Data to be submitted.
|
128
|
+
#
|
129
|
+
# ==== Example
|
130
|
+
# data = {
|
131
|
+
# title: 'New Product',
|
132
|
+
# slug: 'new-product',
|
133
|
+
# sku_prefix: 'sku_prefix'
|
134
|
+
# }
|
135
|
+
# @data = @cxf_user.create_product(data)
|
136
|
+
def create_product(data, options = nil)
|
137
|
+
@client.raw('post', '/ecommerce/products/', options, data_transform(data))
|
138
|
+
end
|
139
|
+
|
140
|
+
# === Update product.
|
141
|
+
# Update a product info.
|
142
|
+
#
|
143
|
+
# ==== Parameters
|
144
|
+
# id:: (Integer) -- Product id.
|
145
|
+
# data:: (Hash) -- Data to be submitted.
|
146
|
+
#
|
147
|
+
# ==== Example
|
148
|
+
# data = {
|
149
|
+
# title: 'New Product Modified',
|
150
|
+
# slug: 'new-product'
|
151
|
+
# }
|
152
|
+
# @data = @cxf_user.update_product(9, data)
|
153
|
+
def update_product(id, data, options = nil)
|
154
|
+
@client.raw('put', "/ecommerce/products/#{id}", options, data_transform(data))
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Skus
|
4
|
+
##
|
5
|
+
# == Sku
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get skus.
|
9
|
+
# Get a collection of skus.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
13
|
+
#
|
14
|
+
# ==== First Example
|
15
|
+
# @data = @cxf_user.get_skus
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = {
|
19
|
+
# fields: 'sku'
|
20
|
+
# }
|
21
|
+
# @data = @cxf_user.get_skus(options)
|
22
|
+
def get_skus(options = nil)
|
23
|
+
@client.raw('get', '/ecommerce/skus', options)
|
24
|
+
end
|
25
|
+
|
26
|
+
# === Get sku.
|
27
|
+
# Get a sku info.
|
28
|
+
#
|
29
|
+
# ==== Parameters
|
30
|
+
# id:: (Integer) -- Sku id.
|
31
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
32
|
+
#
|
33
|
+
# ==== First Example
|
34
|
+
# @data = @cxf_user.get_sku(1)
|
35
|
+
#
|
36
|
+
# ==== Second Example
|
37
|
+
# options = {
|
38
|
+
# fields: 'title, sku'
|
39
|
+
# }
|
40
|
+
# @data = @cxf_user.get_sku(1, options)
|
41
|
+
def get_sku(id, options = nil)
|
42
|
+
@client.raw('get', "/ecommerce/skus/#{id}", options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# === Create sku.
|
46
|
+
# Create a sku with data.
|
47
|
+
#
|
48
|
+
# ==== Parameters
|
49
|
+
# data:: (Hash) -- Data to be submitted.
|
50
|
+
#
|
51
|
+
# ==== Example
|
52
|
+
# data = {
|
53
|
+
# sku: 'NEW-SKU',
|
54
|
+
# title: 'New Sku',
|
55
|
+
# slug: 'new-sku',
|
56
|
+
# product_id: 1
|
57
|
+
# }
|
58
|
+
# @data = @cxf_user.create_sku(data)
|
59
|
+
def create_sku(data, options = nil)
|
60
|
+
@client.raw('post', '/ecommerce/skus', options, data_transform(data))
|
61
|
+
end
|
62
|
+
|
63
|
+
# === Update sku.
|
64
|
+
# Update a sku info.
|
65
|
+
#
|
66
|
+
# ==== Parameters
|
67
|
+
# id:: (Integer) -- Sku id.
|
68
|
+
# data:: (Hash) -- Data to be submitted.
|
69
|
+
#
|
70
|
+
# ==== Example
|
71
|
+
# data = {
|
72
|
+
# sku: 'NEW-SKU-XXXIX'
|
73
|
+
# }
|
74
|
+
# @data = @cxf_user.update_sku(531, data)
|
75
|
+
def update_sku(id, data)
|
76
|
+
@client.raw('put', "/ecommerce/skus/#{id}", nil, data_transform(data))
|
77
|
+
end
|
78
|
+
|
79
|
+
# === Delete sku.
|
80
|
+
# Delete a sku.
|
81
|
+
#
|
82
|
+
# ==== Parameters
|
83
|
+
# id:: (Integer) -- Sku id.
|
84
|
+
#
|
85
|
+
# ==== Example
|
86
|
+
# @data = @cxf_user.delete_sku(531)
|
87
|
+
def delete_sku(id)
|
88
|
+
@client.raw('delete', "/ecommerce/skus/#{id}")
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Taxes
|
4
|
+
##
|
5
|
+
# == Taxes
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get taxes.
|
9
|
+
# Get a collection of taxes.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
13
|
+
#
|
14
|
+
# ==== First Example
|
15
|
+
# @data = @cxf_user.get_taxes
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = { fields: 'title' }
|
19
|
+
# @data = @cxf_user.get_taxes(options)
|
20
|
+
def get_taxes(options = nil)
|
21
|
+
@client.raw('get', '/ecommerce/taxes', options)
|
22
|
+
end
|
23
|
+
|
24
|
+
# === Get tax.
|
25
|
+
# Get a tax info.
|
26
|
+
#
|
27
|
+
# ==== Parameters
|
28
|
+
# id:: (Integer) -- Tax id.
|
29
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
30
|
+
#
|
31
|
+
# ==== First Example
|
32
|
+
# @data = @cxf_user.get_tax(1)
|
33
|
+
#
|
34
|
+
# ==== Second Example
|
35
|
+
# options = { fields: 'title' }
|
36
|
+
# @data = @cxf_user.get_tax(1, options)
|
37
|
+
def get_tax(id, options = nil)
|
38
|
+
@client.raw('get', "/ecommerce/taxes/#{id}", options)
|
39
|
+
end
|
40
|
+
|
41
|
+
# === Create tax.
|
42
|
+
# Create a tax with data.
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
# data:: (Hash) -- Data to be submitted.
|
46
|
+
#
|
47
|
+
# ==== Example
|
48
|
+
# data = {
|
49
|
+
# title: 'New Tax',
|
50
|
+
# tax_percentage: 100
|
51
|
+
# }
|
52
|
+
# @data = @cxf_user.create_tax(data)
|
53
|
+
def create_tax(data)
|
54
|
+
@client.raw('post', '/ecommerce/taxes', nil, data_transform(data))
|
55
|
+
end
|
56
|
+
|
57
|
+
# === Update tax.
|
58
|
+
# Update a tax info.
|
59
|
+
#
|
60
|
+
# ==== Parameters
|
61
|
+
# id:: (Integer) -- Tax id.
|
62
|
+
# data:: (Hash) -- Data to be submitted.
|
63
|
+
#
|
64
|
+
# ==== Example
|
65
|
+
# data = {
|
66
|
+
# tax_percentage: 10
|
67
|
+
# }
|
68
|
+
# @data = @cxf_user.update_tax(11, data)
|
69
|
+
def update_tax(id, data)
|
70
|
+
@client.raw('put', "/ecommerce/taxes/#{id}", nil, data_transform(data))
|
71
|
+
end
|
72
|
+
|
73
|
+
# === Delete tax.
|
74
|
+
# Delete a tax.
|
75
|
+
#
|
76
|
+
# ==== Parameters
|
77
|
+
# id:: (Integer) -- Tax id.
|
78
|
+
#
|
79
|
+
# ==== Example
|
80
|
+
# @data = @cxf_user.delete_tax(11)
|
81
|
+
def delete_tax(id)
|
82
|
+
@client.raw('delete', "/ecommerce/taxes/#{id}")
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VariantOptions
|
4
|
+
##
|
5
|
+
# == Variant Options
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get variant options.
|
9
|
+
# Get a collection of variant options.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
13
|
+
#
|
14
|
+
# ==== First Example
|
15
|
+
# @data = @cxf_user.get_variant_options
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = { fields: 'id, title' }
|
19
|
+
# @data = @cxf_user.get_variant_options(options)
|
20
|
+
def get_variant_options(options = nil)
|
21
|
+
@client.raw('get', '/ecommerce/variant-options', options)
|
22
|
+
end
|
23
|
+
|
24
|
+
# === Get variant option.
|
25
|
+
# Get a variant options info.
|
26
|
+
#
|
27
|
+
# ==== Parameters
|
28
|
+
# id:: (Integer) -- Variant option id.
|
29
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
30
|
+
#
|
31
|
+
# ==== First Example
|
32
|
+
# @data = @cxf_user.get_variant_option(1)
|
33
|
+
#
|
34
|
+
# ==== Second Example
|
35
|
+
# options = { fields: 'id, title' }
|
36
|
+
# @data = @cxf_user.get_variant_option(1, options)
|
37
|
+
def get_variant_option(id, options = nil)
|
38
|
+
@client.raw('get', "/ecommerce/variant-options/#{id}", options)
|
39
|
+
end
|
40
|
+
|
41
|
+
# === Create variant option.
|
42
|
+
# Create a variant option with data.
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
# data:: (Hash) -- Data to be submitted.
|
46
|
+
#
|
47
|
+
# ==== Example
|
48
|
+
# data = {
|
49
|
+
# title: 'New Variant Option'
|
50
|
+
# }
|
51
|
+
# @data = @cxf_user.create_variant_option(data)
|
52
|
+
def create_variant_option(data)
|
53
|
+
@client.raw('post', '/ecommerce/variant-options', nil, data_transform(data))
|
54
|
+
end
|
55
|
+
|
56
|
+
# === Update variant option.
|
57
|
+
# Update a variant option info.
|
58
|
+
#
|
59
|
+
# ==== Parameters
|
60
|
+
# id:: (Integer) -- Variant option id.
|
61
|
+
# data:: (Hash) -- Data to be submitted.
|
62
|
+
#
|
63
|
+
# ==== Example
|
64
|
+
# data = {
|
65
|
+
# title: 'New Variant Option Modified'
|
66
|
+
# }
|
67
|
+
# @data = @cxf_user.update_variant_option(6, data)
|
68
|
+
def update_variant_option(id, data)
|
69
|
+
@client.raw('put', "/ecommerce/variant-options/#{id}", nil, data_transform(data))
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VariantValues
|
4
|
+
##
|
5
|
+
# == Variant Values
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get variant values.
|
9
|
+
# Get a collection of variant values.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
13
|
+
#
|
14
|
+
# ==== First Example
|
15
|
+
# @data = @cxf_user.get_variant_values
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = { sort: '-id'}
|
19
|
+
# @data = @cxf_user.get_variant_values(options)
|
20
|
+
def get_variant_values(options = nil)
|
21
|
+
@client.raw('get', '/ecommerce/variant-values', options)
|
22
|
+
end
|
23
|
+
|
24
|
+
# === Get variant value.
|
25
|
+
# Get a variant value info.
|
26
|
+
#
|
27
|
+
# ==== Parameters
|
28
|
+
# id:: (Integer) -- Variant value id.
|
29
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
30
|
+
#
|
31
|
+
# ==== First Example
|
32
|
+
# @data = @cxf_user.get_variant_value(5)
|
33
|
+
#
|
34
|
+
# ==== Second Example
|
35
|
+
# options = { fields: 'id'}
|
36
|
+
# @data = @cxf_user.get_variant_value(5, options)
|
37
|
+
def get_variant_value(id, options = nil)
|
38
|
+
@client.raw('get', "/ecommerce/variant-values/#{id}", options)
|
39
|
+
end
|
40
|
+
|
41
|
+
# === Create variant value.
|
42
|
+
# Create a variant value with data.
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
# data:: (Hash) -- Data to be submitted.
|
46
|
+
#
|
47
|
+
# ==== Example
|
48
|
+
# data = {
|
49
|
+
# value: 'New Variant Value',
|
50
|
+
# variant_option_id: 1,
|
51
|
+
# display_order: 1,
|
52
|
+
# sku_code: 'new-variant-value-sku'
|
53
|
+
# }
|
54
|
+
# @data = @cxf_user.create_variant_value(data)
|
55
|
+
def create_variant_value(data)
|
56
|
+
@client.raw('post', '/ecommerce/variant-values', nil, data_transform(data))
|
57
|
+
end
|
58
|
+
|
59
|
+
# === Update variant value.
|
60
|
+
# Update a variant value info.
|
61
|
+
#
|
62
|
+
# ==== Parameters
|
63
|
+
# id:: (Integer) -- Variant value id.
|
64
|
+
# data:: (Hash) -- Data to be submitted.
|
65
|
+
#
|
66
|
+
# ==== Example
|
67
|
+
# data = {
|
68
|
+
# value: 'New Variant Value Modified'
|
69
|
+
# }
|
70
|
+
# @data = @cxf_user.update_variant_value(22, data)
|
71
|
+
def update_variant_value(id, data)
|
72
|
+
@client.raw('put', "/ecommerce/variant-values/#{id}", nil, data_transform(data))
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vouchers
|
4
|
+
##
|
5
|
+
# === Get vouchers.
|
6
|
+
# Get a collection of vouchers.
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
10
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
11
|
+
#
|
12
|
+
# ==== First Example
|
13
|
+
#
|
14
|
+
# @data = @cxf_user.get_vouchers
|
15
|
+
# ==== Second Example
|
16
|
+
#
|
17
|
+
# options = { fields: 'id,title' }
|
18
|
+
# @data = @cxf_user.get_vouchers(options)
|
19
|
+
# ==== Third Example
|
20
|
+
#
|
21
|
+
# options = { fields: 'id,title' }
|
22
|
+
# @data = @cxf_user.get_vouchers(options, true)
|
23
|
+
#
|
24
|
+
def get_vouchers(options = nil, use_post = true)
|
25
|
+
get_query_results('/ecommerce/vouchers', options, use_post)
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# === Get vouchers.
|
30
|
+
# Get a specific voucher.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# id:: (Integer) -- Voucher id.
|
34
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
35
|
+
#
|
36
|
+
# ==== First Example
|
37
|
+
#
|
38
|
+
# @data = @cxf_user.get_voucher(1)
|
39
|
+
# ==== Second Example
|
40
|
+
#
|
41
|
+
# options = { fields: 'id,title' }
|
42
|
+
# @data = @cxf_user.get_voucher(1, options)
|
43
|
+
def get_voucher(id, options = nil)
|
44
|
+
@client.raw('get', "/ecommerce/vouchers/#{id}", options)
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# === Create voucher.
|
49
|
+
# Create voucher code.
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# data:: (Hash) -- Data to be submitted.
|
53
|
+
#
|
54
|
+
# ==== Example
|
55
|
+
# data = {
|
56
|
+
# title: 'Voucher title',
|
57
|
+
# voucher_code: 'XAZWQ12MP',
|
58
|
+
# amount: 100,
|
59
|
+
# start_date: '2023-03-28T10:20:00-06:00',
|
60
|
+
# end_date: '2023-03-31T10:20:00-06:00',
|
61
|
+
# is_redeemed: false
|
62
|
+
# }
|
63
|
+
#
|
64
|
+
# @data = @cxf_user.create_voucher(data)
|
65
|
+
def create_voucher(data)
|
66
|
+
@client.raw('post', '/ecommerce/vouchers', nil, data_transform(data))
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# === Update voucher.
|
71
|
+
# Update voucher code.
|
72
|
+
#
|
73
|
+
# ==== Parameters
|
74
|
+
# id:: (Integer) -- Voucher id.
|
75
|
+
# data:: (Hash) -- Data to be submitted.
|
76
|
+
#
|
77
|
+
# ==== Example
|
78
|
+
# data = {
|
79
|
+
# title: 'New voucher title',
|
80
|
+
# voucher_code: 'XAZWQ12MP2',
|
81
|
+
# amount: 250,
|
82
|
+
# start_date: '2023-03-27T10:20:00-06:00',
|
83
|
+
# end_date: '2023-03-30T10:20:00-06:00'
|
84
|
+
# }
|
85
|
+
#
|
86
|
+
# @data = @cxf_user.update_voucher(1, data)
|
87
|
+
def update_voucher(id, data)
|
88
|
+
@client.raw('put', "/ecommerce/vouchers/#{id}", nil, data_transform(data))
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './object_activities'
|
4
|
+
require_relative './object_folders'
|
5
|
+
require_relative './user_folders'
|
6
|
+
|
7
|
+
module Helpers
|
8
|
+
include ObjectActivities
|
9
|
+
include ObjectFolders
|
10
|
+
include UserFolders
|
11
|
+
|
12
|
+
##
|
13
|
+
# == Helpers
|
14
|
+
#
|
15
|
+
|
16
|
+
# === Slugify.
|
17
|
+
# Slugify a text using an object type.
|
18
|
+
#
|
19
|
+
# ==== Parameters
|
20
|
+
# data:: (Hash) -- Data to be submitted.
|
21
|
+
#
|
22
|
+
# ==== Example
|
23
|
+
#
|
24
|
+
def slugify(data)
|
25
|
+
# TODO: Research use of variable polymorphicObjectType
|
26
|
+
@client.raw('post', '/helpers/slugify', nil, data_transform(data))
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Get available types from usage.
|
30
|
+
# Get available types by usage.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# usage:: () -- ...
|
34
|
+
#
|
35
|
+
def get_available_types_from_usage(usage)
|
36
|
+
# TODO: Research use
|
37
|
+
@client.raw('get', "/helpers/available-types/#{usage}")
|
38
|
+
end
|
39
|
+
|
40
|
+
# === Get magic link config.
|
41
|
+
# Get config used in magic links.
|
42
|
+
#
|
43
|
+
# ==== Example
|
44
|
+
# @data = @cxf_user.get_magic_link_config
|
45
|
+
def get_magic_link_config
|
46
|
+
@client.raw('get', '/helpers/magic-link-config')
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# == Activities
|
51
|
+
#
|
52
|
+
|
53
|
+
# === Get activities by object type and id.
|
54
|
+
# Get activities using an object type and object type id.
|
55
|
+
#
|
56
|
+
# ==== Parameters
|
57
|
+
# object_type:: (String) -- Object type.
|
58
|
+
# id:: (Integer) -- Object type id.
|
59
|
+
#
|
60
|
+
# ==== Example
|
61
|
+
# @data = @cxf_user.get_activities_by_object_type_and_id('contacts', 1)
|
62
|
+
def get_activities_by_object_type_and_id(object_type, id)
|
63
|
+
@client.raw('get', "/helpers/activities/#{object_type}/#{id}")
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# == Dice Coefficient
|
68
|
+
#
|
69
|
+
|
70
|
+
# === Get dice coefficient.
|
71
|
+
# Get dice coefficient.
|
72
|
+
#
|
73
|
+
# ==== Parameters
|
74
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
75
|
+
#
|
76
|
+
# ==== Example
|
77
|
+
# options = {
|
78
|
+
# table: 'contacts',
|
79
|
+
# field: 'id',
|
80
|
+
# word: '1'
|
81
|
+
# }
|
82
|
+
# @data = @cxf_user.get_dice_coefficient(options)
|
83
|
+
def get_dice_coefficient(options)
|
84
|
+
@client.raw('get', '/helpers/dice-coefficient', options)
|
85
|
+
end
|
86
|
+
|
87
|
+
##
|
88
|
+
# == Permission
|
89
|
+
#
|
90
|
+
|
91
|
+
# === Get permission menu.
|
92
|
+
# Get permission menu.
|
93
|
+
#
|
94
|
+
# ==== Example
|
95
|
+
# @data = @cxf_user.get_permission_menu
|
96
|
+
def get_permission_menu
|
97
|
+
@client.raw('get', '/helpers/menu')
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# == Seed
|
102
|
+
#
|
103
|
+
|
104
|
+
# === Generate seed.
|
105
|
+
# Generate seed using object type and object type id.
|
106
|
+
#
|
107
|
+
# ==== Parameters
|
108
|
+
# objectType:: (String) -- Object type.
|
109
|
+
# id:: (Integer) -- Object type id.
|
110
|
+
#
|
111
|
+
# ==== Example
|
112
|
+
# @data = @cxf_user.generate_seed('contacts', 1)
|
113
|
+
def generate_seed(object_type, id)
|
114
|
+
@client.raw('get', "/helpers/seeds/#{object_type}/#{id}")
|
115
|
+
end
|
116
|
+
end
|