mints 0.0.15 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/client.rb +65 -30
  3. data/lib/contact.rb +146 -17
  4. data/lib/generators/mints_assets_controller.rb +3 -0
  5. data/lib/generators/mints_files_generator.rb +2 -0
  6. data/lib/mints/controllers/admin_base_controller.rb +28 -12
  7. data/lib/mints/controllers/base_api_controller.rb +97 -7
  8. data/lib/mints/controllers/base_controller.rb +48 -7
  9. data/lib/mints_helper.rb +47 -0
  10. data/lib/pub.rb +137 -52
  11. data/lib/user/config/api_keys.rb +65 -0
  12. data/lib/user/config/appointments.rb +221 -0
  13. data/lib/user/config/attribute_groups.rb +77 -0
  14. data/lib/user/config/attributes.rb +86 -0
  15. data/lib/user/config/calendars.rb +89 -0
  16. data/lib/user/config/config.rb +65 -0
  17. data/lib/user/config/importers.rb +184 -0
  18. data/lib/user/config/public_folders.rb +108 -0
  19. data/lib/user/config/relationships.rb +138 -0
  20. data/lib/user/config/roles.rb +84 -0
  21. data/lib/user/config/seeds.rb +14 -0
  22. data/lib/user/config/system_settings.rb +53 -0
  23. data/lib/user/config/tags.rb +63 -0
  24. data/lib/user/config/taxonomies.rb +124 -0
  25. data/lib/user/config/teams.rb +70 -0
  26. data/lib/user/config/users.rb +76 -0
  27. data/lib/user/contacts/contacts.rb +21 -0
  28. data/lib/user/content/assets.rb +98 -0
  29. data/lib/user/content/content.rb +235 -0
  30. data/lib/user/content/content_instances.rb +147 -0
  31. data/lib/user/content/content_templates.rb +111 -0
  32. data/lib/user/content/conversations.rb +174 -0
  33. data/lib/user/content/dam.rb +88 -0
  34. data/lib/user/content/forms.rb +168 -0
  35. data/lib/user/content/message_templates.rb +162 -0
  36. data/lib/user/content/messages.rb +90 -0
  37. data/lib/user/content/pages.rb +81 -0
  38. data/lib/user/content/stories.rb +164 -0
  39. data/lib/user/content/story_templates.rb +95 -0
  40. data/lib/user/crm/companies.rb +111 -0
  41. data/lib/user/crm/contacts.rb +312 -0
  42. data/lib/user/crm/crm.rb +21 -0
  43. data/lib/user/crm/deals.rb +111 -0
  44. data/lib/user/crm/favorites.rb +17 -0
  45. data/lib/user/crm/segments.rb +132 -0
  46. data/lib/user/crm/users.rb +22 -0
  47. data/lib/user/crm/workflow_step_objects.rb +89 -0
  48. data/lib/user/crm/workflow_steps.rb +49 -0
  49. data/lib/user/crm/workflows.rb +70 -0
  50. data/lib/user/ecommerce/ecommerce.rb +29 -0
  51. data/lib/user/ecommerce/item_prices.rb +86 -0
  52. data/lib/user/ecommerce/locations.rb +166 -0
  53. data/lib/user/ecommerce/order_items_groups.rb +109 -0
  54. data/lib/user/ecommerce/order_statuses.rb +26 -0
  55. data/lib/user/ecommerce/orders.rb +258 -0
  56. data/lib/user/ecommerce/price_lists.rb +73 -0
  57. data/lib/user/ecommerce/product_templates.rb +104 -0
  58. data/lib/user/ecommerce/product_variations.rb +129 -0
  59. data/lib/user/ecommerce/products.rb +169 -0
  60. data/lib/user/ecommerce/skus.rb +88 -0
  61. data/lib/user/ecommerce/taxes.rb +82 -0
  62. data/lib/user/ecommerce/variant_options.rb +69 -0
  63. data/lib/user/ecommerce/variant_values.rb +72 -0
  64. data/lib/user/helpers/helpers.rb +113 -0
  65. data/lib/user/helpers/object_activities.rb +83 -0
  66. data/lib/user/helpers/object_folders.rb +82 -0
  67. data/lib/user/helpers/user_folders.rb +83 -0
  68. data/lib/user/marketing/marketing.rb +120 -0
  69. data/lib/user/profile/profile.rb +111 -0
  70. data/lib/user.rb +36 -355
  71. metadata +64 -3
