mints 0.0.16 → 0.0.20

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