mints 0.0.17 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/lib/client.rb +96 -37
  4. data/lib/contact.rb +659 -94
  5. data/lib/generators/mints_files_generator.rb +6 -0
  6. data/lib/generators/mints_link.rb +61 -0
  7. data/lib/generators/short_link_controller.rb +41 -0
  8. data/lib/mints/controllers/admin_base_controller.rb +2 -2
  9. data/lib/mints/controllers/base_api_controller.rb +12 -11
  10. data/lib/mints/controllers/base_controller.rb +38 -9
  11. data/lib/mints_helper.rb +47 -0
  12. data/lib/pub.rb +258 -139
  13. data/lib/user/config/api_keys.rb +65 -0
  14. data/lib/user/config/appointments.rb +221 -0
  15. data/lib/user/config/attribute_groups.rb +77 -0
  16. data/lib/user/config/attributes.rb +86 -0
  17. data/lib/user/config/calendars.rb +89 -0
  18. data/lib/user/config/config.rb +65 -0
  19. data/lib/user/config/importers.rb +184 -0
  20. data/lib/user/config/public_folders.rb +108 -0
  21. data/lib/user/config/relationships.rb +138 -0
  22. data/lib/user/config/roles.rb +84 -0
  23. data/lib/user/config/seeds.rb +14 -0
  24. data/lib/user/config/system_settings.rb +53 -0
  25. data/lib/user/config/tags.rb +63 -0
  26. data/lib/user/config/taxonomies.rb +124 -0
  27. data/lib/user/config/teams.rb +70 -0
  28. data/lib/user/config/users.rb +76 -0
  29. data/lib/user/contacts/contacts.rb +21 -0
  30. data/lib/user/content/assets.rb +260 -0
  31. data/lib/user/content/content.rb +235 -0
  32. data/lib/user/content/content_instances.rb +147 -0
  33. data/lib/user/content/content_templates.rb +111 -0
  34. data/lib/user/content/conversations.rb +174 -0
  35. data/lib/user/content/dam.rb +88 -0
  36. data/lib/user/content/forms.rb +168 -0
  37. data/lib/user/content/message_templates.rb +162 -0
  38. data/lib/user/content/messages.rb +90 -0
  39. data/lib/user/content/pages.rb +81 -0
  40. data/lib/user/content/stories.rb +164 -0
  41. data/lib/user/content/story_templates.rb +95 -0
  42. data/lib/user/crm/companies.rb +111 -0
  43. data/lib/user/crm/contacts.rb +312 -0
  44. data/lib/user/crm/crm.rb +21 -0
  45. data/lib/user/crm/deals.rb +111 -0
  46. data/lib/user/crm/favorites.rb +17 -0
  47. data/lib/user/crm/segments.rb +132 -0
  48. data/lib/user/crm/users.rb +22 -0
  49. data/lib/user/crm/workflow_step_objects.rb +89 -0
  50. data/lib/user/crm/workflow_steps.rb +49 -0
  51. data/lib/user/crm/workflows.rb +70 -0
  52. data/lib/user/ecommerce/ecommerce.rb +29 -0
  53. data/lib/user/ecommerce/item_prices.rb +86 -0
  54. data/lib/user/ecommerce/locations.rb +166 -0
  55. data/lib/user/ecommerce/order_items_groups.rb +109 -0
  56. data/lib/user/ecommerce/order_statuses.rb +26 -0
  57. data/lib/user/ecommerce/orders.rb +258 -0
  58. data/lib/user/ecommerce/price_lists.rb +73 -0
  59. data/lib/user/ecommerce/product_templates.rb +104 -0
  60. data/lib/user/ecommerce/product_variations.rb +129 -0
  61. data/lib/user/ecommerce/products.rb +169 -0
  62. data/lib/user/ecommerce/skus.rb +88 -0
  63. data/lib/user/ecommerce/taxes.rb +82 -0
  64. data/lib/user/ecommerce/variant_options.rb +69 -0
  65. data/lib/user/ecommerce/variant_values.rb +72 -0
  66. data/lib/user/helpers/helpers.rb +113 -0
  67. data/lib/user/helpers/object_activities.rb +83 -0
  68. data/lib/user/helpers/object_folders.rb +82 -0
  69. data/lib/user/helpers/user_folders.rb +83 -0
  70. data/lib/user/marketing/marketing.rb +120 -0
  71. data/lib/user/profile/profile.rb +111 -0
  72. data/lib/user.rb +24 -368
  73. metadata +64 -2
