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,205 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Orders
|
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_orders
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = { fields: 'code_cents' }
|
19
|
+
# @data = @cxf_user.get_orders(options)
|
20
|
+
def get_orders(options = nil)
|
21
|
+
@client.raw('get', '/ecommerce/orders', 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(1)
|
33
|
+
#
|
34
|
+
# ==== Second Example
|
35
|
+
# options = { fields: 'code_cents' }
|
36
|
+
# @data = @cxf_user.get_order(1, options)
|
37
|
+
def get_order(id, options = nil)
|
38
|
+
@client.raw('get', "/ecommerce/orders/#{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(data)
|
57
|
+
def create_order(data)
|
58
|
+
# FIXME: Api send sku_id as null and DB doesnt allow that.
|
59
|
+
@client.raw('post', '/ecommerce/orders', 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(1, data)
|
74
|
+
def update_order(id, data)
|
75
|
+
@client.raw('put', "/ecommerce/orders/#{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(803)
|
86
|
+
def delete_order(id)
|
87
|
+
@client.raw('delete', "/ecommerce/orders/#{id}")
|
88
|
+
end
|
89
|
+
|
90
|
+
# === Add order line item.
|
91
|
+
# Add a line item to an order.
|
92
|
+
#
|
93
|
+
# ==== Parameters
|
94
|
+
# order_id:: (Integer) -- Order id.
|
95
|
+
# data:: (Hash) -- Data to be submitted.
|
96
|
+
#
|
97
|
+
# ==== Example
|
98
|
+
# data = {
|
99
|
+
# product_id: 1,
|
100
|
+
# price: 10.99,
|
101
|
+
# quantity: 2
|
102
|
+
# }
|
103
|
+
# @data = @cxf_user.add_order_line_item(1, data)
|
104
|
+
def add_order_line_item(order_id, data)
|
105
|
+
@client.raw('post', "/ecommerce/orders/#{order_id}/line-item", nil, data_transform(data))
|
106
|
+
end
|
107
|
+
|
108
|
+
# === Delete order line item.
|
109
|
+
# Delete a line item from an order.
|
110
|
+
#
|
111
|
+
# ==== Parameters
|
112
|
+
# order_id:: (Integer) -- Order id.
|
113
|
+
#
|
114
|
+
# ==== Example
|
115
|
+
# @data = @cxf_user.delete_order_line_item(1)
|
116
|
+
def delete_order_line_item(order_id)
|
117
|
+
@client.raw('delete', "/ecommerce/orders/#{order_id}/line-item")
|
118
|
+
end
|
119
|
+
|
120
|
+
# === Update order line item.
|
121
|
+
# Update a specific line item within an order.
|
122
|
+
#
|
123
|
+
# ==== Parameters
|
124
|
+
# order_id:: (Integer) -- Order id.
|
125
|
+
# data:: (Hash) -- Data to be submitted.
|
126
|
+
#
|
127
|
+
# ==== Example
|
128
|
+
# data = {
|
129
|
+
# item_id: 123,
|
130
|
+
# quantity: 2,
|
131
|
+
# price: 1000
|
132
|
+
# }
|
133
|
+
# @data = @cxf_user.update_order_line_item(1, data)
|
134
|
+
def update_order_line_item(order_id, data)
|
135
|
+
@client.raw('put', "/ecommerce/orders/#{order_id}/line-item", nil, data_transform(data))
|
136
|
+
end
|
137
|
+
|
138
|
+
# === Update order unit line item.
|
139
|
+
# Update a specific unit line item within an order.
|
140
|
+
#
|
141
|
+
# ==== Parameters
|
142
|
+
# order_id:: (Integer) -- Order id.
|
143
|
+
# data:: (Hash) -- Data to be submitted.
|
144
|
+
#
|
145
|
+
# ==== Example
|
146
|
+
# data = {
|
147
|
+
# unit_id: 3,
|
148
|
+
# quantity: 5
|
149
|
+
# }
|
150
|
+
# @data = @cxf_user.update_order_unit_line_item(1, data)
|
151
|
+
def update_order_unit_line_item(order_id, data)
|
152
|
+
@client.raw('put', "/ecommerce/orders/#{order_id}/unit-line-item", nil, data_transform(data))
|
153
|
+
end
|
154
|
+
|
155
|
+
# === Reorder order line items.
|
156
|
+
# Reorder order line items.
|
157
|
+
#
|
158
|
+
# ==== Parameters
|
159
|
+
# order_id:: (Integer) -- Order id.
|
160
|
+
# data:: (Hash) -- Data to be submitted.
|
161
|
+
#
|
162
|
+
# ==== Example
|
163
|
+
# data = {
|
164
|
+
# line_items: [
|
165
|
+
# { id: 1, position: 1 },
|
166
|
+
# { id: 2, position: 2 }
|
167
|
+
# ]
|
168
|
+
# }
|
169
|
+
# @data = @cxf_user.reorder_order_line_item(1, data)
|
170
|
+
def reorder_order_line_item(order_id, data)
|
171
|
+
@client.raw('put', "/ecommerce/orders/#{order_id}/reorder-line-items", nil, data_transform(data))
|
172
|
+
end
|
173
|
+
|
174
|
+
# === Change order status.
|
175
|
+
# Change order status.
|
176
|
+
#
|
177
|
+
# ==== Parameters
|
178
|
+
# order_id:: (Integer) -- Order id.
|
179
|
+
# data:: (Hash) -- Data to be submitted.
|
180
|
+
#
|
181
|
+
# ==== Example
|
182
|
+
# data = {
|
183
|
+
# order_status_id: 2
|
184
|
+
# }
|
185
|
+
# @data = @cxf_user.change_order_status(1, data)
|
186
|
+
def change_order_status(order_id, data)
|
187
|
+
@client.raw('put', "/ecommerce/orders/#{order_id}/status", nil, data_transform(data))
|
188
|
+
end
|
189
|
+
|
190
|
+
# === Create child order.
|
191
|
+
# Create a child order from a parent order.
|
192
|
+
#
|
193
|
+
# ==== Parameters
|
194
|
+
# order_id:: (Integer) -- Parent order id.
|
195
|
+
# data:: (Hash) -- Data to be submitted.
|
196
|
+
#
|
197
|
+
# ==== Example
|
198
|
+
# data = {
|
199
|
+
# order_status_id: 2
|
200
|
+
# }
|
201
|
+
# @data = @cxf_user.create_child_order(1, data)
|
202
|
+
def create_child_order(order_id, data)
|
203
|
+
@client.raw('post', "/ecommerce/orders/#{order_id}/child-order", nil, data_transform(data))
|
204
|
+
end
|
205
|
+
end
|
data/lib/user/helpers/helpers.rb
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './object_activities'
|
4
|
-
require_relative './object_folders'
|
5
|
-
require_relative './user_folders'
|
6
|
-
|
7
3
|
module Helpers
|
8
|
-
include ObjectActivities
|
9
|
-
include ObjectFolders
|
10
|
-
include UserFolders
|
11
4
|
|
12
5
|
##
|
13
6
|
# == Helpers
|
@@ -22,95 +15,6 @@ module Helpers
|
|
22
15
|
# ==== Example
|
23
16
|
#
|
24
17
|
def slugify(data)
|
25
|
-
# TODO: Research use of variable polymorphicObjectType
|
26
18
|
@client.raw('post', '/helpers/slugify', nil, data_transform(data))
|
27
19
|
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
20
|
end
|
data/lib/user.rb
CHANGED
@@ -3,14 +3,13 @@
|
|
3
3
|
require_relative './client'
|
4
4
|
require_relative './cxf/helpers/cxf_helper'
|
5
5
|
require_relative './cxf/helpers/threads_helper'
|
6
|
-
require_relative './user/
|
6
|
+
require_relative './user/customer-data/customer_data'
|
7
7
|
require_relative './user/content/content'
|
8
8
|
require_relative './user/marketing/marketing'
|
9
9
|
require_relative './user/ecommerce/ecommerce'
|
10
10
|
require_relative './user/config/config'
|
11
11
|
require_relative './user/profile/profile'
|
12
12
|
require_relative './user/helpers/helpers'
|
13
|
-
require_relative './user/contacts/contacts'
|
14
13
|
|
15
14
|
module Cxf
|
16
15
|
##
|
@@ -38,7 +37,7 @@ module Cxf
|
|
38
37
|
# * +sort+ - [String] indicates the columns that will be selected
|
39
38
|
|
40
39
|
class User
|
41
|
-
include
|
40
|
+
include CustomerData
|
42
41
|
include Content
|
43
42
|
include Marketing
|
44
43
|
include Ecommerce
|
@@ -70,7 +69,8 @@ module Cxf
|
|
70
69
|
def login(email, password)
|
71
70
|
data = { email: email, password: password }
|
72
71
|
response = @client.raw('post', '/users/login', nil, data.to_json, '/api/v1', { no_content_type: true })
|
73
|
-
|
72
|
+
|
73
|
+
return response unless response.is_a? Hash
|
74
74
|
if response.key? 'data' and response['data'].key? 'access_token'
|
75
75
|
@client.session_token = response['data']['access_token']
|
76
76
|
@client.refresh_token = response['data']['refresh_token']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cxf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo, Fabian Garcia, Luis Hesiquio
|
@@ -164,6 +164,10 @@ files:
|
|
164
164
|
- lib/user/config/attributes.rb
|
165
165
|
- lib/user/config/calendars.rb
|
166
166
|
- lib/user/config/config.rb
|
167
|
+
- lib/user/config/docs.rb
|
168
|
+
- lib/user/config/exports.rb
|
169
|
+
- lib/user/config/logs.rb
|
170
|
+
- lib/user/config/password.rb
|
167
171
|
- lib/user/config/relationships.rb
|
168
172
|
- lib/user/config/seeds.rb
|
169
173
|
- lib/user/config/system_settings.rb
|
@@ -171,35 +175,30 @@ files:
|
|
171
175
|
- lib/user/config/taxonomies.rb
|
172
176
|
- lib/user/config/users.rb
|
173
177
|
- lib/user/config/views.rb
|
174
|
-
- lib/user/contacts/contacts.rb
|
175
178
|
- lib/user/content/assets.rb
|
176
179
|
- lib/user/content/block_templates.rb
|
177
180
|
- lib/user/content/blocks.rb
|
181
|
+
- lib/user/content/bundles.rb
|
178
182
|
- lib/user/content/content.rb
|
179
183
|
- lib/user/content/content_bundles.rb
|
180
184
|
- lib/user/content/content_prints.rb
|
181
185
|
- lib/user/content/instances.rb
|
186
|
+
- lib/user/content/message_templates.rb
|
182
187
|
- lib/user/content/print_versions.rb
|
188
|
+
- lib/user/content/prints.rb
|
183
189
|
- lib/user/content/templates.rb
|
184
|
-
- lib/user/
|
185
|
-
- lib/user/
|
186
|
-
- lib/user/
|
190
|
+
- lib/user/customer-data/companies.rb
|
191
|
+
- lib/user/customer-data/contacts.rb
|
192
|
+
- lib/user/customer-data/customer_data.rb
|
193
|
+
- lib/user/customer-data/profiles.rb
|
194
|
+
- lib/user/customer-data/segments.rb
|
195
|
+
- lib/user/customer-data/workflow_steps.rb
|
196
|
+
- lib/user/customer-data/workflows.rb
|
187
197
|
- lib/user/ecommerce/ecommerce.rb
|
188
|
-
- lib/user/ecommerce/
|
189
|
-
- lib/user/ecommerce/
|
190
|
-
- lib/user/ecommerce/
|
191
|
-
- lib/user/ecommerce/product_variations.rb
|
192
|
-
- lib/user/ecommerce/product_versions.rb
|
193
|
-
- lib/user/ecommerce/products.rb
|
194
|
-
- lib/user/ecommerce/skus.rb
|
195
|
-
- lib/user/ecommerce/taxes.rb
|
196
|
-
- lib/user/ecommerce/variant_options.rb
|
197
|
-
- lib/user/ecommerce/variant_values.rb
|
198
|
-
- lib/user/ecommerce/vouchers.rb
|
198
|
+
- lib/user/ecommerce/item_codes.rb
|
199
|
+
- lib/user/ecommerce/order_templates.rb
|
200
|
+
- lib/user/ecommerce/orders.rb
|
199
201
|
- lib/user/helpers/helpers.rb
|
200
|
-
- lib/user/helpers/object_activities.rb
|
201
|
-
- lib/user/helpers/object_folders.rb
|
202
|
-
- lib/user/helpers/user_folders.rb
|
203
202
|
- lib/user/marketing/marketing.rb
|
204
203
|
- lib/user/profile/profile.rb
|
205
204
|
homepage: https://github.com/rubengomez/cxf-ruby-sdk
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Contacts
|
4
|
-
##
|
5
|
-
# == Contact Auth
|
6
|
-
#
|
7
|
-
# === Change password no auth.
|
8
|
-
# Change password to an email without auth.
|
9
|
-
#
|
10
|
-
# ==== Parameters
|
11
|
-
# data:: (Hash) -- Data to be submitted.
|
12
|
-
#
|
13
|
-
# ==== Example
|
14
|
-
# data = {
|
15
|
-
# password: '12345678',
|
16
|
-
# email: 'email@example.com'
|
17
|
-
# }
|
18
|
-
# @data = @cxf_user.change_password_no_auth(data)
|
19
|
-
def change_password_no_auth(data)
|
20
|
-
@client.raw('post', '/contacts/change-password-no-auth', nil, data_transform(data))
|
21
|
-
end
|
22
|
-
end
|
data/lib/user/crm/crm.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ItemPrices
|
4
|
-
##
|
5
|
-
# == Item Prices
|
6
|
-
#
|
7
|
-
|
8
|
-
# === Get item prices.
|
9
|
-
# Get a collection of item prices.
|
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_prices
|
16
|
-
#
|
17
|
-
# ==== Second Example
|
18
|
-
# options = { fields: 'price_cents' }
|
19
|
-
# @data = @cxf_user.get_item_prices(options)
|
20
|
-
def get_item_prices(options = nil)
|
21
|
-
@client.raw('get', '/ecommerce/item-prices', options)
|
22
|
-
end
|
23
|
-
|
24
|
-
# === Get item price.
|
25
|
-
# Get a item price info.
|
26
|
-
#
|
27
|
-
# ==== Parameters
|
28
|
-
# id:: (Integer) -- Item price 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_price(1)
|
33
|
-
#
|
34
|
-
# ==== Second Example
|
35
|
-
# options = { fields: 'price_cents' }
|
36
|
-
# @data = @cxf_user.get_item_price(1, options)
|
37
|
-
def get_item_price(id, options = nil)
|
38
|
-
@client.raw('get', "/ecommerce/item-prices/#{id}", options)
|
39
|
-
end
|
40
|
-
|
41
|
-
# === Create item price.
|
42
|
-
# Create a item price with data.
|
43
|
-
#
|
44
|
-
# ==== Parameters
|
45
|
-
# data:: (Hash) -- Data to be submitted.
|
46
|
-
#
|
47
|
-
# ==== Example
|
48
|
-
# data = {
|
49
|
-
# price_list: [
|
50
|
-
# { id: 1 },
|
51
|
-
# { id: 2 }
|
52
|
-
# ],
|
53
|
-
# price_list_id: 1,
|
54
|
-
# title: 'New Item Price'
|
55
|
-
# }
|
56
|
-
# @data = @cxf_user.create_item_price(data)
|
57
|
-
def create_item_price(data)
|
58
|
-
# FIXME: Api send sku_id as null and DB doesnt allow that.
|
59
|
-
@client.raw('post', '/ecommerce/item-prices', nil, data_transform(data))
|
60
|
-
end
|
61
|
-
|
62
|
-
# === Update item price.
|
63
|
-
# Update a item price info.
|
64
|
-
#
|
65
|
-
# ==== Parameters
|
66
|
-
# id:: (Integer) -- Order item price id.
|
67
|
-
# data:: (Hash) -- Data to be submitted.
|
68
|
-
#
|
69
|
-
# ==== Example
|
70
|
-
# data = {
|
71
|
-
# price: 12345
|
72
|
-
# }
|
73
|
-
# @data = @cxf_user.update_item_price(1, data)
|
74
|
-
def update_item_price(id, data)
|
75
|
-
@client.raw('put', "/ecommerce/item-prices/#{id}", nil, data_transform(data))
|
76
|
-
end
|
77
|
-
|
78
|
-
# === Delete item price.
|
79
|
-
# Delete a item price.
|
80
|
-
#
|
81
|
-
# ==== Parameters
|
82
|
-
# id:: (Integer) -- Item price id.
|
83
|
-
#
|
84
|
-
# ==== Example
|
85
|
-
# @data = @cxf_user.delete_item_price(803)
|
86
|
-
def delete_item_price(id)
|
87
|
-
@client.raw('delete', "/ecommerce/item-prices/#{id}")
|
88
|
-
end
|
89
|
-
end
|
@@ -1,75 +0,0 @@
|
|
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
|