mints 0.0.26 → 0.0.27
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/lib/client.rb +72 -34
- data/lib/contact.rb +46 -46
- data/lib/errors.rb +98 -0
- data/lib/mints/controllers/admin_base_controller.rb +8 -66
- data/lib/mints/controllers/base_api_controller.rb +16 -134
- data/lib/mints/controllers/base_controller.rb +20 -106
- data/lib/mints/controllers/concerns/mints_clients.rb +74 -0
- data/lib/mints/controllers/concerns/read_config_file.rb +28 -0
- data/lib/mints/controllers/contact_api_controller.rb +6 -85
- data/lib/mints/controllers/public_api_controller.rb +6 -79
- data/lib/mints/controllers/user_api_controller.rb +7 -82
- data/lib/mints/helpers/contact_auth_helper.rb +67 -0
- data/lib/{mints_helper.rb → mints/helpers/mints_helper.rb} +7 -5
- data/lib/mints/helpers/proxy_controllers_methods.rb +126 -0
- data/lib/mints/helpers/user_auth_helper.rb +53 -0
- data/lib/mints.rb +2 -0
- data/lib/pub.rb +21 -21
- data/lib/user/config/api_keys.rb +4 -4
- data/lib/user/config/appointments.rb +13 -13
- data/lib/user/config/attribute_groups.rb +5 -5
- data/lib/user/config/attributes.rb +6 -6
- data/lib/user/config/calendars.rb +5 -5
- data/lib/user/config/config.rb +7 -7
- data/lib/user/config/importers.rb +13 -13
- data/lib/user/config/public_folders.rb +7 -7
- data/lib/user/config/relationships.rb +9 -9
- data/lib/user/config/roles.rb +6 -6
- data/lib/user/config/seeds.rb +3 -3
- data/lib/user/config/system_settings.rb +4 -4
- data/lib/user/config/tags.rb +4 -4
- data/lib/user/config/taxonomies.rb +7 -7
- data/lib/user/config/teams.rb +5 -5
- data/lib/user/config/users.rb +5 -5
- data/lib/user/contacts/contacts.rb +1 -1
- data/lib/user/content/assets.rb +17 -17
- data/lib/user/content/content.rb +13 -13
- data/lib/user/content/content_instances.rb +9 -9
- data/lib/user/content/content_templates.rb +7 -7
- data/lib/user/content/conversations.rb +13 -13
- data/lib/user/content/dam.rb +8 -8
- data/lib/user/content/forms.rb +16 -16
- data/lib/user/content/message_templates.rb +11 -11
- data/lib/user/content/messages.rb +5 -5
- data/lib/user/content/pages.rb +7 -7
- data/lib/user/content/stories.rb +6 -6
- data/lib/user/content/story_templates.rb +6 -6
- data/lib/user/content/story_versions.rb +6 -6
- data/lib/user/crm/companies.rb +5 -5
- data/lib/user/crm/contacts.rb +18 -18
- data/lib/user/crm/deals.rb +6 -6
- data/lib/user/crm/favorites.rb +3 -3
- data/lib/user/crm/segments.rb +9 -9
- data/lib/user/crm/users.rb +1 -1
- data/lib/user/crm/workflow_step_objects.rb +5 -5
- data/lib/user/crm/workflow_steps.rb +3 -3
- data/lib/user/crm/workflows.rb +4 -4
- data/lib/user/ecommerce/item_prices.rb +5 -5
- data/lib/user/ecommerce/locations.rb +10 -10
- data/lib/user/ecommerce/order_items_groups.rb +15 -14
- data/lib/user/ecommerce/order_statuses.rb +2 -2
- data/lib/user/ecommerce/orders.rb +16 -16
- data/lib/user/ecommerce/price_lists.rb +3 -3
- data/lib/user/ecommerce/product_templates.rb +7 -7
- data/lib/user/ecommerce/product_variations.rb +8 -8
- data/lib/user/ecommerce/products.rb +10 -10
- data/lib/user/ecommerce/skus.rb +5 -5
- data/lib/user/ecommerce/taxes.rb +5 -5
- data/lib/user/ecommerce/variant_options.rb +4 -4
- data/lib/user/ecommerce/variant_values.rb +4 -4
- data/lib/user/helpers/helpers.rb +8 -8
- data/lib/user/helpers/object_activities.rb +5 -5
- data/lib/user/helpers/object_folders.rb +5 -5
- data/lib/user/helpers/user_folders.rb +5 -5
- data/lib/user/marketing/marketing.rb +8 -8
- data/lib/user/profile/profile.rb +8 -8
- data/lib/user.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b16560bcbef38099113cdc45c5d892ef203d277bd47e43aa94854abfbbfd33b
|
4
|
+
data.tar.gz: d0d996931c6067787e310d42f157bea4c5f8fed63a52697cb48ba3f08aa1b05f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8246a30d4b83cc010f756992430a1530b861038f41fa31da9a463d49e1d3e6b8f598bad77e0ad0fdd31c18a9d13ecdf9fa46253408dd72d5bc4d9ba8ec9883fa
|
7
|
+
data.tar.gz: f574abc3608cc79b1b063ab49dfa60577bb64fb70a96398527270969c6b09ccb0965ef39fbcfb64a25429af5f5dccd09d72f7edd94374762d72d03db9d81f8f0
|
data/lib/client.rb
CHANGED
@@ -22,25 +22,30 @@ module Mints
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def raw(action, url, options = nil, data = nil, base_url = nil, compatibility_options = {}, only_tracking = false)
|
25
|
-
if compatibility_options
|
26
|
-
|
27
|
-
|
28
|
-
base_url = @base_url if !base_url
|
25
|
+
compatibility_options = {} if compatibility_options.nil?
|
26
|
+
|
27
|
+
base_url = @base_url unless base_url
|
29
28
|
uri = ""
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
|
30
|
+
if options&.class == Hash
|
31
|
+
need_encoding = %w[ jfilters afilters rfilters ]
|
32
|
+
found_options_with_encoding = options.keys.select {|key| need_encoding.include? key.to_s.downcase}
|
33
|
+
|
34
|
+
found_options_with_encoding.each do |key|
|
35
|
+
options[key] = CGI::escape(Base64.encode64(options[key].to_json))
|
33
36
|
end
|
37
|
+
|
34
38
|
uri = Addressable::URI.new
|
35
39
|
uri.query_values = options
|
36
40
|
end
|
37
41
|
|
38
42
|
full_url = "#{@host}#{base_url}#{url}#{uri}"
|
39
43
|
response = nil
|
40
|
-
if action === 'get'
|
41
44
|
|
42
|
-
|
43
|
-
|
45
|
+
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
46
|
+
config = YAML.safe_load template.result(binding)
|
47
|
+
|
48
|
+
if action === 'get'
|
44
49
|
url_need_cache = false
|
45
50
|
result_from_cache = false
|
46
51
|
time = 0
|
@@ -74,7 +79,7 @@ module Mints
|
|
74
79
|
end
|
75
80
|
end
|
76
81
|
|
77
|
-
|
82
|
+
unless url_need_cache
|
78
83
|
response = self.send("#{@scope}_#{action}", "#{full_url}", nil, compatibility_options)
|
79
84
|
end
|
80
85
|
|
@@ -89,25 +94,23 @@ module Mints
|
|
89
94
|
response = self.send("#{@scope}_#{action}", "#{full_url}", data, compatibility_options)
|
90
95
|
end
|
91
96
|
|
97
|
+
verify_response_status(response, config['sdk']['ignore_http_errors'])
|
98
|
+
|
92
99
|
begin
|
93
100
|
if result_from_cache
|
94
101
|
if @debug
|
95
102
|
puts "Method: #{action} \nURL: #{url} \nOptions: #{options.to_json} \nOnly tracking: #{only_tracking} \nResponse from: REDIS"
|
96
|
-
if
|
97
|
-
puts "Data: #{data.to_json}"
|
98
|
-
end
|
103
|
+
puts "Data: #{data.to_json}" if data
|
99
104
|
end
|
105
|
+
|
100
106
|
return JSON.parse(response)
|
101
107
|
else
|
102
|
-
|
103
|
-
raise 'NotFoundError'
|
104
|
-
end
|
108
|
+
|
105
109
|
if @debug
|
106
110
|
puts "Method: #{action} \nURL: #{url} \nOptions: #{options.to_json} \nOnly tracking: #{only_tracking} \nResponse from: CALI"
|
107
|
-
if
|
108
|
-
puts "Data: #{data.to_json}"
|
109
|
-
end
|
111
|
+
puts "Data: #{data.to_json}" if data
|
110
112
|
end
|
113
|
+
|
111
114
|
return JSON.parse(response.body)
|
112
115
|
end
|
113
116
|
rescue
|
@@ -123,7 +126,7 @@ module Mints
|
|
123
126
|
name_len = name_spplited.size
|
124
127
|
# the action always be the first element
|
125
128
|
action = name_spplited.first
|
126
|
-
raise 'NoActionError' unless [
|
129
|
+
raise 'NoActionError' unless %w[get create post update put delete destroy verify_response_status].include?(action)
|
127
130
|
# the object always be the last element
|
128
131
|
object = separator == "__" ? name_spplited.last.gsub("_","-") : name_spplited.last
|
129
132
|
# get intermediate url elements
|
@@ -210,7 +213,7 @@ module Mints
|
|
210
213
|
end
|
211
214
|
end
|
212
215
|
|
213
|
-
#####
|
216
|
+
##### HTTP CLIENTS ######
|
214
217
|
# Simple HTTP GET
|
215
218
|
def http_get(url, headers = nil)
|
216
219
|
# if @debug
|
@@ -220,7 +223,7 @@ module Mints
|
|
220
223
|
# puts headers
|
221
224
|
# puts "Method: get"
|
222
225
|
# end
|
223
|
-
|
226
|
+
headers ? HTTParty.get(url, :headers => headers) : HTTParty.get(url)
|
224
227
|
end
|
225
228
|
|
226
229
|
# Simple HTTP POST
|
@@ -234,7 +237,7 @@ module Mints
|
|
234
237
|
# puts data
|
235
238
|
# puts "Method: post"
|
236
239
|
# end
|
237
|
-
|
240
|
+
headers ? HTTParty.post(url, :headers=> headers, :body => data) : HTTParty.post(url, :body => data)
|
238
241
|
end
|
239
242
|
|
240
243
|
# Simple HTTP PUT
|
@@ -248,7 +251,7 @@ module Mints
|
|
248
251
|
# puts data
|
249
252
|
# puts "Method: put"
|
250
253
|
# end
|
251
|
-
|
254
|
+
headers ? HTTParty.put(url, :headers=> headers, :body => data) : HTTParty.put(url, :body => data)
|
252
255
|
end
|
253
256
|
|
254
257
|
# Simple HTTP DELETE
|
@@ -262,7 +265,7 @@ module Mints
|
|
262
265
|
# puts data
|
263
266
|
# puts "Method: delete"
|
264
267
|
# end
|
265
|
-
|
268
|
+
headers ? HTTParty.delete(url, :headers=> headers, :body => data) : HTTParty.delete(url, :body => data)
|
266
269
|
end
|
267
270
|
|
268
271
|
# Start contact context
|
@@ -274,12 +277,14 @@ module Mints
|
|
274
277
|
}
|
275
278
|
h["Content-Type"] = "application/json" unless compatibility_options['no_content_type']
|
276
279
|
h["Authorization"] = "Bearer #{@session_token}" if @session_token
|
280
|
+
|
277
281
|
if headers
|
278
282
|
headers.each do |k,v|
|
279
283
|
h[k] = v
|
280
284
|
end
|
281
285
|
end
|
282
|
-
|
286
|
+
|
287
|
+
self.http_get(url, h)
|
283
288
|
end
|
284
289
|
|
285
290
|
def contact_post(url, data, compatibility_options)
|
@@ -288,9 +293,11 @@ module Mints
|
|
288
293
|
"Accept" => "application/json",
|
289
294
|
"ContactToken" => @contact_token_id
|
290
295
|
}
|
296
|
+
|
291
297
|
headers["Content-Type"] = "application/json" unless compatibility_options['no_content_type']
|
292
298
|
headers["Authorization"] = "Bearer #{@session_token}" if @session_token
|
293
|
-
|
299
|
+
|
300
|
+
self.http_post(url, headers, data)
|
294
301
|
end
|
295
302
|
|
296
303
|
def contact_put(url, data, compatibility_options)
|
@@ -301,7 +308,8 @@ module Mints
|
|
301
308
|
}
|
302
309
|
headers["Content-Type"] = "application/json" unless compatibility_options['no_content_type']
|
303
310
|
headers["Authorization"] = "Bearer #{@session_token}" if @session_token
|
304
|
-
|
311
|
+
|
312
|
+
self.http_put(url, headers, data)
|
305
313
|
end
|
306
314
|
|
307
315
|
# Start User context
|
@@ -317,7 +325,8 @@ module Mints
|
|
317
325
|
h[k] = v
|
318
326
|
end
|
319
327
|
end
|
320
|
-
|
328
|
+
|
329
|
+
self.http_get(url, h)
|
321
330
|
end
|
322
331
|
|
323
332
|
def user_post(url, data, compatibility_options)
|
@@ -327,7 +336,8 @@ module Mints
|
|
327
336
|
}
|
328
337
|
headers["Content-Type"] = "application/json" unless compatibility_options['no_content_type']
|
329
338
|
headers["Authorization"] = "Bearer #{@session_token}" if @session_token
|
330
|
-
|
339
|
+
|
340
|
+
self.http_post(url, headers, data)
|
331
341
|
end
|
332
342
|
|
333
343
|
def user_put(url, data, compatibility_options)
|
@@ -337,7 +347,8 @@ module Mints
|
|
337
347
|
}
|
338
348
|
headers["Content-Type"] = "application/json" unless compatibility_options['no_content_type']
|
339
349
|
headers["Authorization"] = "Bearer #{@session_token}" if @session_token
|
340
|
-
|
350
|
+
|
351
|
+
self.http_put(url, headers, data)
|
341
352
|
end
|
342
353
|
|
343
354
|
def user_delete(url, data, compatibility_options)
|
@@ -347,7 +358,8 @@ module Mints
|
|
347
358
|
}
|
348
359
|
headers["Content-Type"] = "application/json" unless compatibility_options['no_content_type']
|
349
360
|
headers["Authorization"] = "Bearer #{@session_token}" if @session_token
|
350
|
-
|
361
|
+
|
362
|
+
self.http_delete(url, headers, data)
|
351
363
|
end
|
352
364
|
# End User Context
|
353
365
|
|
@@ -364,6 +376,7 @@ module Mints
|
|
364
376
|
h[k] = v
|
365
377
|
end
|
366
378
|
end
|
379
|
+
|
367
380
|
self.http_get(url, h)
|
368
381
|
end
|
369
382
|
|
@@ -373,12 +386,14 @@ module Mints
|
|
373
386
|
"ApiKey" => @api_key
|
374
387
|
}
|
375
388
|
h["Content-Type"] = "application/json" unless compatibility_options['no_content_type']
|
376
|
-
h["ContactToken"] = @
|
389
|
+
h["ContactToken"] = @contact_token_id if @contact_token_id
|
390
|
+
|
377
391
|
if headers
|
378
392
|
headers.each do |k,v|
|
379
393
|
h[k] = v
|
380
394
|
end
|
381
395
|
end
|
396
|
+
|
382
397
|
self.http_post(url, h, data)
|
383
398
|
end
|
384
399
|
|
@@ -394,7 +409,30 @@ module Mints
|
|
394
409
|
h[k] = v
|
395
410
|
end
|
396
411
|
end
|
412
|
+
|
397
413
|
self.http_put(url, h, data)
|
398
414
|
end
|
415
|
+
|
416
|
+
def verify_response_status(response, ignore_http_errors)
|
417
|
+
# Verify if the response is cached
|
418
|
+
unless response.kind_of? String
|
419
|
+
# Raise an error if response code is not 2xx
|
420
|
+
http_status = response&.response&.code&.to_i || 500
|
421
|
+
is_success = (http_status >= 200 and http_status < 300)
|
422
|
+
|
423
|
+
if !is_success and !ignore_http_errors
|
424
|
+
title = "Request failed with status #{http_status}"
|
425
|
+
detail = response&.response&.message || 'Unknown error'
|
426
|
+
|
427
|
+
puts "Error detected: #{http_status}" if @debug
|
428
|
+
error_class = Errors::DynamicError.new(self, title, detail, http_status, response&.parsed_response)
|
429
|
+
|
430
|
+
raise error_class if @debug
|
431
|
+
|
432
|
+
raise error_class.error
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
399
437
|
end
|
400
438
|
end
|
data/lib/contact.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require_relative "./client.rb"
|
2
|
-
require_relative "./mints_helper.rb"
|
2
|
+
require_relative "./mints/helpers/mints_helper.rb"
|
3
3
|
include ActionController::Cookies
|
4
4
|
module Mints
|
5
5
|
class Contact
|
@@ -38,7 +38,7 @@ module Mints
|
|
38
38
|
# }
|
39
39
|
# @mints_contact.register(data);
|
40
40
|
def register(data)
|
41
|
-
|
41
|
+
@client.raw("post", "/contacts/register", nil, data_transform(data))
|
42
42
|
end
|
43
43
|
|
44
44
|
##
|
@@ -74,7 +74,7 @@ module Mints
|
|
74
74
|
# data = { "email": "email@example.com" }
|
75
75
|
# @mints_contact.recover_password(data)
|
76
76
|
def recover_password(data)
|
77
|
-
|
77
|
+
@client.raw("post", "/contacts/recover-password", nil, data_transform(data))
|
78
78
|
end
|
79
79
|
|
80
80
|
##
|
@@ -93,14 +93,14 @@ module Mints
|
|
93
93
|
# }
|
94
94
|
# @mints_contact.reset_password(data)
|
95
95
|
def reset_password(data)
|
96
|
-
|
96
|
+
@client.raw("post", "/contacts/reset-password", nil, data_transform(data))
|
97
97
|
end
|
98
98
|
|
99
99
|
##
|
100
100
|
# === OAuth Login.
|
101
101
|
# Login a contact using oauth.
|
102
102
|
def oauth_login(data)
|
103
|
-
|
103
|
+
@client.raw("post", "/contacts/oauth-login", nil, data)
|
104
104
|
end
|
105
105
|
|
106
106
|
##
|
@@ -151,7 +151,7 @@ module Mints
|
|
151
151
|
else
|
152
152
|
data['email'] = email_or_phone
|
153
153
|
end
|
154
|
-
|
154
|
+
@client.raw("post", "/contacts/magic-link", nil, { data: data }.to_json, '/api/v1')
|
155
155
|
end
|
156
156
|
|
157
157
|
### CONTACT/V1 ###
|
@@ -173,7 +173,7 @@ module Mints
|
|
173
173
|
# }
|
174
174
|
# @data = @mints_contact.me(options)
|
175
175
|
def me(options = nil)
|
176
|
-
|
176
|
+
@client.raw("get", "/me", options, nil, @contact_v1_url)
|
177
177
|
end
|
178
178
|
|
179
179
|
##
|
@@ -183,7 +183,7 @@ module Mints
|
|
183
183
|
# ==== Example
|
184
184
|
# @data = @mints_contact.status
|
185
185
|
def status
|
186
|
-
|
186
|
+
@client.raw("get", "/status", nil, nil, @contact_v1_url)
|
187
187
|
end
|
188
188
|
|
189
189
|
##
|
@@ -200,7 +200,7 @@ module Mints
|
|
200
200
|
# }
|
201
201
|
# @data = @mints_contact.update(data)
|
202
202
|
def update(data)
|
203
|
-
|
203
|
+
@client.raw("put", "/update", nil, data_transform(data), @contact_v1_url)
|
204
204
|
end
|
205
205
|
|
206
206
|
##
|
@@ -228,7 +228,7 @@ module Mints
|
|
228
228
|
# data = { "password": "new_password" }
|
229
229
|
# @data = @mints_contact.change_password(data)
|
230
230
|
def change_password(data)
|
231
|
-
|
231
|
+
@client.raw("post", "/change-password", nil, data_transform(data), @contact_v1_url)
|
232
232
|
end
|
233
233
|
|
234
234
|
# Conversations
|
@@ -241,7 +241,7 @@ module Mints
|
|
241
241
|
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
242
242
|
# FIXME: This method doesn't return data.
|
243
243
|
def get_conversations(options = nil)
|
244
|
-
|
244
|
+
@client.raw("get", "/content/conversations", options, nil, @contact_v1_url)
|
245
245
|
end
|
246
246
|
|
247
247
|
##
|
@@ -253,7 +253,7 @@ module Mints
|
|
253
253
|
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
254
254
|
# FIXME: This method doesn't return data.
|
255
255
|
def get_conversation(id, options = nil)
|
256
|
-
|
256
|
+
@client.raw("get", "/content/conversations/#{id}", options, nil, @contact_v1_url)
|
257
257
|
end
|
258
258
|
|
259
259
|
##
|
@@ -269,7 +269,7 @@ module Mints
|
|
269
269
|
# }
|
270
270
|
# @data = @mints_contact.create_conversation(data)
|
271
271
|
def create_conversation(data)
|
272
|
-
|
272
|
+
@client.raw("post", "/content/conversations", nil, data_transform(data), @contact_v1_url)
|
273
273
|
end
|
274
274
|
|
275
275
|
##
|
@@ -281,7 +281,7 @@ module Mints
|
|
281
281
|
# data:: (Hash) -- Data to be submitted.
|
282
282
|
# FIXME: This method doesn't locate conversation id to be updated.
|
283
283
|
def update_conversation(id, data)
|
284
|
-
|
284
|
+
@client.raw("put", "/content/conversations/#{id}", nil, data_transform(data), @contact_v1_url)
|
285
285
|
end
|
286
286
|
|
287
287
|
##
|
@@ -293,7 +293,7 @@ module Mints
|
|
293
293
|
# data:: (Hash) -- Data to be submitted.
|
294
294
|
# FIXME: This method doesn't locate conversation id to be updated.
|
295
295
|
def update_conversation_status(id, data)
|
296
|
-
|
296
|
+
@client.raw("put", "/content/conversations/#{id}/status", nil, data_transform(data), @contact_v1_url)
|
297
297
|
end
|
298
298
|
|
299
299
|
##
|
@@ -305,7 +305,7 @@ module Mints
|
|
305
305
|
# FIXME: This method doesn't locate conversation id to be updated.
|
306
306
|
def get_conversation_participants(id)
|
307
307
|
#TODO: Test if this method needs data in options.
|
308
|
-
|
308
|
+
@client.raw("get", "/content/conversations/#{id}/participants", nil, nil, @contact_v1_url)
|
309
309
|
end
|
310
310
|
|
311
311
|
##
|
@@ -316,7 +316,7 @@ module Mints
|
|
316
316
|
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
317
317
|
# FIXME: This method doesn't return data.
|
318
318
|
def get_messages(options = nil)
|
319
|
-
|
319
|
+
@client.raw("get", "/content/messages", options, nil, @contact_v1_url)
|
320
320
|
end
|
321
321
|
|
322
322
|
##
|
@@ -328,7 +328,7 @@ module Mints
|
|
328
328
|
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
329
329
|
# FIXME: This method doesn't return data.
|
330
330
|
def get_message(id, options = nil)
|
331
|
-
|
331
|
+
@client.raw("get", "/content/messages/#{id}", options, nil, @contact_v1_url)
|
332
332
|
end
|
333
333
|
|
334
334
|
##
|
@@ -348,7 +348,7 @@ module Mints
|
|
348
348
|
# }
|
349
349
|
# @data = @mints_contact.create_message(data)
|
350
350
|
def create_message(data)
|
351
|
-
|
351
|
+
@client.raw("post", "/content/messages", nil, data_transform(data), @contact_v1_url)
|
352
352
|
end
|
353
353
|
|
354
354
|
# Appointments
|
@@ -369,7 +369,7 @@ module Mints
|
|
369
369
|
# }
|
370
370
|
# @data = @mints_contact.get_appointments(options)
|
371
371
|
def get_appointments(options = nil)
|
372
|
-
|
372
|
+
@client.raw("get", "/contacts/appointments", options)
|
373
373
|
end
|
374
374
|
|
375
375
|
##
|
@@ -388,7 +388,7 @@ module Mints
|
|
388
388
|
# }
|
389
389
|
# @data = @mints_contact.get_appointment(1, options)
|
390
390
|
def get_appointment(id, options = nil)
|
391
|
-
|
391
|
+
@client.raw("get", "/contacts/appointments/#{id}", options)
|
392
392
|
end
|
393
393
|
|
394
394
|
##
|
@@ -408,7 +408,7 @@ module Mints
|
|
408
408
|
# }
|
409
409
|
# @data = @mints_contact.create_appointment(data)
|
410
410
|
def create_appointment(data)
|
411
|
-
|
411
|
+
@client.raw("post", "/contacts/appointments", nil, data_transform(data))
|
412
412
|
end
|
413
413
|
|
414
414
|
##
|
@@ -425,7 +425,7 @@ module Mints
|
|
425
425
|
# }
|
426
426
|
# @data = @mints_contact.update_appointment(1, data)
|
427
427
|
def update_appointment(id, data)
|
428
|
-
|
428
|
+
@client.raw("put", "/contacts/appointments/#{id}", nil, data_transform(data))
|
429
429
|
end
|
430
430
|
|
431
431
|
##
|
@@ -444,7 +444,7 @@ module Mints
|
|
444
444
|
# }
|
445
445
|
# @data = @mints_contact.scheduled_appointments(data)
|
446
446
|
def scheduled_appointments(data)
|
447
|
-
|
447
|
+
@client.raw("post", "/contacts/appointments/scheduled-appointments", nil, data_transform(data))
|
448
448
|
end
|
449
449
|
|
450
450
|
##
|
@@ -461,7 +461,7 @@ module Mints
|
|
461
461
|
# }
|
462
462
|
# @data = @mints_contact.attach_invitee(data)
|
463
463
|
def attach_invitee(data)
|
464
|
-
|
464
|
+
@client.raw("post", "/contacts/appointments/attach-invitee", nil, data_transform(data))
|
465
465
|
end
|
466
466
|
|
467
467
|
##
|
@@ -478,7 +478,7 @@ module Mints
|
|
478
478
|
# }
|
479
479
|
# @data = @mints_contact.attach_follower(data)
|
480
480
|
def attach_follower(data)
|
481
|
-
|
481
|
+
@client.raw("post", "/contacts/appointments/attach-follower", nil, data_transform(data))
|
482
482
|
end
|
483
483
|
|
484
484
|
##
|
@@ -495,7 +495,7 @@ module Mints
|
|
495
495
|
# }
|
496
496
|
# @data = @mints_contact.detach_invitee(data)
|
497
497
|
def detach_invitee(data)
|
498
|
-
|
498
|
+
@client.raw("post", "/contacts/appointments/detach-invitee", nil, data_transform(data))
|
499
499
|
end
|
500
500
|
|
501
501
|
##
|
@@ -512,7 +512,7 @@ module Mints
|
|
512
512
|
# }
|
513
513
|
# @data = @mints_contact.detach_follower(data)
|
514
514
|
def detach_follower(data)
|
515
|
-
|
515
|
+
@client.raw("post", "/contacts/appointments/detach-follower", nil, data_transform(data))
|
516
516
|
end
|
517
517
|
|
518
518
|
##
|
@@ -529,7 +529,7 @@ module Mints
|
|
529
529
|
# }
|
530
530
|
# @data = @mints_contact.sync_invitee(data)
|
531
531
|
def sync_invitee(data)
|
532
|
-
|
532
|
+
@client.raw("post", "/contacts/appointments/sync-invitee", nil, data_transform(data))
|
533
533
|
end
|
534
534
|
|
535
535
|
##
|
@@ -546,7 +546,7 @@ module Mints
|
|
546
546
|
# }
|
547
547
|
# @data = @mints_contact.sync_follower(data)
|
548
548
|
def sync_follower(data)
|
549
|
-
|
549
|
+
@client.raw("post", "/contacts/appointments/sync-follower", nil, data_transform(data))
|
550
550
|
end
|
551
551
|
|
552
552
|
##
|
@@ -569,9 +569,9 @@ module Mints
|
|
569
569
|
# @data = @mints_pub.get_orders(options, false)
|
570
570
|
def get_orders(options = nil, use_post = true)
|
571
571
|
if use_post
|
572
|
-
|
572
|
+
@client.raw("post", "/ecommerce/orders/query", options, nil, @contact_v1_url)
|
573
573
|
else
|
574
|
-
|
574
|
+
@client.raw("get", "/ecommerce/orders", options, nil, @contact_v1_url)
|
575
575
|
end
|
576
576
|
end
|
577
577
|
|
@@ -592,7 +592,7 @@ module Mints
|
|
592
592
|
# }
|
593
593
|
# @data = @mints_pub.get_product(25, options)
|
594
594
|
def get_order(id, options = nil)
|
595
|
-
|
595
|
+
@client.raw("get", "/ecommerce/orders/#{id}", options, nil, @contact_v1_url)
|
596
596
|
end
|
597
597
|
|
598
598
|
##
|
@@ -610,7 +610,7 @@ module Mints
|
|
610
610
|
# }
|
611
611
|
# @data = @mints_pub.create_order(data)
|
612
612
|
def create_order(data)
|
613
|
-
|
613
|
+
@client.raw("post", "/ecommerce/orders", nil, data_transform(data), @contact_v1_url)
|
614
614
|
end
|
615
615
|
|
616
616
|
##
|
@@ -622,7 +622,7 @@ module Mints
|
|
622
622
|
# data:: (Hash) -- Data to be submitted.
|
623
623
|
# FIXME: This method doesnt update an order.
|
624
624
|
def update_order(id, data)
|
625
|
-
|
625
|
+
@client.raw("put", "/ecommerce/orders/#{id}", nil, data_transform(data), @contact_v1_url)
|
626
626
|
end
|
627
627
|
|
628
628
|
#TODO: No tested
|
@@ -634,7 +634,7 @@ module Mints
|
|
634
634
|
# groupId:: (Integer) -- Order items group id.
|
635
635
|
#
|
636
636
|
def detach_order_item_from_order_item_group(orderItemId, groupId)
|
637
|
-
|
637
|
+
@client.raw("put", "/ecommerce/order-items/detach/#{orderItemId}/order-items-groups/#{groupId}", nil, nil, @contact_v1_url)
|
638
638
|
end
|
639
639
|
|
640
640
|
#TODO: No tested
|
@@ -646,7 +646,7 @@ module Mints
|
|
646
646
|
# groupId:: (Integer) -- Order items group id.
|
647
647
|
#
|
648
648
|
def update_order_item_from_order_item_group(orderItemId, groupId, data)
|
649
|
-
|
649
|
+
@client.raw("put", "/ecommerce/order-items/update/#{orderItemId}/order-items-groups/#{groupId}", nil, data_transform(data), @contact_v1_url)
|
650
650
|
end
|
651
651
|
|
652
652
|
##
|
@@ -657,7 +657,7 @@ module Mints
|
|
657
657
|
# @data = @mints_contact.get_my_shopping_cart
|
658
658
|
# FIXME: This method returns a nil data.
|
659
659
|
def get_my_shopping_cart(options = nil)
|
660
|
-
|
660
|
+
@client.raw("get", "/ecommerce/my-shopping-cart", options, nil, @contact_v1_url)
|
661
661
|
end
|
662
662
|
|
663
663
|
##
|
@@ -675,7 +675,7 @@ module Mints
|
|
675
675
|
# }
|
676
676
|
# @data = @mints_contact.add_item_to_shopping_cart(data)
|
677
677
|
def add_item_to_shopping_cart(data, options = nil)
|
678
|
-
|
678
|
+
@client.raw("post", "/ecommerce/shopping-cart", options, data_transform(data), @contact_v1_url)
|
679
679
|
end
|
680
680
|
|
681
681
|
##
|
@@ -683,7 +683,7 @@ module Mints
|
|
683
683
|
# Get a collection of order items.
|
684
684
|
#TODO: Find a way to show order items.
|
685
685
|
def get_order_items(options = nil)
|
686
|
-
|
686
|
+
@client.raw("get", "/ecommerce/order-items", options, nil, @contact_v1_url)
|
687
687
|
end
|
688
688
|
|
689
689
|
##
|
@@ -691,7 +691,7 @@ module Mints
|
|
691
691
|
# Get an order item info.
|
692
692
|
#TODO: Find a way to show order items.
|
693
693
|
def get_order_item(id, options = nil)
|
694
|
-
|
694
|
+
@client.raw("get", "/ecommerce/order-items/#{id}", options, nil, @contact_v1_url)
|
695
695
|
end
|
696
696
|
|
697
697
|
##
|
@@ -710,7 +710,7 @@ module Mints
|
|
710
710
|
# }
|
711
711
|
# @data = @mints_contact.get_order_item_groups(options)
|
712
712
|
def get_order_item_groups(options = nil)
|
713
|
-
|
713
|
+
@client.raw("get", "/ecommerce/order-items-groups", options, nil, @contact_v1_url)
|
714
714
|
end
|
715
715
|
|
716
716
|
##
|
@@ -730,7 +730,7 @@ module Mints
|
|
730
730
|
# }
|
731
731
|
# @data = @mints_contact.get_order_item_group(130, options)
|
732
732
|
def get_order_item_group(id, options = nil)
|
733
|
-
|
733
|
+
@client.raw("get", "/ecommerce/order-items-groups/#{id}", options, nil, @contact_v1_url)
|
734
734
|
end
|
735
735
|
|
736
736
|
##
|
@@ -758,7 +758,7 @@ module Mints
|
|
758
758
|
# }
|
759
759
|
# @data = @mints_contact.create_order_item_group(data)
|
760
760
|
def create_order_item_group(data)
|
761
|
-
|
761
|
+
@client.raw("post", "/ecommerce/order-items-groups", nil, data_transform(data), @contact_v1_url)
|
762
762
|
end
|
763
763
|
|
764
764
|
##
|
@@ -775,7 +775,7 @@ module Mints
|
|
775
775
|
# }
|
776
776
|
# @data = @mints_contact.update_order_item_group(130, data)
|
777
777
|
def update_order_item_group(id, data)
|
778
|
-
|
778
|
+
@client.raw("put", "/ecommerce/order-items-groups/#{id}", nil, data_transform(data), @contact_v1_url)
|
779
779
|
end
|
780
780
|
|
781
781
|
##
|
@@ -783,7 +783,7 @@ module Mints
|
|
783
783
|
# Delete an order item group.
|
784
784
|
# FIXME: This method doesn't work. Throw no action error.
|
785
785
|
def delete_order_item_group(id)
|
786
|
-
|
786
|
+
@client.raw("delete", "/ecommerce/order-items-groups/#{id}", nil, nil, @contact_v1_url)
|
787
787
|
end
|
788
788
|
|
789
789
|
private
|