data/lib/pub.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'yaml'
2
2
  require_relative './client.rb'
3
+ require_relative './mints_helper.rb'
4
+
3
5
  module Mints
4
6
  ##
5
7
  # == Public context API
@@ -70,39 +72,38 @@ module Mints
70
72
 
71
73
  class Pub
72
74
  attr_reader :client
73
-
74
75
  ##
75
76
  # === Initialize.
76
- # Class constructor
77
+ # Class constructor.
77
78
  #
78
79
  # ==== Parameters
79
- # * +host+ - [String] It's the visitor IP
80
- # * +api_key+ - [String] Mints instance api key
81
- # * +contact_token+ - [String] Cookie 'mints_contact_id' value (mints_contact_token)
80
+ # host:: (String) -- It's the visitor IP.
81
+ # api_key:: (String) -- Mints instance api key.
82
+ # contact_token_id:: (Integer) -- Cookie 'mints_contact_id' value (mints_contact_token).
83
+ #
82
84
  # ==== Return
83
- # Returns a Client object
84
- def initialize(host, api_key, contact_token_id = nil, debug = false)
85
- @client = Mints::Client.new(host, api_key, 'public', nil, contact_token_id, debug)
85
+ # Returns a Client object.
86
+ def initialize(host, api_key, contact_token_id = nil, visit_id = nil, debug = false)
87
+ @client = Mints::Client.new(host, api_key, 'public', nil, contact_token_id, visit_id, debug)
86
88
  end
87
89
 
88
90
  ##
89
91
  # === Register Visit.
90
- # Register a ghost/contact visit in Mints.Cloud
92
+ # Register a ghost/contact visit in Mints.Cloud.
91
93
  #
92
94
  # ==== Parameters
93
- # * +request+ - [ActionDispatch::Request] request
94
- # * +ip+ - [String] It's the visitor IP
95
- # * +user_agent+ - The visitor's browser user agent
96
- # * +url+ - [String] URL visited
95
+ # request:: (ActionDispatch::Request) -- request.
96
+ # ip:: (String) -- It's the visitor IP.
97
+ # user_agent:: (String) -- The visitor's browser user agent.
98
+ # url:: (String) -- URL visited.
97
99
  #
98
100
  # ==== Example
99
101
  # request = {
100
- # "remote_ip" => "http://864.401.156.12/",
102
+ # "remote_ip" => "http://1.1.1.1/",
101
103
  # "user_agent" => "User Agent",
102
- # "fullpath" => "https://mints.cloud/blog"
104
+ # "fullpath" => "https://fullpath/example"
103
105
  # }
104
- # @mints_pub.register_visit(request, request["remote_ip"], request["user_agent"], request["fullpath"])
105
- #
106
+ # @data = @mints_pub.register_visit(request, request["remote_ip"], request["user_agent"], request["fullpath"])
106
107
  def register_visit(request, ip = nil, user_agent = nil, url = nil)
