cxf 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +11 -11
- data/lib/client.rb +22 -11
- data/lib/contact/content/content.rb +4 -4
- data/lib/contact/ecommerce/ecommerce.rb +4 -4
- data/lib/contact.rb +2 -0
- data/lib/cxf/controllers/concerns/cxf_clients.rb +4 -4
- data/lib/cxf/helpers/contact_auth_helper.rb +16 -15
- data/lib/cxf/helpers/proxy_controllers_methods.rb +20 -8
- data/lib/cxf/helpers/user_auth_helper.rb +13 -14
- data/lib/pub/config/config.rb +6 -6
- data/lib/pub/ecommerce/ecommerce.rb +6 -6
- data/lib/user/config/config.rb +10 -0
- data/lib/user/config/docs.rb +11 -0
- data/lib/user/config/exports.rb +43 -0
- data/lib/user/config/logs.rb +85 -0
- data/lib/user/config/password.rb +7 -0
- data/lib/user/config/relationships.rb +17 -31
- data/lib/user/config/seeds.rb +4 -48
- data/lib/user/config/system_settings.rb +5 -5
- data/lib/user/config/views.rb +24 -0
- data/lib/user/content/assets.rb +27 -221
- data/lib/user/content/bundles.rb +96 -0
- data/lib/user/content/content.rb +6 -0
- data/lib/user/content/instances.rb +37 -0
- data/lib/user/content/message_templates.rb +114 -0
- data/lib/user/content/print_versions.rb +18 -0
- data/lib/user/content/prints.rb +96 -0
- data/lib/user/content/templates.rb +28 -0
- data/lib/user/{crm → customer-data}/companies.rb +6 -6
- data/lib/user/{crm → customer-data}/contacts.rb +43 -18
- data/lib/user/customer-data/customer_data.rb +17 -0
- data/lib/user/customer-data/profiles.rb +93 -0
- data/lib/user/customer-data/segments.rb +93 -0
- data/lib/user/customer-data/workflow_steps.rb +127 -0
- data/lib/user/customer-data/workflows.rb +115 -0
- data/lib/user/ecommerce/ecommerce.rb +6 -22
- data/lib/user/ecommerce/item_codes.rb +89 -0
- data/lib/user/ecommerce/order_templates.rb +89 -0
- data/lib/user/ecommerce/orders.rb +205 -0
- data/lib/user/helpers/helpers.rb +0 -96
- data/lib/user.rb +4 -4
- metadata +18 -19
- data/lib/user/contacts/contacts.rb +0 -22
- data/lib/user/crm/crm.rb +0 -9
- data/lib/user/ecommerce/item_prices.rb +0 -89
- data/lib/user/ecommerce/price_lists.rb +0 -75
- data/lib/user/ecommerce/product_templates.rb +0 -106
- data/lib/user/ecommerce/product_variations.rb +0 -133
- data/lib/user/ecommerce/product_versions.rb +0 -107
- data/lib/user/ecommerce/products.rb +0 -156
- data/lib/user/ecommerce/skus.rb +0 -90
- data/lib/user/ecommerce/taxes.rb +0 -84
- data/lib/user/ecommerce/variant_options.rb +0 -71
- data/lib/user/ecommerce/variant_values.rb +0 -74
- data/lib/user/ecommerce/vouchers.rb +0 -90
- data/lib/user/helpers/object_activities.rb +0 -85
- data/lib/user/helpers/object_folders.rb +0 -84
- data/lib/user/helpers/user_folders.rb +0 -85
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Segments
|
4
|
+
##
|
5
|
+
# == Segments
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get segments.
|
9
|
+
# Get a collection of segments.
|
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_segments
|
17
|
+
#
|
18
|
+
# ==== Second Example
|
19
|
+
# options = { fields: 'id, title', sort: '-id' }
|
20
|
+
# @data = @cxf_user.get_segments(options)
|
21
|
+
#
|
22
|
+
# ==== Third Example
|
23
|
+
# options = { fields: 'id, title', sort: '-id' }
|
24
|
+
# @data = @cxf_user.get_segments(options, false)
|
25
|
+
def get_segments(options = nil, use_post = true)
|
26
|
+
get_query_results('/customer-data/segments', options, use_post)
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Get segment.
|
30
|
+
# Get a segment 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_segment(21)
|
38
|
+
#
|
39
|
+
# ==== Second Example
|
40
|
+
# options = { fields: 'id, title' }
|
41
|
+
# @data = @cxf_user.get_segment(21, options)
|
42
|
+
def get_segment(id, options = nil)
|
43
|
+
@client.raw('get', "/customer-data/segments/#{id}", options)
|
44
|
+
end
|
45
|
+
|
46
|
+
# === Create segment.
|
47
|
+
# Create a segment 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_segment(data)
|
57
|
+
def create_segment(data, options = nil)
|
58
|
+
@client.raw('post', '/customer-data/segments/', options, data_transform(data))
|
59
|
+
end
|
60
|
+
|
61
|
+
# === Update segment.
|
62
|
+
# Update a segment 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_segment(23, data)
|
73
|
+
def update_segment(id, data, options = nil)
|
74
|
+
@client.raw('put', "/customer-data/segments/#{id}", options, data_transform(data))
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# == Segments Bulk Actions
|
79
|
+
#
|
80
|
+
|
81
|
+
# === Delete Segments.
|
82
|
+
# Delete a group of segments.
|
83
|
+
#
|
84
|
+
# ==== Parameters
|
85
|
+
# data:: (Hash) -- Data to be submitted.
|
86
|
+
#
|
87
|
+
# ==== Example
|
88
|
+
# data = { ids: %w[21 22] }
|
89
|
+
# @data = @cxf_user.delete_segments(data)
|
90
|
+
def delete_segments(data)
|
91
|
+
@client.raw('delete', '/customer-data/segments/delete', nil, data_transform(data))
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WorkflowSteps
|
4
|
+
##
|
5
|
+
# == WorkflowsSteps
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get workflows_steps.
|
9
|
+
# Get a collection of workflows_steps.
|
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_workflows_steps
|
17
|
+
#
|
18
|
+
# ==== Second Example
|
19
|
+
# options = { fields: 'id, title', sort: '-id' }
|
20
|
+
# @data = @cxf_user.get_workflows_steps(options)
|
21
|
+
#
|
22
|
+
# ==== Third Example
|
23
|
+
# options = { fields: 'id, title', sort: '-id' }
|
24
|
+
# @data = @cxf_user.get_workflows_steps(options, false)
|
25
|
+
def get_workflow_steps(options = nil, use_post = true)
|
26
|
+
get_query_results('/customer-data/workflows-steps', options, use_post)
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Get workflow_steps.
|
30
|
+
# Get a workflow_steps info.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# id:: (Integer) -- Workflow 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_workflow_steps(21)
|
38
|
+
#
|
39
|
+
# ==== Second Example
|
40
|
+
# options = { fields: 'id, title' }
|
41
|
+
# @data = @cxf_user.get_workflow_steps(21, options)
|
42
|
+
def get_workflow_step(id, options = nil)
|
43
|
+
@client.raw('get', "/customer-data/workflows-steps/#{id}", options)
|
44
|
+
end
|
45
|
+
|
46
|
+
# === Create workflow_steps.
|
47
|
+
# Create a workflow_steps 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_workflow_steps(data)
|
57
|
+
def create_workflow_step(data, options = nil)
|
58
|
+
@client.raw('post', '/customer-data/workflows-steps/', options, data_transform(data))
|
59
|
+
end
|
60
|
+
|
61
|
+
# === Attach workflow_steps.
|
62
|
+
# Attach a workflow_steps.
|
63
|
+
#
|
64
|
+
# ==== Parameters
|
65
|
+
# id:: (Integer) -- Workflow id.
|
66
|
+
# data:: (Hash) -- Data to be submitted.
|
67
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
68
|
+
#
|
69
|
+
# ==== Example
|
70
|
+
# data = {
|
71
|
+
# example_field: 'example_value'
|
72
|
+
# }
|
73
|
+
# @data = @cxf_user.attach_workflow_step(21, data)
|
74
|
+
def attach_workflow_step(id, data, options = nil)
|
75
|
+
@client.raw('put', "/customer-data/workflows-steps/#{id}/attach-item", options, data_transform(data))
|
76
|
+
end
|
77
|
+
|
78
|
+
# === Detach workflow_steps.
|
79
|
+
# Detach a workflow_steps.
|
80
|
+
#
|
81
|
+
# ==== Parameters
|
82
|
+
# id:: (Integer) -- Workflow id.
|
83
|
+
# data:: (Hash) -- Data to be submitted.
|
84
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
85
|
+
#
|
86
|
+
# ==== Example
|
87
|
+
# data = {
|
88
|
+
# example_field: 'example_value'
|
89
|
+
# }
|
90
|
+
# @data = @cxf_user.detach_workflow_step(21, data)
|
91
|
+
def detach_workflow_step(id, data, options = nil)
|
92
|
+
@client.raw('put', "/customer-data/workflows-steps/#{id}/detach-item", options, data_transform(data))
|
93
|
+
end
|
94
|
+
|
95
|
+
# === Update workflow_steps.
|
96
|
+
# Update a workflow_steps info.
|
97
|
+
#
|
98
|
+
# ==== Parameters
|
99
|
+
# id:: (Integer) -- Workflow id.
|
100
|
+
# data:: (Hash) -- Data to be submitted.
|
101
|
+
#
|
102
|
+
# ==== Example
|
103
|
+
# data = {
|
104
|
+
# example_field: 'example_value_modified'
|
105
|
+
# }
|
106
|
+
# @data = @cxf_user.update_workflow_steps(23, data)
|
107
|
+
def update_workflow_step(id, data, options = nil)
|
108
|
+
@client.raw('put', "/customer-data/workflows-steps/#{id}", options, data_transform(data))
|
109
|
+
end
|
110
|
+
|
111
|
+
##
|
112
|
+
# == WorkflowsSteps Bulk Actions
|
113
|
+
#
|
114
|
+
|
115
|
+
# === Delete workflow_steps.
|
116
|
+
# Delete a group of workflows.
|
117
|
+
#
|
118
|
+
# ==== Parameters
|
119
|
+
# data:: (Hash) -- Data to be submitted.
|
120
|
+
#
|
121
|
+
# ==== Example
|
122
|
+
# data = { ids: %w[21 22] }
|
123
|
+
# @data = @cxf_user.delete_workflow_steps(data)
|
124
|
+
def delete_workflow_steps(data)
|
125
|
+
@client.raw('delete', '/customer-data/workflows-steps/delete', nil, data_transform(data))
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Workflows
|
4
|
+
##
|
5
|
+
# == Workflows
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get workflows.
|
9
|
+
# Get a collection of workflows.
|
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_workflows
|
17
|
+
#
|
18
|
+
# ==== Second Example
|
19
|
+
# options = { fields: 'id, title', sort: '-id' }
|
20
|
+
# @data = @cxf_user.get_workflows(options)
|
21
|
+
#
|
22
|
+
# ==== Third Example
|
23
|
+
# options = { fields: 'id, title', sort: '-id' }
|
24
|
+
# @data = @cxf_user.get_workflows(options, false)
|
25
|
+
def get_workflows(options = nil, use_post = true)
|
26
|
+
get_query_results('/customer-data/workflows', options, use_post)
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Get workflow.
|
30
|
+
# Get a workflow info.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# id:: (Integer) -- Workflow 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_workflow(21)
|
38
|
+
#
|
39
|
+
# ==== Second Example
|
40
|
+
# options = { fields: 'id, title' }
|
41
|
+
# @data = @cxf_user.get_workflow(21, options)
|
42
|
+
def get_workflow(id, options = nil)
|
43
|
+
@client.raw('get', "/customer-data/workflows/#{id}", options)
|
44
|
+
end
|
45
|
+
|
46
|
+
# === Create workflow.
|
47
|
+
# Create a workflow 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_workflow(data)
|
57
|
+
def create_workflow(data, options = nil)
|
58
|
+
@client.raw('post', '/customer-data/workflows/', options, data_transform(data))
|
59
|
+
end
|
60
|
+
|
61
|
+
# === Update workflow object steps.
|
62
|
+
# Update a workflow's object steps.
|
63
|
+
#
|
64
|
+
# ==== Parameters
|
65
|
+
# id:: (Integer) -- Workflow id.
|
66
|
+
# data:: (Hash) -- Data to be submitted.
|
67
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
68
|
+
def update_workflow_object_steps(id, data, options = nil)
|
69
|
+
@client.raw('put', "/customer-data/workflows/#{id}/object-step", options, data)
|
70
|
+
end
|
71
|
+
|
72
|
+
# === Check workflow object steps.
|
73
|
+
# Check if object steps are valid.
|
74
|
+
#
|
75
|
+
# ==== Parameters
|
76
|
+
# id:: (Integer) -- Workflow id.
|
77
|
+
# data:: (Hash) -- Data to be submitted.
|
78
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
79
|
+
def check_workflow_object_steps(id, data, options = nil)
|
80
|
+
@client.raw('put', "/customer-data/workflows/#{id}/object-step/check-item", options, data)
|
81
|
+
end
|
82
|
+
|
83
|
+
# === Update workflow.
|
84
|
+
# Update a workflow info.
|
85
|
+
#
|
86
|
+
# ==== Parameters
|
87
|
+
# id:: (Integer) -- Workflow id.
|
88
|
+
# data:: (Hash) -- Data to be submitted.
|
89
|
+
#
|
90
|
+
# ==== Example
|
91
|
+
# data = {
|
92
|
+
# example_field: 'example_value_modified'
|
93
|
+
# }
|
94
|
+
# @data = @cxf_user.update_workflow(23, data)
|
95
|
+
def update_workflow(id, data, options = nil)
|
96
|
+
@client.raw('put', "/customer-data/workflows/#{id}", options, data_transform(data))
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# == Workflows Bulk Actions
|
101
|
+
#
|
102
|
+
|
103
|
+
# === Delete Workflows.
|
104
|
+
# Delete a group of workflows.
|
105
|
+
#
|
106
|
+
# ==== Parameters
|
107
|
+
# data:: (Hash) -- Data to be submitted.
|
108
|
+
#
|
109
|
+
# ==== Example
|
110
|
+
# data = { ids: %w[21 22] }
|
111
|
+
# @data = @cxf_user.delete_workflows(data)
|
112
|
+
def delete_workflows(data)
|
113
|
+
@client.raw('delete', '/customer-data/workflows/delete', nil, data_transform(data))
|
114
|
+
end
|
115
|
+
end
|
@@ -1,27 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
4
|
-
require_relative './
|
5
|
-
require_relative './
|
6
|
-
require_relative './product_variations'
|
7
|
-
require_relative './products'
|
8
|
-
require_relative './product_versions'
|
9
|
-
require_relative './skus'
|
10
|
-
require_relative './taxes'
|
11
|
-
require_relative './variant_options'
|
12
|
-
require_relative './variant_values'
|
13
|
-
require_relative './vouchers'
|
3
|
+
require_relative './item_codes'
|
4
|
+
require_relative './orders'
|
5
|
+
require_relative './order_templates'
|
14
6
|
|
15
7
|
module Ecommerce
|
16
|
-
include
|
17
|
-
include
|
18
|
-
include
|
19
|
-
include ProductVariations
|
20
|
-
include Products
|
21
|
-
include ProductVersions
|
22
|
-
include Skus
|
23
|
-
include Taxes
|
24
|
-
include VariantOptions
|
25
|
-
include VariantValues
|
26
|
-
include Vouchers
|
8
|
+
include ItemCodes
|
9
|
+
include Orders
|
10
|
+
include OrderTemplates
|
27
11
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ItemCodes
|
4
|
+
##
|
5
|
+
# == Item Prices
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get item codes.
|
9
|
+
# Get a collection of item codes.
|
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_item_codes
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = { fields: 'code_cents' }
|
19
|
+
# @data = @cxf_user.get_item_codes(options)
|
20
|
+
def get_item_codes(options = nil)
|
21
|
+
@client.raw('get', '/ecommerce/item-codes', options)
|
22
|
+
end
|
23
|
+
|
24
|
+
# === Get item code.
|
25
|
+
# Get a item code info.
|
26
|
+
#
|
27
|
+
# ==== Parameters
|
28
|
+
# id:: (Integer) -- Item code 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_item_code(1)
|
33
|
+
#
|
34
|
+
# ==== Second Example
|
35
|
+
# options = { fields: 'code_cents' }
|
36
|
+
# @data = @cxf_user.get_item_code(1, options)
|
37
|
+
def get_item_code(id, options = nil)
|
38
|
+
@client.raw('get', "/ecommerce/item-codes/#{id}", options)
|
39
|
+
end
|
40
|
+
|
41
|
+
# === Create item code.
|
42
|
+
# Create a item code with data.
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
# data:: (Hash) -- Data to be submitted.
|
46
|
+
#
|
47
|
+
# ==== Example
|
48
|
+
# data = {
|
49
|
+
# code_list: [
|
50
|
+
# { id: 1 },
|
51
|
+
# { id: 2 }
|
52
|
+
# ],
|
53
|
+
# code_list_id: 1,
|
54
|
+
# title: 'New Item Price'
|
55
|
+
# }
|
56
|
+
# @data = @cxf_user.create_item_code(data)
|
57
|
+
def create_item_code(data)
|
58
|
+
# FIXME: Api send sku_id as null and DB doesnt allow that.
|
59
|
+
@client.raw('post', '/ecommerce/item-codes', nil, data_transform(data))
|
60
|
+
end
|
61
|
+
|
62
|
+
# === Update item code.
|
63
|
+
# Update a item code info.
|
64
|
+
#
|
65
|
+
# ==== Parameters
|
66
|
+
# id:: (Integer) -- Order item code id.
|
67
|
+
# data:: (Hash) -- Data to be submitted.
|
68
|
+
#
|
69
|
+
# ==== Example
|
70
|
+
# data = {
|
71
|
+
# code: 12345
|
72
|
+
# }
|
73
|
+
# @data = @cxf_user.update_item_code(1, data)
|
74
|
+
def update_item_code(id, data)
|
75
|
+
@client.raw('put', "/ecommerce/item-codes/#{id}", nil, data_transform(data))
|
76
|
+
end
|
77
|
+
|
78
|
+
# === Delete item code.
|
79
|
+
# Delete a item code.
|
80
|
+
#
|
81
|
+
# ==== Parameters
|
82
|
+
# id:: (Integer) -- Item code id.
|
83
|
+
#
|
84
|
+
# ==== Example
|
85
|
+
# @data = @cxf_user.delete_item_code(803)
|
86
|
+
def delete_item_code(id)
|
87
|
+
@client.raw('delete', "/ecommerce/item-codes/#{id}")
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OrderTemplates
|
4
|
+
##
|
5
|
+
# == Item Prices
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get item codes.
|
9
|
+
# Get a collection of item codes.
|
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_order_templates
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = { fields: 'code_cents' }
|
19
|
+
# @data = @cxf_user.get_order_templates(options)
|
20
|
+
def get_order_templates(options = nil)
|
21
|
+
@client.raw('get', '/ecommerce/order-templates', options)
|
22
|
+
end
|
23
|
+
|
24
|
+
# === Get item code.
|
25
|
+
# Get a item code info.
|
26
|
+
#
|
27
|
+
# ==== Parameters
|
28
|
+
# id:: (Integer) -- Item code 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_order_template(1)
|
33
|
+
#
|
34
|
+
# ==== Second Example
|
35
|
+
# options = { fields: 'code_cents' }
|
36
|
+
# @data = @cxf_user.get_order_template(1, options)
|
37
|
+
def get_order_template(id, options = nil)
|
38
|
+
@client.raw('get', "/ecommerce/order-templates/#{id}", options)
|
39
|
+
end
|
40
|
+
|
41
|
+
# === Create item code.
|
42
|
+
# Create a item code with data.
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
# data:: (Hash) -- Data to be submitted.
|
46
|
+
#
|
47
|
+
# ==== Example
|
48
|
+
# data = {
|
49
|
+
# code_list: [
|
50
|
+
# { id: 1 },
|
51
|
+
# { id: 2 }
|
52
|
+
# ],
|
53
|
+
# code_list_id: 1,
|
54
|
+
# title: 'New Item Price'
|
55
|
+
# }
|
56
|
+
# @data = @cxf_user.create_order_template(data)
|
57
|
+
def create_order_template(data)
|
58
|
+
# FIXME: Api send sku_id as null and DB doesnt allow that.
|
59
|
+
@client.raw('post', '/ecommerce/order-templates', nil, data_transform(data))
|
60
|
+
end
|
61
|
+
|
62
|
+
# === Update item code.
|
63
|
+
# Update a item code info.
|
64
|
+
#
|
65
|
+
# ==== Parameters
|
66
|
+
# id:: (Integer) -- Order item code id.
|
67
|
+
# data:: (Hash) -- Data to be submitted.
|
68
|
+
#
|
69
|
+
# ==== Example
|
70
|
+
# data = {
|
71
|
+
# code: 12345
|
72
|
+
# }
|
73
|
+
# @data = @cxf_user.update_order_template(1, data)
|
74
|
+
def update_order_template(id, data)
|
75
|
+
@client.raw('put', "/ecommerce/order-templates/#{id}", nil, data_transform(data))
|
76
|
+
end
|
77
|
+
|
78
|
+
# === Delete item code.
|
79
|
+
# Delete a item code.
|
80
|
+
#
|
81
|
+
# ==== Parameters
|
82
|
+
# id:: (Integer) -- Item code id.
|
83
|
+
#
|
84
|
+
# ==== Example
|
85
|
+
# @data = @cxf_user.delete_order_template(803)
|
86
|
+
def delete_order_template(id)
|
87
|
+
@client.raw('delete', "/ecommerce/order-templates/#{id}")
|
88
|
+
end
|
89
|
+
end
|