data/lib/user.rb CHANGED
@@ -1,4 +1,14 @@
1
1
  require_relative './client.rb'
2
+ require_relative './mints_helper.rb'
3
+ require_relative './user/crm/crm.rb'
4
+ require_relative './user/content/content.rb'
5
+ require_relative './user/marketing/marketing.rb'
6
+ require_relative './user/ecommerce/ecommerce.rb'
7
+ require_relative './user/config/config.rb'
8
+ require_relative './user/profile/profile.rb'
9
+ require_relative './user/helpers/helpers.rb'
10
+ require_relative './user/contacts/contacts.rb'
11
+
2
12
  module Mints
3
13
  ##
4
14
  # == User context API
@@ -27,6 +37,15 @@ module Mints
27
37
  # * +taxonomies+ - [Boolean] attach categories to response
28
38
  # * +tags+ - [Boolean] attach tags to response
29
39
  class User
40
+ include CRM
41
+ include Content
42
+ include Marketing
43
+ include Ecommerce
44
+ include Config
45
+ include Profile
46
+ include Helpers
47
+ include Contacts
48
+
30
49
  attr_reader :client
31
50
  def initialize(host, api_key, session_token = nil, debug = false)
32
51
  @client = Mints::Client.new(host, api_key, 'user', session_token, nil, debug)
@@ -37,371 +56,33 @@ module Mints
37
56
  email: email,
38
57
  password: password,
39
58
  }
40
- response = @client.raw("post", "/users/login", nil, data, '/api/v1')
59
+ response = @client.raw("post", "/users/login", nil, data.to_json, '/api/v1', {'no_content_type': true})
41
60
  if response.key? "api_token"
42
61
  @client.session_token = response["api_token"]
43
62
  end
44
63
  return response
45
64
  end
46
- ######################################### CRM #########################################
47
- ##
48
- # === Get contacts.
49
- # Get a collection of contacts
50
- #
51
- # ==== Parameters
52
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
53
- def get_contacts(options = nil)
54
- return @client.get__crm__contacts(options)
55
- end
56
65
 
57
- def get_contact(id, options = nil)
58
- return @client.get__crm__contacts(id, options)
66
+ def magic_link_login(token)
67
+ response = @client.raw("get", "/users/magic-link-login/#{token}", nil, nil, '/api/v1')
68
+ return response
59
69
  end
60
70
 
61
- def create_contact(data, options = nil)
62
- return @client.create__crm__contacts(data, options)
71
+ ##
72
+ # === Send magic link to user
73
+ def send_magic_link(email, redirectUrl = '', lifeTime = 24)
74
+ data = {
75
+ email: email,
76
+ redirectUrl: redirectUrl,
77
+ lifeTime: lifeTime
78
+ }
79
+ response = @client.raw("post", "/users/magic-link", nil, { data: data }, '/api/v1')
80
+ return response
63
81
  end
64
82
 
65
- def update_contact(id, data, options = nil)
66
- return @client.update__crm__contacts(id, data, options)
67
- end
83
+ private
84
+
85
+ include MintsHelper
68
86
 