107
108
  data = {
108
109
  ip_address: ip || request.remote_ip,
@@ -115,45 +116,57 @@ module Mints
115
116
 
116
117
  ##
117
118
  # === Register Visit timer.
118
- # Register a page visit time
119
+ # Register a page visit time.
119
120
  #
120
121
  # ==== Parameters
121
- # * +visit+ - [String] It's the visitor IP
122
- # * +time+ - [Integer] The visitor's browser user agent
122
+ # visit:: (String) -- It's the visitor IP.
123
+ # time:: (Integer) -- The visitor's browser user agent.
123
124
  #
124
125
  # ==== Example
125
- # @mints_pub.register_visit_timer("60da2325d29acc7e55684472", 4)
126
- #
126
+ # @data = @mints_pub.register_visit_timer("60da2325d29acc7e55684472", 4)
127
127
  def register_visit_timer(visit, time)
128
128
  return @client.raw("get", "/register-visit-timer?visit=#{visit}&time=#{time}")
129
129
  end
130
130
 
131
+ ### V1/CONTENT ###
132
+
131
133
  ##
132
134
  # === Get Asset Info.
133
- # Get a description of an Asset
135
+ # Get a description of an Asset.
134
136
  #
135
137
  # ==== Parameters
136
- # * +slug+ - [String] It's the string identifier of the asset.
138
+ # slug:: (String) -- It's the string identifier of the asset.
137
139
  #
138
140
  # ==== Example
139
- # @mints_pub.get_asset_info("quaerat")
140
- #
141
+ # @data = @mints_pub.get_asset_info("asset_slug")
141
142
  def get_asset_info(slug)
142
143
  return @client.raw("get", "/content/asset-info/#{slug}")
143
144
  end
144
-
145
+
145
146
  ##
146
147
  # === Get Stories.
147
- # Get a collection of stories
148
+ # Get a collection of stories.
148
149
  #
149
150
  # ==== Parameters
150
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
151
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
152
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
151
153
  #
152
- # ==== Example
153
- # @mints_pub.get_stories
154
+ # ==== First Example
155
+ # @data = @mints_pub.get_stories
154
156
  #
155
- def get_stories(options = nil)
156
- return @client.raw("get", "/content/stories", options)
157
+ # ==== Second Example
158
+ # options = {
159
+ # "fields": "id, title"
160
+ # }
161
+ # @data = @mints_pub.get_stories(options)
162
+ #
163
+ # ==== Third Example
164
+ # options = {
165
+ # "fields": "id, title"
166
+ # }
167
+ # @data = @mints_pub.get_stories(options, false)
168
+ def get_stories(options = nil, use_post = true)
169
+ return get_query_results("/content/stories", options, use_post)
157
170
  end
158
171
 
159
172
  ##
@@ -161,28 +174,26 @@ module Mints
161
174
  # Get a single story.
162
175
  #
163
176
  # ==== Parameters
164
- # * +slug+ - [String] It's the string identifier generated by Mints
165
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
177
+ # slug:: (String) -- It's the string identifier generated by Mints.
178
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
166
179
  #
167
- # ==== Example
168
- # @mints_pub.get_story("getting-ready-for-e3")
180
+ # ==== First Example
181
+ # @data = @mints_pub.get_story("story_slug")
169
182
  #
183
+ # ==== Second Example
184
+ # @data = @mints_pub.get_story("story_slug", options.to_json)
170
185
  def get_story(slug, options = nil)
171
- return @client.raw("get", "/content/stories/#{slug}", options)
186
+ return @client.raw("get", "/content/stories/#{slug}", options, nil, nil, nil, true)
172
187
  end
173
188
 
174
189
  ##
175
190
  # === Get Forms.
176
- # Get a collection of forms
177
- #
178
- # ==== Parameters
179
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
191
+ # Get a collection of forms.
180
192
  #
181
193
  # ==== Example
182
- # @mints_pub.get_forms
183
- #
184
- def get_forms(options = nil)
185
- return @client.raw("get", "/content/forms", options)
194
+ # @data = @mints_pub.get_forms
195
+ def get_forms
196
+ return @client.raw("get", "/content/forms")
186
197
  end
187
198
 
188
199
  ##
@@ -190,35 +201,33 @@ module Mints
190
201
  # Get a single form.
191
202
  #
192
203
  # ==== Parameters
193
- # * +slug+ - [String] It's the string identifier generated by Mints
194
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
204
+ # slug:: (String) -- It's the string identifier generated by Mints.
195
205
  #
196
206
  # ==== Example
197
- # @mints_pub.get_form("survey")
198
- #
199
- def get_form(slug, options = nil)
200
- return @client.raw("get", "/content/forms/#{slug}", options)
207
+ # @data = @mints_pub.get_form("form_slug")
208
+ def get_form(slug)
209
+ return @client.raw("get", "/content/forms/#{slug}", nil, nil, nil, nil, true)
201
210
  end
202
211
 
203
212
  ##
204
213
  # === Submit Form.
205
- # Submit a form.
214
+ # Submit a form with data.
206
215
  #
207
216
  # ==== Parameters
208
- # * +data+ - [Hash] Data to be submited
217
+ # data:: (Hash) -- Data to be submited.
209
218
  #
210
219
  # ==== Example
211
- # data_form = {
212
- # "data": {
213
- # 'form_slug': 'formulario',
214
- # 'email': 'oscar@mints.cloud',
215
- # 'ingrese-un-texto': 'hola'
216
- # }
220
+ # data = {
221
+ # 'form_slug': 'form_slug',
222
+ # 'email': 'email@example.com',
223
+ # 'given_name': 'given_name',
224
+ # 'f1': 'Field 1 answer',
225
+ # 'f2': 'Field 2 answer',
226
+ # 'f3': 'Field 3 answer'
217
227
  # }
218
- # @mints_pub.submit_form(data_form.to_json)
219
- #
228
+ # @data = @mints_pub.submit_form(data)
220
229
  def submit_form(data)
221
- return @client.raw("post", "/content/forms/submit", nil, data)
230
+ return @client.raw("post", "/content/forms/submit", nil, data_transform(data))
222
231
  end
223
232
 
224
233
  ##
@@ -226,8 +235,21 @@ module Mints
226
235
  # Get a collection of content instances. _Note:_ Options must be specified.
227
236
  #
228
237
  # ==== Parameters
229
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
230
- def get_content_instances(options = nil)
238
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
239
+ #
240
+ # ==== First Example
241
+ # options = {
242
+ # "template": "content_instance_template_slug"
243
+ # }
244
+ # @data = @mints_pub.get_content_instances(options)
245
+ #
246
+ # ==== Second Example
247
+ # options = {
248
+ # "template": "content_instance_template_slug",
249
+ # "sort": "-id"
250
+ # }
251
+ # @data = @mints_pub.get_content_instances(options)
252
+ def get_content_instances(options)
231
253
  return @client.raw("get", "/content/content-instances", options)
232
254
  end
233
255
 
@@ -236,67 +258,82 @@ module Mints
236
258
  # Get a single content instance.
237
259
  #
238
260
  # ==== Parameters
239
- # * +slug+ - [String] It's the string identifier generated by Mints
240
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
261
+ # slug:: (String) -- It's the string identifier generated by Mints.
241
262
  #
242
263
  # ==== Example
243
- # @mints_pub.get_content_instance("bill-gates")
244
- #
245
- def get_content_instance(slug, options = nil)
246
- return @client.raw("get", "/content/content-instances/#{slug}", options)
264
+ # @data = @mints_pub.get_content_instance("content_instance_slug")
265
+ def get_content_instance(slug)
266
+ return @client.raw("get", "/content/content-instances/#{slug}")
247
267
  end
248
268
 
269
+ #Note: This method is commented for future use
249
270
  ##
250
271
  # === Get Content Pages.
251
272
  # Get all content pages.
252
273
  #
253
274
  # ==== Parameters
254
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
255
- def get_content_pages(options = nil)
256
- return @client.raw("get", "/content/content-pages", options)
257
- end
275
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
276
+ # def get_content_pages(options = nil)
277
+ #return @client.raw("get", "/content/content-pages", options)
278
+ #end
258
279
 
259
280
  ##
260
281
  # === Get Content Page.
261
- # Get a single content page
282
+ # Get a single content page.
262
283
  #
263
284
  # ==== Parameters
264
- # * +slug+ - [String] It's the slug
265
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
285
+ # slug:: (String) -- It's the string identifier generated by Mints.
266
286
  #
267
287
  # ==== Example
268
- # @mints_pub.get_content_page("test-page")
269
- #
270
- def get_content_page(slug, options = nil)
271
- return @client.raw("get", "/content/content-pages/#{slug}", options)
288
+ # @data = @mints_pub.get_content_page("test-page")
289
+ def get_content_page(slug)
290
+ return @client.raw("get", "/content/content-pages/#{slug}", nil, nil, nil, nil, true)
272
291
  end
273
292
 
293
+ ### V1/ECOMMERCE ###
294
+
274
295
  ##
275
296
  # === Get Locations.
276
297
  # Get all locations.
277
298
  #
278
299
  # ==== Parameters
279
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
300
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
301
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
280
302
  #
281
- # ==== Example
282
- # @mints_pub.get_locations
303
+ # ==== First Example
304
+ # @data = @mints_pub.get_locations
283
305
  #
284
- def get_locations(options = nil)
285
- return @client.raw("get", "/ecommerce/locations", options)
306
+ # ==== Second Example
307
+ # options = { "fields": "title" }
308
+ # @data = @mints_pub.get_locations(options)
309
+ #
310
+ # ==== Third Example
311
+ # options = { "fields": "title" }
312
+ # @data = @mints_pub.get_locations(options, false)
313
+ def get_locations(options = nil, use_post = true)
314
+ return get_query_results("/ecommerce/locations", options, use_post)
286
315
  end
287
-
316
+
288
317
  ##
289
318
  # === Get Products.
290
319
  # Get a collection of products.
291
320
  #
292
321
  # ==== Parameters
293
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
322
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
323
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
294
324
  #
295
- # ==== Example
296
- # @mints_pub.get_products
325
+ # ==== First Example
326
+ # @data = @mints_pub.get_products
327
+ #
328
+ # ==== Second Example
329
+ # options = { "fields": "title" }
330
+ # @data = @mints_pub.get_products(options)
297
331
  #
298
- def get_products(options = nil)
299
- return @client.raw("get", "/ecommerce/products", options)
332
+ # ==== Third Example
333
+ # options = { "fields": "title" }
334
+ # @data = @mints_pub.get_products(options, false)
335
+ def get_products(options = nil, use_post = true)
336
+ return get_query_results("/ecommerce/products", options, use_post)
300
337
  end
301
338
 
302
339
  ##
@@ -304,48 +341,69 @@ module Mints
304
341
  # Get a single product.
305
342
  #
306
343
  # ==== Parameters
307
- # * +slug+ - [String] It's the string identifier generated by Mints
308
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
344
+ # slug:: (String) -- It's the string identifier generated by Mints.
345
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
309
346
  #
310
- # ==== Example
311
- # @mints_pub.get_product("batman-shirt")
347
+ # ==== First Example
348
+ # @data = @mints_pub.get_product("product_slug")
312
349
  #
350
+ # ==== Second Example
351
+ # options = {
352
+ # "fields": "id, slug"
353
+ # }
354
+ # @data = @mints_pub.get_product("lego-set", options)
313
355
  def get_product(slug, options = nil)
314
- return @client.raw("get", "/ecommerce/products/#{slug}", options)
356
+ return @client.raw("get", "/ecommerce/products/#{slug}", options, nil, nil, nil, true)
315
357
  end
316
358
 
359
+ ### V1/CONFIG ###
360
+
317
361
  ##
318
- # === Get categories.
319
- # Get a collection of categories.
362
+ # === Get Public Folders.
363
+ # Get a collection of public folders.
320
364
  #
321
365
  # ==== Parameters
322
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
366
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
323
367
  #
324
- # ==== Example
368
+ # ==== First Example
325
369
  # options = {
326
- # "object_type": "stories"
370
+ # "object_type": "products"
371
+ # }
372
+ # @data = @mints_pub.get_public_folders(options)
373
+ #
374
+ # ==== Second Example
375
+ # options = {
376
+ # "object_type": "products",
377
+ # "fields": "id",
378
+ # "sort": "-id"
327
379
  # }
328
- # @mints_pub.get_categories(options)
329
- def get_categories(options = nil)
330
- return @client.raw("get", "/config/categories", options)
380
+ # @data = @mints_pub.get_public_folders(options)
381
+ def get_public_folders(options)
382
+ return @client.raw("get", "/config/public-folders", options)
331
383
  end
332
384
 
333
385
  ##
334
- # === Get Category.
335
- # Get a single category
386
+ # === Get Public Folder.
387
+ # Get a public folder info.
336
388
  #
337
389
  # ==== Parameters
338
- # * +slug+ - [String] It's the string identifier generated by Mints
339
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
390
+ # slug:: (String) -- It's the string identifier generated by Mints.
391
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
340
392
  #
341
- # ==== Example
393
+ # ==== First Example
342
394
  # options = {
343
- # "object_type": "locations"
395
+ # "object_type": "products"
344
396
  # }
345
- # @mints_pub.get_category("atm", options)
397
+ # @data = @mints_pub.get_public_folder('yellow', options)
346
398
  #
347
- def get_category(slug, options = nil)
348
- return @client.raw("get", "/config/categories/#{slug}", options)
399
+ # ==== Second Example
400
+ # options = {
401
+ # "object_type": "products",
402
+ # "fields": "id, title"
403
+ # }
404
+ # @data = @mints_pub.get_public_folder('yellow', options)
405
+ def get_public_folder(slug, options)
406
+ return @client.raw("get", "/config/public-folders/#{slug}", options)
349
407
  end
350
408
 
351
409
  ##
@@ -353,55 +411,82 @@ module Mints
353
411
  # Get a collection of tags.
354
412
  #
355
413
  # ==== Parameters
356
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
414
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
357
415
  #
358
- # ==== Example
359
- # @mints_pub.get_tags
416
+ # ==== First Example
417
+ # @data = @mints_pub.get_tags
360
418
  #
419
+ # ==== Second Example
420
+ # options = {
421
+ # "fields": "id, tag"
422
+ # }
423
+ # @data = @mints_pub.get_tags(options)
361
424
  def get_tags(options = nil)
362
425
  return @client.raw("get", "/config/tags", options)
363
426
  end
364
427
 
365
428
  ##
366
429
  # === Get Tag.
367
- # Get a single tag
430
+ # Get a single tag.
368
431
  #
369
432
  # ==== Parameters
370
- # * +slug+ - [String] It's the string identifier generated by Mints
371
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
433
+ # slug:: (String) -- It's the string identifier generated by Mints.
434
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
372
435
  #
373
- # ==== Example
374
- # @mints_pub.get_tag("ad-0")
436
+ # ==== First Example
437
+ # @data = @mints_pub.get_tag("tag_slug")
375
438
  #
439
+ # ==== Second Example
440
+ # options = {
441
+ # "fields": "id, tag"
442
+ # }
443
+ # @data = @mints_pub.get_tag("velit-0", options)
376
444
  def get_tag(slug, options = nil)
377
445
  return @client.raw("get", "/config/tags/#{slug}", options)
378
446
  end
379
-
447
+
380
448
  ##
381
449
  # === Get Taxonomies.
382
450
  # Get a collection of taxonomies.
383
451
  #
384
452
  # ==== Parameters
385
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
453
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
454
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
386
455
  #
387
- # ==== Example
388
- # @mints_pub.get_taxonomies
456
+ # ==== First Example
457
+ # @data = @mints_pub.get_taxonomies
389
458
  #
390
- def get_taxonomies(options = nil)
391
- return @client.raw("get", "/config/taxonomies", options)
459
+ # ==== Second Example
460
+ # options = {
461
+ # "fields": "id, title"
462
+ # }
463
+ # @data = @mints_pub.get_taxonomies(options)
464
+ #
465
+ # ==== Third Example
466
+ # options = {
467
+ # "fields": "id, title"
468
+ # }
469
+ # @data = @mints_pub.get_taxonomies(options, false)
470
+ def get_taxonomies(options = nil, use_post = true)
471
+ return get_query_results("/config/taxonomies", options, use_post)
392
472
  end
393
473
 
394
474
  ##
395
475
  # === Get Taxonomy.
396
- # Get a single taxonomy
476
+ # Get a single taxonomy.
397
477
  #
398
478
  # ==== Parameters
399
- # * +slug+ - [String] It's the string identifier generated by Mints
400
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
479
+ # slug:: (String) -- It's the string identifier generated by Mints.
480
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
401
481
  #
402
- # ==== Example
403
- # @mints_pub.get_taxonomy("unit_pricing_measure")
482
+ # ==== First Example
483
+ # @data = @mints_pub.get_taxonomy("taxonomy_slug")
404
484
  #
485
+ # ==== Second Example
486
+ # options = {
487
+ # "fields": "title"
488
+ # }
489
+ # @data = @mints_pub.get_taxonomy("taxonomy_slug", options)
405
490
  def get_taxonomy(slug, options = nil)
406
491
  return @client.raw("get", "/config/taxonomies/#{slug}", options)
407
492
  end
@@ -410,14 +495,48 @@ module Mints
410
495
  # === Get Attributes.
411
496
  # Get a collection of attributes.
412
497
  #
498
+ # ==== Example
499
+ # @data = @mints_pub.get_attributes
500
+ def get_attributes
501
+ return @client.raw("get", "/config/attributes")
502
+ end
503
+
504
+ # Methods deleted
505
+ ##
506
+ # === Get categories.
507
+ # Get a collection of categories.
508
+ #
413
509
  # ==== Parameters
414
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
510
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
415
511
  #
416
512
  # ==== Example
417
- # @mints_pub.get_attributes
513
+ # options = {
514
+ # "object_type": "stories"
515
+ # }
516
+ # @data = @mints_pub.get_categories(options)
517
+ #def get_categories(options = nil)
518
+ # return @client.raw("get", "/config/categories", options)
519
+ #end
520
+
521
+ ##
522
+ # === Get Category.
523
+ # Get a single category.
418
524
  #
419
- def get_attributes(options = nil)
420
- return @client.raw("get", "/config/attributes", options)
421
- end
525
+ # ==== Parameters
526
+ # slug:: (String) -- It's the string identifier generated by Mints.
527
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
528
+ #
529
+ # ==== Example
530
+ # options = {
531
+ # "object_type": "locations"
532
+ # }
533
+ # @data = @mints_pub.get_category("asset_slug", options)
534
+ #def get_category(slug, options = nil)
535
+ # return @client.raw("get", "/config/categories/#{slug}", options)
536
+ #end
537
+
538
+ private
539
+
540
+ include MintsHelper
422
541
  end
423
542
  end