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,171 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Locations
|
4
|
+
##
|
5
|
+
# == Locations
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get locations.
|
9
|
+
# Get a collection of locations.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
13
|
+
#
|
14
|
+
# ==== First Example
|
15
|
+
# @data = @cxf_user.get_locations
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = {
|
19
|
+
# fields: 'id, title'
|
20
|
+
# }
|
21
|
+
# @data = @cxf_user.get_locations(options)
|
22
|
+
def get_locations(options = nil, use_post = true)
|
23
|
+
get_query_results('/ecommerce/locations', options, use_post)
|
24
|
+
end
|
25
|
+
|
26
|
+
# === Get location.
|
27
|
+
# Get a location info.
|
28
|
+
#
|
29
|
+
# ==== Parameters
|
30
|
+
# id:: (Integer) -- Location id.
|
31
|
+
#
|
32
|
+
# ==== Example
|
33
|
+
# @data = @cxf_user.get_location(2)
|
34
|
+
def get_location(id, options = nil)
|
35
|
+
@client.raw('get', "/ecommerce/locations/#{id}", options)
|
36
|
+
end
|
37
|
+
|
38
|
+
# === Create location.
|
39
|
+
# Create a location with data.
|
40
|
+
#
|
41
|
+
# ==== Parameters
|
42
|
+
# data:: (Hash) -- Data to be submitted.
|
43
|
+
#
|
44
|
+
# ==== Example
|
45
|
+
# data = {
|
46
|
+
# title: 'New Location',
|
47
|
+
# location_template_id: 1
|
48
|
+
# }
|
49
|
+
# @data = @cxf_user.create_location(data)
|
50
|
+
def create_location(data, options = nil)
|
51
|
+
@client.raw('post', '/ecommerce/locations', options, data_transform(data))
|
52
|
+
end
|
53
|
+
|
54
|
+
# === Update location.
|
55
|
+
# Update a location info.
|
56
|
+
#
|
57
|
+
# ==== Parameters
|
58
|
+
# id:: (Integer) -- Location id.
|
59
|
+
# data:: (Hash) -- Data to be submitted.
|
60
|
+
#
|
61
|
+
# ==== Example
|
62
|
+
# data = {
|
63
|
+
# title: 'New Location Modified'
|
64
|
+
# }
|
65
|
+
# @data = @cxf_user.update_location(5, data)
|
66
|
+
def update_location(id, data, options = nil)
|
67
|
+
@client.raw('put', "/ecommerce/locations/#{id}", options, data_transform(data))
|
68
|
+
end
|
69
|
+
|
70
|
+
# === Delete location.
|
71
|
+
# Delete a location.
|
72
|
+
#
|
73
|
+
# ==== Parameters
|
74
|
+
# id:: (Integer) -- Location id.
|
75
|
+
#
|
76
|
+
# ==== Example
|
77
|
+
# @data = @cxf_user.delete_location(5)
|
78
|
+
def delete_location(id)
|
79
|
+
@client.raw('delete', "/ecommerce/locations/#{id}")
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# == Locations Templates
|
84
|
+
#
|
85
|
+
|
86
|
+
# === Get location template support data.
|
87
|
+
# Get support data used in a location template.
|
88
|
+
#
|
89
|
+
# ==== Parameters
|
90
|
+
# id:: (Integer) -- Location template id.
|
91
|
+
#
|
92
|
+
# ==== Example
|
93
|
+
# @data = @cxf_user.get_location_template_support_data(1)
|
94
|
+
def get_location_template_support_data(id)
|
95
|
+
@client.raw('get', "/ecommerce/location-templates/#{id}/support-data")
|
96
|
+
end
|
97
|
+
|
98
|
+
# === Get location templates support data.
|
99
|
+
# Get support data used in location templates.
|
100
|
+
#
|
101
|
+
# ==== Example
|
102
|
+
# @data = @cxf_user.get_location_templates_support_data
|
103
|
+
def get_location_templates_support_data
|
104
|
+
@client.raw('get', '/ecommerce/location-templates/support-data')
|
105
|
+
end
|
106
|
+
|
107
|
+
# === Get location templates.
|
108
|
+
# Get a collection of location templates.
|
109
|
+
#
|
110
|
+
# ==== Parameters
|
111
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
112
|
+
#
|
113
|
+
# ==== First Example
|
114
|
+
# @data = @cxf_user.get_location_templates
|
115
|
+
#
|
116
|
+
# ==== Second Example
|
117
|
+
# options = { fields: 'title' }
|
118
|
+
# @data = @cxf_user.get_location_templates(options)
|
119
|
+
def get_location_templates(options = nil)
|
120
|
+
@client.raw('get', '/ecommerce/location-templates', options)
|
121
|
+
end
|
122
|
+
|
123
|
+
# === Get location template.
|
124
|
+
# Get a location template info.
|
125
|
+
#
|
126
|
+
# ==== Parameters
|
127
|
+
# id:: (Integer) -- Location template id.
|
128
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
129
|
+
#
|
130
|
+
# ==== First Example
|
131
|
+
# @data = @cxf_user.get_location_template(1)
|
132
|
+
#
|
133
|
+
# ==== Second Example
|
134
|
+
# options = { fields: 'title' }
|
135
|
+
# @data = @cxf_user.get_location_template(1, options)
|
136
|
+
def get_location_template(id, options = nil)
|
137
|
+
@client.raw('get', "/ecommerce/location-templates/#{id}", options)
|
138
|
+
end
|
139
|
+
|
140
|
+
# === Create location template.
|
141
|
+
# Create a location template with data.
|
142
|
+
#
|
143
|
+
# ==== Parameters
|
144
|
+
# data:: (Hash) -- Data to be submitted.
|
145
|
+
#
|
146
|
+
# ==== Example
|
147
|
+
# data = {
|
148
|
+
# title: 'New Location Template',
|
149
|
+
# slug: 'new-location-template'
|
150
|
+
# }
|
151
|
+
# @data = @cxf_user.create_location_template(data)
|
152
|
+
def create_location_template(data)
|
153
|
+
@client.raw('post', '/ecommerce/location-templates', nil, data_transform(data))
|
154
|
+
end
|
155
|
+
|
156
|
+
# === Update location template.
|
157
|
+
# Update a location template info.
|
158
|
+
#
|
159
|
+
# ==== Parameters
|
160
|
+
# id:: (Integer) -- Location template id.
|
161
|
+
# data:: (Hash) -- Data to be submitted.
|
162
|
+
#
|
163
|
+
# ==== Example
|
164
|
+
# data = {
|
165
|
+
# title: 'New Location Template Modified'
|
166
|
+
# }
|
167
|
+
# @data = @cxf_user.update_location_template(3, data)
|
168
|
+
def update_location_template(id, data)
|
169
|
+
@client.raw('put', "/ecommerce/location-templates/#{id}", nil, data_transform(data))
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PriceList
|
4
|
+
##
|
5
|
+
# == Price List
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get price lists.
|
9
|
+
# Get a collection of price lists.
|
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_price_lists
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = {
|
19
|
+
# fields: "title"
|
20
|
+
# }
|
21
|
+
# @data = @cxf_user.get_price_lists(options)
|
22
|
+
def get_price_lists(options = nil, use_post = true)
|
23
|
+
get_query_results('/ecommerce/price-list', options, use_post)
|
24
|
+
end
|
25
|
+
|
26
|
+
# === Get price list.
|
27
|
+
# Get a price list info.
|
28
|
+
#
|
29
|
+
# ==== Parameters
|
30
|
+
# id:: (Integer) -- Price list 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_price_list(1)
|
35
|
+
#
|
36
|
+
# ==== Second Example
|
37
|
+
# options = {
|
38
|
+
# fields: 'title'
|
39
|
+
# }
|
40
|
+
# @data = @cxf_user.get_price_list(1, options)
|
41
|
+
def get_price_list(id, options = nil)
|
42
|
+
@client.raw('get', "/ecommerce/price-list/#{id}", options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# === Create price list.
|
46
|
+
# Create a price list with data.
|
47
|
+
#
|
48
|
+
# ==== Parameters
|
49
|
+
# data:: (Hash) -- Data to be submitted.
|
50
|
+
#
|
51
|
+
# ==== Example
|
52
|
+
# data = {
|
53
|
+
# title: 'New Price List'
|
54
|
+
# }
|
55
|
+
# @data = @cxf_user.create_price_list(data)
|
56
|
+
def create_price_list(data)
|
57
|
+
@client.raw('post', '/ecommerce/price-list', nil, data_transform(data))
|
58
|
+
end
|
59
|
+
|
60
|
+
# === Update price list.
|
61
|
+
# Update a price list info.
|
62
|
+
#
|
63
|
+
# ==== Parameters
|
64
|
+
# id:: (Integer) -- Price list id.
|
65
|
+
# data:: (Hash) -- Data to be submitted.
|
66
|
+
#
|
67
|
+
# ==== Example
|
68
|
+
# data = {
|
69
|
+
# title: 'New Price List Modified'
|
70
|
+
# }
|
71
|
+
# @data = @cxf_user.update_price_list(8, data)
|
72
|
+
def update_price_list(id, data)
|
73
|
+
@client.raw('put', "/ecommerce/price-list/#{id}", nil, data_transform(data))
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ProductTemplates
|
4
|
+
##
|
5
|
+
# == Product Templates
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get product templates support data from product.
|
9
|
+
# Get product templates support data from a product.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# id:: (Integer) -- Product id.
|
13
|
+
#
|
14
|
+
# ==== Example
|
15
|
+
# @data = @cxf_user.get_product_templates_support_data_from_product(1)
|
16
|
+
def get_product_templates_support_data_from_product(id)
|
17
|
+
@client.raw('get', "/ecommerce/product-templates/support-data/products/#{id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
# === Get product templates support data from order items group.
|
21
|
+
# Get product templates support data from a order items group.
|
22
|
+
#
|
23
|
+
# ==== Parameters
|
24
|
+
# id:: (Integer) -- Order items group id.
|
25
|
+
#
|
26
|
+
# ==== Example
|
27
|
+
# @data = @cxf_user.get_product_templates_support_data_from_order_items_group(1)
|
28
|
+
def get_product_templates_support_data_from_order_items_group(id)
|
29
|
+
@client.raw('get', "/ecommerce/product-templates/support-data/order-items-groups/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# === Get product templates support data.
|
33
|
+
# Get support data used in product templates.
|
34
|
+
#
|
35
|
+
# ==== Example
|
36
|
+
# @data = @cxf_user.get_product_templates_support_data
|
37
|
+
def get_product_templates_support_data
|
38
|
+
@client.raw('get', '/ecommerce/product-templates/support-data')
|
39
|
+
end
|
40
|
+
|
41
|
+
# === Get product templates.
|
42
|
+
# Get a collection of product templates.
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
46
|
+
#
|
47
|
+
# ==== First Example
|
48
|
+
# @data = @cxf_user.get_product_templates
|
49
|
+
#
|
50
|
+
# ==== Second Example
|
51
|
+
# options = { fields: 'title' }
|
52
|
+
# @data = @cxf_user.get_product_templates(options)
|
53
|
+
def get_product_templates(options = nil)
|
54
|
+
@client.raw('get', '/ecommerce/product-templates', options)
|
55
|
+
end
|
56
|
+
|
57
|
+
# === Get product template.
|
58
|
+
# Get a product template info.
|
59
|
+
#
|
60
|
+
# ==== Parameters
|
61
|
+
# id:: (Integer) -- Product template id.
|
62
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
63
|
+
#
|
64
|
+
# ==== First Example
|
65
|
+
# @data = @cxf_user.get_product_template(1)
|
66
|
+
#
|
67
|
+
# ==== Second Example
|
68
|
+
# options = { fields: 'title' }
|
69
|
+
# @data = @cxf_user.get_product_template(1, options)
|
70
|
+
def get_product_template(id, options = nil)
|
71
|
+
@client.raw('get', "/ecommerce/product-templates/#{id}", options)
|
72
|
+
end
|
73
|
+
|
74
|
+
# === Create product template.
|
75
|
+
# Create a product template with data.
|
76
|
+
#
|
77
|
+
# ==== Parameters
|
78
|
+
# data:: (Hash) -- Data to be submitted.
|
79
|
+
#
|
80
|
+
# ==== Example
|
81
|
+
# data = {
|
82
|
+
# title: 'New Product Template',
|
83
|
+
# slug: 'new-product-template'
|
84
|
+
# }
|
85
|
+
# @data = @cxf_user.create_product_template(data)
|
86
|
+
def create_product_template(data)
|
87
|
+
@client.raw('post', '/ecommerce/product-templates/', nil, data_transform(data))
|
88
|
+
end
|
89
|
+
|
90
|
+
# === Update product template.
|
91
|
+
# Update a product template info.
|
92
|
+
#
|
93
|
+
# ==== Parameters
|
94
|
+
# id:: (Integer) -- Product template id.
|
95
|
+
# data:: (Hash) -- Data to be submitted.
|
96
|
+
#
|
97
|
+
# ==== Example
|
98
|
+
# data = {
|
99
|
+
# title: 'New Product Template Modified',
|
100
|
+
# slug: 'new-product-template'
|
101
|
+
# }
|
102
|
+
# @data = @cxf_user.update_product_template(3, data)
|
103
|
+
def update_product_template(id, data)
|
104
|
+
@client.raw('put', "/ecommerce/product-templates/#{id}", nil, data_transform(data))
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ProductVariations
|
4
|
+
##
|
5
|
+
# == Product Variation
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Generate product variation.
|
9
|
+
# Generate a product variation.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# product_id:: (Integer) -- Product id.
|
13
|
+
# data:: (Hash) -- Data to be submitted.
|
14
|
+
#
|
15
|
+
def generate_product_variation(product_id, data)
|
16
|
+
# TODO: Research use
|
17
|
+
# TODO: Notify line 247 had a '/' before Exception
|
18
|
+
@client.raw('post', "/ecommerce/product-variations/generate/#{product_id}", nil, data_transform(data))
|
19
|
+
end
|
20
|
+
|
21
|
+
# === Set prices to product variations.
|
22
|
+
# Set prices to product variations.
|
23
|
+
#
|
24
|
+
# ==== Parameters
|
25
|
+
# data:: (Hash) -- Data to be submitted.
|
26
|
+
#
|
27
|
+
# ==== Example
|
28
|
+
# skus = [
|
29
|
+
# { id: 100 }
|
30
|
+
# ]
|
31
|
+
# prices = [
|
32
|
+
# { id: 1, value: 1259 },
|
33
|
+
# { id: 2, value: 1260 }
|
34
|
+
# ]
|
35
|
+
# data = {
|
36
|
+
# skus: skus,
|
37
|
+
# prices: prices
|
38
|
+
# }.to_json
|
39
|
+
#
|
40
|
+
# @data = @cxf_user.set_prices_to_product_variations(data)
|
41
|
+
def set_prices_to_product_variations(data)
|
42
|
+
@client.raw('post', '/ecommerce/product-variations/set-prices', nil, data_transform(data))
|
43
|
+
end
|
44
|
+
|
45
|
+
# === Get product from product variation.
|
46
|
+
# Get a product from a product variation.
|
47
|
+
#
|
48
|
+
# ==== Parameters
|
49
|
+
# product_id:: (Integer) -- Product id.
|
50
|
+
#
|
51
|
+
# ==== Example
|
52
|
+
# @data = @cxf_user.get_product_from_product_variation(1)
|
53
|
+
def get_product_from_product_variation(product_id)
|
54
|
+
@client.raw('get', "/ecommerce/product-variations/product/#{product_id}")
|
55
|
+
end
|
56
|
+
|
57
|
+
# === Get product variations.
|
58
|
+
# Get a collection of product variations.
|
59
|
+
#
|
60
|
+
# ==== Parameters
|
61
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
62
|
+
#
|
63
|
+
# ==== Example
|
64
|
+
# @data = @cxf_user.get_product_variations
|
65
|
+
def get_product_variations
|
66
|
+
@client.raw('get', '/ecommerce/product-variations')
|
67
|
+
end
|
68
|
+
|
69
|
+
# === Get product variation.
|
70
|
+
# Get a product variation info.
|
71
|
+
#
|
72
|
+
# ==== Parameters
|
73
|
+
# id:: (Integer) -- Product variation id.
|
74
|
+
#
|
75
|
+
# ==== Example
|
76
|
+
# @data = @cxf_user.get_product_variation(100)
|
77
|
+
def get_product_variation(id)
|
78
|
+
@client.raw('get', "/ecommerce/product-variations/#{id}")
|
79
|
+
end
|
80
|
+
|
81
|
+
# === Create product variation.
|
82
|
+
# Create a product variation with data.
|
83
|
+
#
|
84
|
+
# ==== Parameters
|
85
|
+
# data:: (Hash) -- Data to be submitted.
|
86
|
+
#
|
87
|
+
# ==== Example
|
88
|
+
# data = {
|
89
|
+
# title: 'New Product Variation',
|
90
|
+
# sku: 'NEW-PRODUCT-VARIATION-SKU',
|
91
|
+
# product_id: 5,
|
92
|
+
# supplier: 36,
|
93
|
+
# prices: [
|
94
|
+
# { id: 1, value: 300 }
|
95
|
+
# ]
|
96
|
+
# }
|
97
|
+
# @data = @cxf_user.create_product_variation(data)
|
98
|
+
def create_product_variation(data)
|
99
|
+
@client.raw('post', '/ecommerce/product-variations', nil, data_transform(data))
|
100
|
+
end
|
101
|
+
|
102
|
+
# === Update product variation.
|
103
|
+
# Update a product variation info.
|
104
|
+
#
|
105
|
+
# ==== Parameters
|
106
|
+
# id:: (Integer) -- Product variation id.
|
107
|
+
# data:: (Hash) -- Data to be submitted.
|
108
|
+
#
|
109
|
+
# ==== Example
|
110
|
+
# data = {
|
111
|
+
# title: 'New Product Variation Modified',
|
112
|
+
# cost: 123,
|
113
|
+
# prices: [
|
114
|
+
# { id: 1, value: 400 }
|
115
|
+
# ]
|
116
|
+
# }
|
117
|
+
# @data = @cxf_user.update_product_variation(528, data)
|
118
|
+
def update_product_variation(id, data)
|
119
|
+
@client.raw('put', "/ecommerce/product-variations/#{id}", nil, data_transform(data))
|
120
|
+
end
|
121
|
+
|
122
|
+
# === Delete product variation.
|
123
|
+
# Delete a product variation.
|
124
|
+
#
|
125
|
+
# ==== Parameters
|
126
|
+
# id:: (Integer) -- Product variation id.
|
127
|
+
#
|
128
|
+
# ==== Example
|
129
|
+
# @data = @cxf_user.delete_product_variation(528)
|
130
|
+
def delete_product_variation(id)
|
131
|
+
@client.raw('delete', "/ecommerce/product-variations/#{id}")
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ProductVersions
|
4
|
+
##
|
5
|
+
# === Get Product versions.
|
6
|
+
# Get a collection of product versions.
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# options:: (Hash) -- List of {Resource collection Options}[#class-Cxf::Pub-label-Resource+collections+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
|
+
# @data = @cxf_user.get_product_versions
|
14
|
+
#
|
15
|
+
# ==== Second Example
|
16
|
+
# options = { fields: "title" }
|
17
|
+
# @data = @cxf_user.get_product_versions(options)
|
18
|
+
#
|
19
|
+
# ==== Third Example
|
20
|
+
# options = { fields: "title" }
|
21
|
+
# @data = @cxf_user.get_product_versions(options, false)
|
22
|
+
def get_product_versions(options = nil, use_post = true)
|
23
|
+
get_query_results('/ecommerce/product-versions', options, use_post)
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# === Get Product version.
|
28
|
+
# Get a single product version.
|
29
|
+
#
|
30
|
+
# ==== Parameters
|
31
|
+
# slug:: (String) -- It's the string identifier generated by Cxf.
|
32
|
+
# options:: (Hash) -- List of {Single Resource Options}[#class-Cxf::Pub-label-Single+resource+options] shown above can be used as parameter.
|
33
|
+
#
|
34
|
+
# ==== First Example
|
35
|
+
# @data = @cxf_user.get_product_version("product_slug")
|
36
|
+
#
|
37
|
+
# ==== Second Example
|
38
|
+
# options = {
|
39
|
+
# fields: 'id, slug'
|
40
|
+
# }
|
41
|
+
# @data = @cxf_user.get_product_version("lego-set", options)
|
42
|
+
def get_product_version(slug, options = nil)
|
43
|
+
@client.raw('get', "/ecommerce/product-versions/#{slug}", options)
|
44
|
+
end
|
45
|
+
|
46
|
+
# === Create product version.
|
47
|
+
# Create a product version with data.
|
48
|
+
#
|
49
|
+
# ==== Parameters
|
50
|
+
# data:: (Hash) -- Data to be submitted.
|
51
|
+
#
|
52
|
+
# ==== Example
|
53
|
+
# data = {
|
54
|
+
# title: 'New Product Version',
|
55
|
+
# slug: 'new-product-version',
|
56
|
+
# product_id: 1
|
57
|
+
# }
|
58
|
+
# @data = @cxf_user.create_product_version(data)
|
59
|
+
def create_product_version(data, options = nil)
|
60
|
+
@client.raw('post', '/ecommerce/product-versions', options, data_transform(data))
|
61
|
+
end
|
62
|
+
|
63
|
+
# === Update product version.
|
64
|
+
# Update a product version info.
|
65
|
+
#
|
66
|
+
# ==== Parameters
|
67
|
+
# id:: (Integer) -- Product version id.
|
68
|
+
# data:: (Hash) -- Data to be submitted.
|
69
|
+
#
|
70
|
+
# ==== Example
|
71
|
+
# data = {
|
72
|
+
# title: 'New Product Version Modified',
|
73
|
+
# slug: 'new-product-version',
|
74
|
+
# product_id: 1
|
75
|
+
# }
|
76
|
+
# @data = @cxf_user.update_product_version(9, data)
|
77
|
+
def update_product_version(id, data, options = nil)
|
78
|
+
@client.raw('put', "/ecommerce/product-versions/#{id}", options, data_transform(data))
|
79
|
+
end
|
80
|
+
|
81
|
+
# === Delete product version.
|
82
|
+
# Delete a product version.
|
83
|
+
#
|
84
|
+
# ==== Parameters
|
85
|
+
# id:: (Integer) -- Product version id.
|
86
|
+
#
|
87
|
+
def delete_product_version(id)
|
88
|
+
@client.raw('delete', "/ecommerce/product-versions/#{id}")
|
89
|
+
end
|
90
|
+
|
91
|
+
# === Publish product version.
|
92
|
+
# Publish a product version.
|
93
|
+
#
|
94
|
+
# ==== Parameters
|
95
|
+
# id:: (Integer) -- Product version id.
|
96
|
+
# data:: (Hash) -- Data to be submitted.
|
97
|
+
#
|
98
|
+
# ==== Example
|
99
|
+
# data = {
|
100
|
+
# title: 'New Publish'
|
101
|
+
# }
|
102
|
+
# @data = @cxf_user.publish_product_version(2, data)
|
103
|
+
def publish_product_version(id, data)
|
104
|
+
@client.raw('put', "/ecommerce/product-versions/#{id}/publish", nil, data_transform(data))
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|