69
- # === Get companies.
70
- # Get a collection of companies
71
- #
72
- # ==== Parameters
73
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
74
- def get_companies(options = nil)
75
- return @client.get__crm__companies(options)
76
- end
77
-
78
- def get_company(id, options = nil)
79
- return @client.get__crm__companies(id, options)
80
- end
81
-
82
- def create_company(data, options = nil)
83
- return @client.create__crm__companies(data, options)
84
- end
85
-
86
- def update_company(id, data, options = nil)
87
- return @client.update__crm__companies(id, data, options)
88
- end
89
-
90
- # === Get deals.
91
- # Get a collection of deals
92
- #
93
- # ==== Parameters
94
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
95
- def get_deals(options = nil)
96
- return @client.get__crm__deals(options)
97
- end
98
-
99
- def get_deal(id, options = nil)
100
- return @client.get__crm__deals(id, options)
101
- end
102
-
103
- def create_deal(data, options = nil)
104
- return @client.create__crm__deals(data, options)
105
- end
106
-
107
- def update_deal(id, data, options = nil)
108
- return @client.update__crm__deals(id, data, options)
109
- end
110
-
111
- ######################################### Content #########################################
112
- # === Get stories.
113
- # Get a collection of stories
114
- #
115
- # ==== Parameters
116
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
117
- def get_stories(options = nil)
118
- return @client.get__content__stories(options)
119
- end
120
-
121
- def get_story(id, options = nil)
122
- return @client.get__content__stories(id, options)
123
- end
124
-
125
- def create_story(data, options = nil)
126
- return @client.create__content__stories(data, options)
127
- end
128
-
129
- def update_story(id, data, options = nil)
130
- return @client.update__content__stories(id, data, options)
131
- end
132
-
133
- # === Get story templates.
134
- # Get a collection of story templates
135
- #
136
- # ==== Parameters
137
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
138
- def get_story_templates(options = nil)
139
- return @client.get__content__story_templates(options)
140
- end
141
-
142
- def get_story_template(id, options = nil)
143
- return @client.get__content__story_templates(id, options)
144
- end
145
-
146
- def create_story_template(data, options = nil)
147
- return @client.create__content__story_templates(data, options)
148
- end
149
-
150
- def update_story_template(id, data, options = nil)
151
- return @client.update__content__story_templates(id, data, options)
152
- end
153
-
154
- # === Get content instances.
155
- # Get a collection of content instances
156
- #
157
- # ==== Parameters
158
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
159
- def get_content_instances(options = nil)
160
- return @client.get__content__instances(options)
161
- end
162
-
163
- def get_content_instance(id, options = nil)
164
- return @client.get__content__instances(id, options)
165
- end
166
-
167
- def create_content_instance(data, options = nil)
168
- return @client.create__content__instances(data, options)
169
- end
170
-
171
- def update_content_instance(id, data, options = nil)
172
- return @client.update__content__instances(id, data, options)
173
- end
174
-
175
- # === Get content pages.
176
- # Get a collection of content pages
177
- #
178
- # ==== Parameters
179
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
180
- def get_content_pages(options = nil)
181
- return @client.get__content__pages(options)
182
- end
183
-
184
- def get_content_page(id, options = nil)
185
- return @client.get__content__pages(id, options)
186
- end
187
-
188
- def create_content_page(data, options = nil)
189
- return @client.create__content__pages(data, options)
190
- end
191
-
192
- def update_content_page(id, data, options = nil)
193
- return @client.update__content__pages(id, data, options)
194
- end
195
-
196
- # === Get content templates.
197
- # Get a collection of content templates
198
- #
199
- # ==== Parameters
200
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
201
- def get_content_templates(options = nil)
202
- return @client.get__content__templates(options)
203
- end
204
-
205
- def get_content_template(id, options = nil)
206
- return @client.get__content__templates(id, options)
207
- end
208
-
209
- def create_content_template(data, options = nil)
210
- return @client.create__content__templates(data, options)
211
- end
212
-
213
- def update_content_template(id, data, options = nil)
214
- return @client.update__content__templates(id, data, options)
215
- end
216
-
217
- # === Get products.
218
- # Get a collection of products
219
- #
220
- # ==== Parameters
221
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
222
- def get_products(options = nil)
223
- return @client.get__ecommerce__products(options)
224
- end
225
-
226
- def get_product(id, options = nil)
227
- return @client.get__ecommerce__products(id, options)
228
- end
229
-
230
- def create_product(data, options = nil)
231
- return @client.create__ecommerce__products(data, options)
232
- end
233
-
234
- def update_product(id, data, options = nil)
235
- return @client.update__ecommerce__products(id, data, options)
236
- end
237
-
238
- # === Get skus.
239
- # Get a collection of skus
240
- #
241
- # ==== Parameters
242
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
243
- def get_skus(options = nil)
244
- return @client.get__ecommerce__skus(options)
245
- end
246
-
247
- def get_sku(id, options = nil)
248
- return @client.get__ecommerce__skus(id, options)
249
- end
250
-
251
- def create_sku(data, options = nil)
252
- return @client.create__ecommerce__skus(data, options)
253
- end
254
-
255
- def update_sku(id, data, options = nil)
256
- return @client.update__ecommerce__skus(id, data, options)
257
- end
258
-
259
- # === Get prices.
260
- # Get a collection of prices
261
- #
262
- # ==== Parameters
263
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
264
- def get_prices(options = nil)
265
- return @client.get__ecommerce__prices(options)
266
- end
267
-
268
- def get_price(id, options = nil)
269
- return @client.get__ecommerce__prices(id, options)
270
- end
271
-
272
- def create_price(data, options = nil)
273
- return @client.create__ecommerce__prices(data, options)
274
- end
275
-
276
- def update_price(id, data, options = nil)
277
- return @client.update__ecommerce__prices(id, data, options)
278
- end
279
-
280
- # === Get prece lists.
281
- # Get a collection of prece lists
282
- #
283
- # ==== Parameters
284
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
285
- def get_price_lists(options = nil)
286
- return @client.get__ecommerce__price_lists(options)
287
- end
288
-
289
- def get_price_list(id, options = nil)
290
- return @client.get__ecommerce__price_lists(id, options)
291
- end
292
-
293
- def create_price_list(data, options = nil)
294
- return @client.create__ecommerce__price_lists(data, options)
295
- end
296
-
297
- def update_price_list(id, data, options = nil)
298
- return @client.update__ecommerce__price_lists(id, data, options)
299
- end
300
-
301
- # === Get product brands.
302
- # Get a collection of product brands
303
- #
304
- # ==== Parameters
305
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
306
- def get_product_brands(options = nil)
307
- return @client.get__ecommerce__product_brands(options)
308
- end
309
-
310
- def get_prodict_brand(id, options = nil)
311
- return @client.get__ecommerce__product_brands(id, options)
312
- end
313
-
314
- def create_prodict_brand(data, options = nil)
315
- return @client.create__ecommerce__product_brands(data, options)
316
- end
317
-
318
- def update_product_brand(id, data, options = nil)
319
- return @client.update__ecommerce__product_brands(id, data, options)
320
- end
321
-
322
- # === Get product types.
323
- # Get a collection of product types
324
- #
325
- # ==== Parameters
326
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
327
- def get_product_types(options = nil)
328
- return @client.get__ecommerce__product_types(options)
329
- end
330
-
331
- def get_prodict_type(id, options = nil)
332
- return @client.get__ecommerce__product_types(id, options)
333
- end
334
-
335
- def create_prodict_type(data, options = nil)
336
- return @client.create__ecommerce__product_types(data, options)
337
- end
338
-
339
- def update_product_type(id, data, options = nil)
340
- return @client.update__ecommerce__product_types(id, data, options)
341
- end
342
-
343
- # === Get product templates.
344
- # Get a collection of product templates
345
- #
346
- # ==== Parameters
347
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
348
- def get_product_templates(options = nil)
349
- return @client.get__ecommerce__product_templates(options)
350
- end
351
-
352
- def get_prodict_template(id, options = nil)
353
- return @client.get__ecommerce__product_templates(id, options)
354
- end
355
-
356
- def create_prodict_template(data, options = nil)
357
- return @client.create__ecommerce__product_templates(data, options)
358
- end
359
-
360
- def update_product_template(id, data, options = nil)
361
- return @client.update__ecommerce__product_templates(id, data, options)
362
- end
363
-
364
-
365
- # === Get locations.
366
- # Get a collection of locations
367
- #
368
- # ==== Parameters
369
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
370
- def get_locations(options = nil)
371
- return @client.get__ecommerce__locations(options)
372
- end
373
-
374
- def get_location(id, options = nil)
375
- return @client.get__ecommerce__locations(id, options)
376
- end
377
-
378
- def create_location(data, options = nil)
379
- return @client.create__ecommerce__locations(data, options)
380
- end
381
-
382
- def update_location(id, data, options = nil)
383
- return @client.update__ecommerce__locations(id, data, options)
384
- end
385
-
386
- # === Get taxonomies.
387
- # Get a collection of taxonomies
388
- #
389
- # ==== Parameters
390
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
391
- def get_taxonomies(options = nil)
392
- return @client.get__config__taxonomies(options)
393
- end
394
-
395
- def get_taxonomy(id, options = nil)
396
- return @client.get__config__taxonomies(id, options)
397
- end
398
-
399
- def create_taxonomy(data, options = nil)
400
- return @client.create__config__taxonomies(data, options)
401
- end
402
-
403
- def update_taxonomy(id, data, options = nil)
404
- return @client.update__config__taxonomies(id, data, options)
405
- end
406
87
  end
