mints 0.0.28 → 0.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/client.rb +287 -385
- data/lib/contact/config/appointments.rb +201 -0
- data/lib/contact/config/config.rb +7 -0
- data/lib/contact/content/content.rb +7 -0
- data/lib/contact/content/conversations.rb +121 -0
- data/lib/contact/ecommerce/ecommerce.rb +12 -0
- data/lib/contact/ecommerce/order_items.rb +19 -0
- data/lib/contact/ecommerce/order_items_groups.rb +95 -0
- data/lib/contact/ecommerce/orders.rb +133 -0
- data/lib/contact.rb +54 -603
- data/lib/errors.rb +3 -1
- data/lib/generators/mints_assets_controller.rb +4 -1
- data/lib/generators/mints_contact_controller.rb +4 -1
- data/lib/generators/mints_files_generator.rb +16 -13
- data/lib/generators/mints_link.rb +7 -4
- data/lib/generators/mints_public_controller.rb +4 -1
- data/lib/generators/mints_user_controller.rb +3 -0
- data/lib/generators/short_link_controller.rb +4 -1
- data/lib/mints/controllers/admin_base_controller.rb +5 -3
- data/lib/mints/controllers/base_api_controller.rb +6 -4
- data/lib/mints/controllers/base_controller.rb +5 -3
- data/lib/mints/controllers/concerns/mints_clients.rb +4 -2
- data/lib/mints/controllers/concerns/read_config_file.rb +3 -1
- data/lib/mints/controllers/contact_api_controller.rb +12 -10
- data/lib/mints/controllers/public_api_controller.rb +10 -8
- data/lib/mints/controllers/user_api_controller.rb +11 -9
- data/lib/mints/helpers/contact_auth_helper.rb +3 -1
- data/lib/mints/helpers/mints_helper.rb +39 -38
- data/lib/mints/helpers/proxy_controllers_methods.rb +24 -24
- data/lib/mints/helpers/user_auth_helper.rb +5 -3
- data/lib/mints.rb +12 -10
- data/lib/pub.rb +35 -53
- data/lib/user/config/api_keys.rb +63 -61
- data/lib/user/config/appointments.rb +217 -215
- data/lib/user/config/attribute_groups.rb +74 -72
- data/lib/user/config/attributes.rb +83 -81
- data/lib/user/config/calendars.rb +88 -86
- data/lib/user/config/config.rb +31 -63
- data/lib/user/config/public_folders.rb +105 -104
- data/lib/user/config/relationships.rb +135 -132
- data/lib/user/config/roles.rb +76 -79
- data/lib/user/config/seeds.rb +52 -51
- data/lib/user/config/system_settings.rb +50 -49
- data/lib/user/config/tags.rb +57 -59
- data/lib/user/config/taxonomies.rb +115 -119
- data/lib/user/config/teams.rb +2 -0
- data/lib/user/config/users.rb +2 -0
- data/lib/user/contacts/contacts.rb +2 -0
- data/lib/user/content/assets.rb +3 -3
- data/lib/user/content/content.rb +224 -223
- data/lib/user/content/content_instances.rb +4 -2
- data/lib/user/content/content_templates.rb +2 -0
- data/lib/user/content/conversations.rb +2 -0
- data/lib/user/content/dam.rb +2 -0
- data/lib/user/content/forms.rb +2 -0
- data/lib/user/content/message_templates.rb +2 -0
- data/lib/user/content/messages.rb +2 -0
- data/lib/user/content/pages.rb +4 -2
- data/lib/user/content/stories.rb +3 -3
- data/lib/user/content/story_templates.rb +5 -3
- data/lib/user/content/story_versions.rb +2 -0
- data/lib/user/crm/companies.rb +3 -1
- data/lib/user/crm/contacts.rb +2 -0
- data/lib/user/crm/crm.rb +2 -0
- data/lib/user/crm/deals.rb +2 -0
- data/lib/user/crm/favorites.rb +2 -0
- data/lib/user/crm/segments.rb +2 -0
- data/lib/user/crm/users.rb +2 -0
- data/lib/user/crm/workflow_step_objects.rb +2 -0
- data/lib/user/crm/workflow_steps.rb +2 -0
- data/lib/user/crm/workflows.rb +2 -0
- data/lib/user/ecommerce/ecommerce.rb +2 -0
- data/lib/user/ecommerce/item_prices.rb +2 -0
- data/lib/user/ecommerce/locations.rb +2 -0
- data/lib/user/ecommerce/order_items_groups.rb +5 -2
- data/lib/user/ecommerce/order_statuses.rb +2 -0
- data/lib/user/ecommerce/orders.rb +4 -1
- data/lib/user/ecommerce/price_lists.rb +2 -0
- data/lib/user/ecommerce/product_templates.rb +3 -1
- data/lib/user/ecommerce/product_variations.rb +2 -0
- data/lib/user/ecommerce/products.rb +3 -1
- data/lib/user/ecommerce/skus.rb +2 -0
- data/lib/user/ecommerce/taxes.rb +2 -0
- data/lib/user/ecommerce/variant_options.rb +2 -0
- data/lib/user/ecommerce/variant_values.rb +2 -0
- data/lib/user/helpers/helpers.rb +2 -0
- data/lib/user/helpers/object_activities.rb +2 -0
- data/lib/user/helpers/object_folders.rb +2 -0
- data/lib/user/helpers/user_folders.rb +2 -0
- data/lib/user/marketing/marketing.rb +2 -0
- data/lib/user/profile/profile.rb +2 -0
- data/lib/user.rb +32 -41
- metadata +23 -16
- data/lib/user/config/importers.rb +0 -184
@@ -0,0 +1,201 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appointments
|
4
|
+
# Appointments
|
5
|
+
|
6
|
+
##
|
7
|
+
# === Get Appointments.
|
8
|
+
# Get a collection of appointments.
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
12
|
+
#
|
13
|
+
# ==== First Example
|
14
|
+
# @data = @mints_contact.get_appointments
|
15
|
+
#
|
16
|
+
# ==== Second Example
|
17
|
+
# options = {
|
18
|
+
# fields: 'id, created_at'
|
19
|
+
# }
|
20
|
+
# @data = @mints_contact.get_appointments(options)
|
21
|
+
def get_appointments(options = nil)
|
22
|
+
@client.raw('get', '/contacts/appointments', options)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# === Get Appointment.
|
27
|
+
# Get an appointment info.
|
28
|
+
#
|
29
|
+
# ==== Parameters
|
30
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
31
|
+
#
|
32
|
+
# ==== First Example
|
33
|
+
# @data = @mints_contact.get_appointment(1)
|
34
|
+
#
|
35
|
+
# ==== Second Example
|
36
|
+
# options = {
|
37
|
+
# fields: 'id, created_at'
|
38
|
+
# }
|
39
|
+
# @data = @mints_contact.get_appointment(1, options)
|
40
|
+
def get_appointment(id, options = nil)
|
41
|
+
@client.raw('get', "/contacts/appointments/#{id}", options)
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# === Create Appointment.
|
46
|
+
# Create an appointment with data.
|
47
|
+
#
|
48
|
+
# ==== Parameters
|
49
|
+
# data:: (Hash) -- Data to be submitted.
|
50
|
+
#
|
51
|
+
# ==== Example
|
52
|
+
# data = {
|
53
|
+
# object_model: 'products',
|
54
|
+
# object_id: 1,
|
55
|
+
# title: 'New Appointment',
|
56
|
+
# start: '2021-11-25T14:15:00+00:00',
|
57
|
+
# end: '2022-01-01T13:00:00+00:00'
|
58
|
+
# }
|
59
|
+
# @data = @mints_contact.create_appointment(data)
|
60
|
+
def create_appointment(data)
|
61
|
+
@client.raw('post', '/contacts/appointments', nil, data_transform(data))
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# === Update Appointment.
|
66
|
+
# Update an appointment info.
|
67
|
+
#
|
68
|
+
# ==== Parameters
|
69
|
+
# id:: (Integer) -- Appointment id.
|
70
|
+
# data:: (Hash) -- Data to be submitted.
|
71
|
+
#
|
72
|
+
# ==== Example
|
73
|
+
# data = {
|
74
|
+
# object_id: 2
|
75
|
+
# }
|
76
|
+
# @data = @mints_contact.update_appointment(1, data)
|
77
|
+
def update_appointment(id, data)
|
78
|
+
@client.raw('put', "/contacts/appointments/#{id}", nil, data_transform(data))
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# === Scheduled Appointments.
|
83
|
+
# Get a collection of appointments filtering by object_type, object_id and dates range.
|
84
|
+
#
|
85
|
+
# ==== Parameters
|
86
|
+
# data:: (Hash) -- Data to be submitted.
|
87
|
+
#
|
88
|
+
# ==== Example
|
89
|
+
# data = {
|
90
|
+
# object_model: 'products',
|
91
|
+
# object_id: 2,
|
92
|
+
# start: '2021-11-25T14:15:00+00:00',
|
93
|
+
# end: '2022-01-01T13:00:00+00:00'
|
94
|
+
# }
|
95
|
+
# @data = @mints_contact.scheduled_appointments(data)
|
96
|
+
def scheduled_appointments(data)
|
97
|
+
@client.raw('post', '/contacts/appointments/scheduled-appointments', nil, data_transform(data))
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# === Attach Invitee.
|
102
|
+
# Attach invitee to an appointment.
|
103
|
+
#
|
104
|
+
# ==== Parameters
|
105
|
+
# data:: (Hash) -- Data to be submitted.
|
106
|
+
#
|
107
|
+
# ==== Example
|
108
|
+
# data = {
|
109
|
+
# appointment_id: 1,
|
110
|
+
# invitee_ids: 1
|
111
|
+
# }
|
112
|
+
# @data = @mints_contact.attach_invitee(data)
|
113
|
+
def attach_invitee(data)
|
114
|
+
@client.raw('post', '/contacts/appointments/attach-invitee', nil, data_transform(data))
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# === Attach Follower.
|
119
|
+
# Attach follower to an appointment.
|
120
|
+
#
|
121
|
+
# ==== Parameters
|
122
|
+
# data:: (Hash) -- Data to be submitted.
|
123
|
+
#
|
124
|
+
# ==== Example
|
125
|
+
# data = {
|
126
|
+
# appointment_id: 1,
|
127
|
+
# follower_ids: 1
|
128
|
+
# }
|
129
|
+
# @data = @mints_contact.attach_follower(data)
|
130
|
+
def attach_follower(data)
|
131
|
+
@client.raw('post', '/contacts/appointments/attach-follower', nil, data_transform(data))
|
132
|
+
end
|
133
|
+
|
134
|
+
##
|
135
|
+
# === Detach Invitee.
|
136
|
+
# Detach invitee from an appointment.
|
137
|
+
#
|
138
|
+
# ==== Parameters
|
139
|
+
# data:: (Hash) -- Data to be submitted.
|
140
|
+
#
|
141
|
+
# ==== Example
|
142
|
+
# data = {
|
143
|
+
# appointment_id: 1,
|
144
|
+
# invitee_ids: 1
|
145
|
+
# }
|
146
|
+
# @data = @mints_contact.detach_invitee(data)
|
147
|
+
def detach_invitee(data)
|
148
|
+
@client.raw('post', '/contacts/appointments/detach-invitee', nil, data_transform(data))
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# === Detach Follower.
|
153
|
+
# Detach follower from an appointment.
|
154
|
+
#
|
155
|
+
# ==== Parameters
|
156
|
+
# data:: (Hash) -- Data to be submitted.
|
157
|
+
#
|
158
|
+
# ==== Example
|
159
|
+
# data = {
|
160
|
+
# appointment_id: 1,
|
161
|
+
# follower_ids: 1
|
162
|
+
# }
|
163
|
+
# @data = @mints_contact.detach_follower(data)
|
164
|
+
def detach_follower(data)
|
165
|
+
@client.raw('post', '/contacts/appointments/detach-follower', nil, data_transform(data))
|
166
|
+
end
|
167
|
+
|
168
|
+
##
|
169
|
+
# === Sync Invitee.
|
170
|
+
# Sync an invitee from an appointment.
|
171
|
+
#
|
172
|
+
# ==== Parameters
|
173
|
+
# data:: (Hash) -- Data to be submitted.
|
174
|
+
#
|
175
|
+
# ==== Example
|
176
|
+
# data = {
|
177
|
+
# appointment_id: 1,
|
178
|
+
# invitee_ids: 1
|
179
|
+
# }
|
180
|
+
# @data = @mints_contact.sync_invitee(data)
|
181
|
+
def sync_invitee(data)
|
182
|
+
@client.raw('post', '/contacts/appointments/sync-invitee', nil, data_transform(data))
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# === Sync Follower.
|
187
|
+
# Sync a follower from an appointment.
|
188
|
+
#
|
189
|
+
# ==== Parameters
|
190
|
+
# data:: (Hash) -- Data to be submitted.
|
191
|
+
#
|
192
|
+
# ==== Example
|
193
|
+
# data = {
|
194
|
+
# appointment_id: 1,
|
195
|
+
# follower_ids: 1
|
196
|
+
# }
|
197
|
+
# @data = @mints_contact.sync_follower(data)
|
198
|
+
def sync_follower(data)
|
199
|
+
@client.raw('post', '/contacts/appointments/sync-follower', nil, data_transform(data))
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Conversations
|
4
|
+
##
|
5
|
+
# === Get Conversations.
|
6
|
+
# Get a collection of conversations.
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
10
|
+
# FIXME: This method doesn't return data.
|
11
|
+
def get_conversations(options = nil)
|
12
|
+
@client.raw('get', '/content/conversations', options, nil, @contact_v1_url)
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# === Get Conversation.
|
17
|
+
# Get a conversation info.
|
18
|
+
#
|
19
|
+
# ==== Parameters
|
20
|
+
# id:: (Integer) -- Conversation id.
|
21
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
22
|
+
# FIXME: This method doesn't return data.
|
23
|
+
def get_conversation(id, options = nil)
|
24
|
+
@client.raw('get', "/content/conversations/#{id}", options, nil, @contact_v1_url)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# === Create Conversation.
|
29
|
+
# Create a conversation with data.
|
30
|
+
#
|
31
|
+
# ==== Parameters
|
32
|
+
# data:: (Hash) -- Data to be submitted.
|
33
|
+
#
|
34
|
+
# ==== Example
|
35
|
+
# data = {
|
36
|
+
# title: 'New Conversation To Test'
|
37
|
+
# }
|
38
|
+
# @data = @mints_contact.create_conversation(data)
|
39
|
+
def create_conversation(data)
|
40
|
+
@client.raw('post', '/content/conversations', nil, data_transform(data), @contact_v1_url)
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# === Update Conversation.
|
45
|
+
# Update a location template info.
|
46
|
+
#
|
47
|
+
# ==== Parameters
|
48
|
+
# id:: (Integer) -- Conversation id.
|
49
|
+
# data:: (Hash) -- Data to be submitted.
|
50
|
+
# FIXME: This method doesn't locate conversation id to be updated.
|
51
|
+
def update_conversation(id, data)
|
52
|
+
@client.raw('put', "/content/conversations/#{id}", nil, data_transform(data), @contact_v1_url)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# === Update Conversation Status.
|
57
|
+
# Update a conversation status.
|
58
|
+
#
|
59
|
+
# ==== Parameters
|
60
|
+
# id:: (Integer) -- Conversation id.
|
61
|
+
# data:: (Hash) -- Data to be submitted.
|
62
|
+
# FIXME: This method doesn't locate conversation id to be updated.
|
63
|
+
def update_conversation_status(id, data)
|
64
|
+
@client.raw('put', "/content/conversations/#{id}/status", nil, data_transform(data), @contact_v1_url)
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# === Get Conversation Participants.
|
69
|
+
# Update a conversation participants.
|
70
|
+
#
|
71
|
+
# ==== Parameters
|
72
|
+
# id:: (Integer) -- Conversation id.
|
73
|
+
# FIXME: This method doesn't locate conversation id to be updated.
|
74
|
+
def get_conversation_participants(id)
|
75
|
+
#TODO: Test if this method needs data in options.
|
76
|
+
@client.raw('get', "/content/conversations/#{id}/participants", nil, nil, @contact_v1_url)
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# === Get Messages.
|
81
|
+
# Get a collection of messages.
|
82
|
+
#
|
83
|
+
# ==== Parameters
|
84
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
85
|
+
# FIXME: This method doesn't return data.
|
86
|
+
def get_messages(options = nil)
|
87
|
+
@client.raw('get', '/content/messages', options, nil, @contact_v1_url)
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# === Get Message.
|
92
|
+
# Get a message info.
|
93
|
+
#
|
94
|
+
# ==== Parameters
|
95
|
+
# id:: (Integer) -- Message id.
|
96
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
97
|
+
# FIXME: This method doesn't return data.
|
98
|
+
def get_message(id, options = nil)
|
99
|
+
@client.raw('get', "/content/messages/#{id}", options, nil, @contact_v1_url)
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# === Create Message.
|
104
|
+
# Create a message with data.
|
105
|
+
#
|
106
|
+
# ==== Parameters
|
107
|
+
# data:: (Hash) -- Data to be submitted.
|
108
|
+
#
|
109
|
+
# ==== Example
|
110
|
+
# data = {
|
111
|
+
# conversation_id: 3,
|
112
|
+
# type: 'text',
|
113
|
+
# value: {
|
114
|
+
# text: 'Message Text'
|
115
|
+
# }
|
116
|
+
# }
|
117
|
+
# @data = @mints_contact.create_message(data)
|
118
|
+
def create_message(data)
|
119
|
+
@client.raw('post', '/content/messages', nil, data_transform(data), @contact_v1_url)
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OrderItems
|
4
|
+
##
|
5
|
+
# === Get Order Items.
|
6
|
+
# Get a collection of order items.
|
7
|
+
#TODO: Find a way to show order items.
|
8
|
+
def get_order_items(options = nil)
|
9
|
+
@client.raw('get', '/ecommerce/order-items', options, nil, @contact_v1_url)
|
10
|
+
end
|
11
|
+
|
12
|
+
##
|
13
|
+
# === Get Order Item.
|
14
|
+
# Get an order item info.
|
15
|
+
# TODO: Find a way to show order items.
|
16
|
+
def get_order_item(id, options = nil)
|
17
|
+
@client.raw('get', "/ecommerce/order-items/#{id}", options, nil, @contact_v1_url)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OrderItemsGroups
|
4
|
+
##
|
5
|
+
# === Get Order Item Groups.
|
6
|
+
# Get a collection of order item groups.
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
10
|
+
#
|
11
|
+
# ==== First Example
|
12
|
+
# @data = @mints_contact.get_order_item_groups
|
13
|
+
#
|
14
|
+
# ==== Second Example
|
15
|
+
# options = {
|
16
|
+
# fields: 'id'
|
17
|
+
# }
|
18
|
+
# @data = @mints_contact.get_order_item_groups(options)
|
19
|
+
def get_order_item_groups(options = nil)
|
20
|
+
@client.raw('get', '/ecommerce/order-items-groups', options, nil, @contact_v1_url)
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# === Get Order Item Group.
|
25
|
+
# Get an order item group info.
|
26
|
+
#
|
27
|
+
# ==== Parameters
|
28
|
+
# id:: (Integer) -- Order Item Group Id.
|
29
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
30
|
+
#
|
31
|
+
# ==== First Example
|
32
|
+
# @data = @mints_contact.get_order_item_group(130)
|
33
|
+
#
|
34
|
+
# ==== Second Example
|
35
|
+
# options = {
|
36
|
+
# fields: 'id'
|
37
|
+
# }
|
38
|
+
# @data = @mints_contact.get_order_item_group(130, options)
|
39
|
+
def get_order_item_group(id, options = nil)
|
40
|
+
@client.raw('get', "/ecommerce/order-items-groups/#{id}", options, nil, @contact_v1_url)
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# === Create Order Item Group.
|
45
|
+
# Create an order item group with data if you are related to that order.
|
46
|
+
#
|
47
|
+
# ==== Parameters
|
48
|
+
# data:: (Hash) -- Data to be submitted.
|
49
|
+
#
|
50
|
+
# ==== First Example
|
51
|
+
# data = {
|
52
|
+
# name: 'New Order Item Group',
|
53
|
+
# quantity: 1,
|
54
|
+
# order_id: 1,
|
55
|
+
# on_sale_price: 100
|
56
|
+
# }
|
57
|
+
# @data = @mints_contact.create_order_item_group(data)
|
58
|
+
#
|
59
|
+
# ==== Second Example
|
60
|
+
# data = {
|
61
|
+
# name: "",
|
62
|
+
# quantity: 1,
|
63
|
+
# order_id: 1,
|
64
|
+
# sku_id: 1
|
65
|
+
# }
|
66
|
+
# @data = @mints_contact.create_order_item_group(data)
|
67
|
+
def create_order_item_group(data)
|
68
|
+
@client.raw('post', '/ecommerce/order-items-groups', nil, data_transform(data), @contact_v1_url)
|
69
|
+
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# === Update Order Item Group.
|
73
|
+
# Update an order item group info if you are related to that order.
|
74
|
+
#
|
75
|
+
# ==== Parameters
|
76
|
+
# id:: (Integer) -- Order Item Group Id.
|
77
|
+
# data:: (Hash) -- Data to be submitted.
|
78
|
+
#
|
79
|
+
# ==== First Example
|
80
|
+
# data = {
|
81
|
+
# name: 'New Order Item Group Name Updated'
|
82
|
+
# }
|
83
|
+
# @data = @mints_contact.update_order_item_group(130, data)
|
84
|
+
def update_order_item_group(id, data)
|
85
|
+
@client.raw('put', "/ecommerce/order-items-groups/#{id}", nil, data_transform(data), @contact_v1_url)
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# === Delete Order Item Group.
|
90
|
+
# Delete an order item group.
|
91
|
+
# FIXME: This method doesn't work. Throw no action error.
|
92
|
+
def delete_order_item_group(id)
|
93
|
+
@client.raw('delete', "/ecommerce/order-items-groups/#{id}", nil, nil, @contact_v1_url)
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Orders
|
4
|
+
##
|
5
|
+
# === Get Orders.
|
6
|
+
# Get a collection of orders.
|
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
|
+
# @data = @mints_pub.get_orders
|
14
|
+
#
|
15
|
+
# ==== Second Example
|
16
|
+
# options = { fields: 'title' }
|
17
|
+
# @data = @mints_pub.get_orders(options)
|
18
|
+
#
|
19
|
+
# ==== Third Example
|
20
|
+
# options = { fields: 'title' }
|
21
|
+
# @data = @mints_pub.get_orders(options, false)
|
22
|
+
def get_orders(options = nil, use_post = true)
|
23
|
+
if use_post
|
24
|
+
@client.raw('post', '/ecommerce/orders/query', options, nil, @contact_v1_url)
|
25
|
+
else
|
26
|
+
@client.raw('get', '/ecommerce/orders', options, nil, @contact_v1_url)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# === Get Order.
|
32
|
+
# Get an order info.
|
33
|
+
#
|
34
|
+
# ==== Parameters
|
35
|
+
# id:: (Integer) -- Order id.
|
36
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
37
|
+
#
|
38
|
+
# ==== First Example
|
39
|
+
# @data = @mints_pub.get_product(25)
|
40
|
+
#
|
41
|
+
# ==== Second Example
|
42
|
+
# options = {
|
43
|
+
# fields: 'title'
|
44
|
+
# }
|
45
|
+
# @data = @mints_pub.get_product(25, options)
|
46
|
+
def get_order(id, options = nil)
|
47
|
+
@client.raw('get', "/ecommerce/orders/#{id}", options, nil, @contact_v1_url)
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# === Create Order.
|
52
|
+
# Create a order with data.
|
53
|
+
#
|
54
|
+
# ==== Parameters
|
55
|
+
# data:: (Hash) -- Data to be submitted.
|
56
|
+
#
|
57
|
+
# ==== Example
|
58
|
+
# data = {
|
59
|
+
# order_template_id: 1,
|
60
|
+
# order_status_id: 1,
|
61
|
+
# sales_channel_id: 1
|
62
|
+
# }
|
63
|
+
# @data = @mints_pub.create_order(data)
|
64
|
+
def create_order(data)
|
65
|
+
@client.raw('post', '/ecommerce/orders', nil, data_transform(data), @contact_v1_url)
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# === Update Order.
|
70
|
+
# Update an order info.
|
71
|
+
#
|
72
|
+
# ==== Parameters
|
73
|
+
# id:: (Integer) -- Order Id
|
74
|
+
# data:: (Hash) -- Data to be submitted.
|
75
|
+
# FIXME: This method doesnt update an order.
|
76
|
+
def update_order(id, data)
|
77
|
+
@client.raw('put', "/ecommerce/orders/#{id}", nil, data_transform(data), @contact_v1_url)
|
78
|
+
end
|
79
|
+
|
80
|
+
# TODO: No tested
|
81
|
+
# === Detach Order Item From Order Item Group.
|
82
|
+
# Detach an order item from an order item group.
|
83
|
+
#
|
84
|
+
# ==== Parameters
|
85
|
+
# orderI_iemI_i:: (Integer) -- Order item id.
|
86
|
+
# group_id:: (Integer) -- Order items group id.
|
87
|
+
#
|
88
|
+
def detach_order_item_from_order_item_group(order_item_id, group_id)
|
89
|
+
@client.raw('put', "/ecommerce/order-items/detach/#{order_item_id}/order-items-groups/#{group_id}", nil, nil, @contact_v1_url)
|
90
|
+
end
|
91
|
+
|
92
|
+
#TODO: No tested
|
93
|
+
# === Update Order Item From Order Item Group.
|
94
|
+
# Update an order item data from an order item group.
|
95
|
+
#
|
96
|
+
# ==== Parameters
|
97
|
+
# orderI_iemI_i:: (Integer) -- Order item id.
|
98
|
+
# group_id:: (Integer) -- Order items group id.
|
99
|
+
#
|
100
|
+
def update_order_item_from_order_item_group(order_item_id, group_id, data)
|
101
|
+
url = "/ecommerce/order-items/update/#{order_item_id}/order-items-groups/#{group_id}"
|
102
|
+
@client.raw('put', url, nil, data_transform(data), @contact_v1_url)
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# === Get My Shopping Cart.
|
107
|
+
# Get a collection of items in the shopping cart.
|
108
|
+
#
|
109
|
+
# ==== Example
|
110
|
+
# @data = @mints_contact.get_my_shopping_cart
|
111
|
+
# FIXME: This method returns a nil data.
|
112
|
+
def get_my_shopping_cart(options = nil)
|
113
|
+
@client.raw('get', '/ecommerce/my-shopping-cart', options, nil, @contact_v1_url)
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# === Add Item To Shopping Cart.
|
118
|
+
# Add an item into a shopping cart.
|
119
|
+
#
|
120
|
+
# ==== Parameters
|
121
|
+
# data:: (Hash) -- Data to be submitted.
|
122
|
+
#
|
123
|
+
# ==== Example
|
124
|
+
# data = {
|
125
|
+
# quantity: 1,
|
126
|
+
# sku_id: 1,
|
127
|
+
# price_list_id: 1
|
128
|
+
# }
|
129
|
+
# @data = @mints_contact.add_item_to_shopping_cart(data)
|
130
|
+
def add_item_to_shopping_cart(data, options = nil)
|
131
|
+
@client.raw('post', '/ecommerce/shopping-cart', options, data_transform(data), @contact_v1_url)
|
132
|
+
end
|
133
|
+
end
|