407
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mints
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
- - Ruben Gomez Garcia, Omar Mora, Luis Payan
7
+ - Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-01 00:00:00.000000000 Z
11
+ date: 2021-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -120,6 +120,7 @@ files:
120
120
  - README.md
121
121
  - lib/client.rb
122
122
  - lib/contact.rb
123
+ - lib/generators/mints_assets_controller.rb
123
124
  - lib/generators/mints_config.yml.erb
124
125
  - lib/generators/mints_contact_controller.rb
125
126
  - lib/generators/mints_files_generator.rb
@@ -132,8 +133,68 @@ files:
132
133
  - lib/mints/controllers/contact_api_controller.rb
133
134
  - lib/mints/controllers/public_api_controller.rb
134
135
  - lib/mints/controllers/user_api_controller.rb
136
+ - lib/mints_helper.rb
135
137
  - lib/pub.rb
136
138
  - lib/user.rb
139
+ - lib/user/config/api_keys.rb
140
+ - lib/user/config/appointments.rb
141
+ - lib/user/config/attribute_groups.rb
142
+ - lib/user/config/attributes.rb
143
+ - lib/user/config/calendars.rb
144
+ - lib/user/config/config.rb
145
+ - lib/user/config/importers.rb
146
+ - lib/user/config/public_folders.rb
147
+ - lib/user/config/relationships.rb
148
+ - lib/user/config/roles.rb
149
+ - lib/user/config/seeds.rb
150
+ - lib/user/config/system_settings.rb
151
+ - lib/user/config/tags.rb
152
+ - lib/user/config/taxonomies.rb
153
+ - lib/user/config/teams.rb
154
+ - lib/user/config/users.rb
155
+ - lib/user/contacts/contacts.rb
156
+ - lib/user/content/assets.rb
157
+ - lib/user/content/content.rb
158
+ - lib/user/content/content_instances.rb
159
+ - lib/user/content/content_templates.rb
160
+ - lib/user/content/conversations.rb
161
+ - lib/user/content/dam.rb
162
+ - lib/user/content/forms.rb
163
+ - lib/user/content/message_templates.rb
164
+ - lib/user/content/messages.rb
165
+ - lib/user/content/pages.rb
166
+ - lib/user/content/stories.rb
167
+ - lib/user/content/story_templates.rb
168
+ - lib/user/crm/companies.rb
169
+ - lib/user/crm/contacts.rb
170
+ - lib/user/crm/crm.rb
171
+ - lib/user/crm/deals.rb
172
+ - lib/user/crm/favorites.rb
173
+ - lib/user/crm/segments.rb
174
+ - lib/user/crm/users.rb
175
+ - lib/user/crm/workflow_step_objects.rb
176
+ - lib/user/crm/workflow_steps.rb
177
+ - lib/user/crm/workflows.rb
178
+ - lib/user/ecommerce/ecommerce.rb
179
+ - lib/user/ecommerce/item_prices.rb
180
+ - lib/user/ecommerce/locations.rb
181
+ - lib/user/ecommerce/order_items_groups.rb
182
+ - lib/user/ecommerce/order_statuses.rb
183
+ - lib/user/ecommerce/orders.rb
184
+ - lib/user/ecommerce/price_lists.rb
185
+ - lib/user/ecommerce/product_templates.rb
186
+ - lib/user/ecommerce/product_variations.rb
187
+ - lib/user/ecommerce/products.rb
188
+ - lib/user/ecommerce/skus.rb
189
+ - lib/user/ecommerce/taxes.rb
190
+ - lib/user/ecommerce/variant_options.rb
191
+ - lib/user/ecommerce/variant_values.rb
192
+ - lib/user/helpers/helpers.rb
193
+ - lib/user/helpers/object_activities.rb
194
+ - lib/user/helpers/object_folders.rb
195
+ - lib/user/helpers/user_folders.rb
196
+ - lib/user/marketing/marketing.rb
197
+ - lib/user/profile/profile.rb
137
198
  homepage: https://github.com/rubengomez/mints-ruby-sdk
138
199
  licenses: []
139
200
  metadata: {}