mints 0.0.28 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/lib/client.rb +287 -385
  3. data/lib/contact/config/appointments.rb +201 -0
  4. data/lib/contact/config/config.rb +7 -0
  5. data/lib/contact/content/content.rb +7 -0
  6. data/lib/contact/content/conversations.rb +121 -0
  7. data/lib/contact/ecommerce/ecommerce.rb +14 -0
  8. data/lib/contact/ecommerce/order_items.rb +19 -0
  9. data/lib/contact/ecommerce/order_items_groups.rb +95 -0
  10. data/lib/contact/ecommerce/orders.rb +132 -0
  11. data/lib/contact/ecommerce/vouchers.rb +18 -0
  12. data/lib/contact.rb +54 -603
  13. data/lib/errors.rb +4 -2
  14. data/lib/generators/mints_assets_controller.rb +4 -1
  15. data/lib/generators/mints_contact_controller.rb +4 -1
  16. data/lib/generators/mints_files_generator.rb +16 -13
  17. data/lib/generators/mints_link.rb +7 -4
  18. data/lib/generators/mints_public_controller.rb +4 -1
  19. data/lib/generators/mints_user_controller.rb +3 -0
  20. data/lib/generators/short_link_controller.rb +4 -1
  21. data/lib/mints/controllers/admin_base_controller.rb +5 -3
  22. data/lib/mints/controllers/base_api_controller.rb +6 -4
  23. data/lib/mints/controllers/base_controller.rb +5 -3
  24. data/lib/mints/controllers/concerns/mints_clients.rb +4 -2
  25. data/lib/mints/controllers/concerns/read_config_file.rb +3 -1
  26. data/lib/mints/controllers/contact_api_controller.rb +12 -10
  27. data/lib/mints/controllers/public_api_controller.rb +10 -8
  28. data/lib/mints/controllers/user_api_controller.rb +11 -9
  29. data/lib/mints/helpers/contact_auth_helper.rb +5 -3
  30. data/lib/mints/helpers/mints_helper.rb +39 -38
  31. data/lib/mints/helpers/proxy_controllers_methods.rb +24 -24
  32. data/lib/mints/helpers/user_auth_helper.rb +5 -3
  33. data/lib/mints.rb +12 -10
  34. data/lib/pub/config/attributes.rb +13 -0
  35. data/lib/pub/config/config.rb +15 -0
  36. data/lib/pub/config/public_folders.rb +51 -0
  37. data/lib/pub/config/tags.rb +42 -0
  38. data/lib/pub/config/taxonomies.rb +49 -0
  39. data/lib/pub/content/assets.rb +16 -0
  40. data/lib/pub/content/content.rb +22 -0
  41. data/lib/pub/content/content_bundles.rb +40 -0
  42. data/lib/pub/content/content_instance_versions.rb +56 -0
  43. data/lib/pub/content/content_instances.rb +37 -0
  44. data/lib/pub/content/forms.rb +47 -0
  45. data/lib/pub/content/stories.rb +44 -0
  46. data/lib/pub/content/story_versions.rb +46 -0
  47. data/lib/pub/ecommerce/ecommerce.rb +14 -0
  48. data/lib/pub/ecommerce/locations.rb +25 -0
  49. data/lib/pub/ecommerce/orders.rb +31 -0
  50. data/lib/pub/ecommerce/products.rb +45 -0
  51. data/lib/pub.rb +22 -461
  52. data/lib/user/config/api_keys.rb +63 -61
  53. data/lib/user/config/appointments.rb +217 -215
  54. data/lib/user/config/attribute_groups.rb +74 -72
  55. data/lib/user/config/attributes.rb +83 -81
  56. data/lib/user/config/calendars.rb +88 -86
  57. data/lib/user/config/config.rb +31 -63
  58. data/lib/user/config/public_folders.rb +105 -104
  59. data/lib/user/config/relationships.rb +135 -132
  60. data/lib/user/config/roles.rb +76 -79
  61. data/lib/user/config/seeds.rb +52 -51
  62. data/lib/user/config/system_settings.rb +50 -49
  63. data/lib/user/config/tags.rb +57 -59
  64. data/lib/user/config/taxonomies.rb +115 -119
  65. data/lib/user/config/teams.rb +2 -0
  66. data/lib/user/config/users.rb +2 -0
  67. data/lib/user/contacts/contacts.rb +2 -0
  68. data/lib/user/content/assets.rb +3 -3
  69. data/lib/user/content/content.rb +224 -223
  70. data/lib/user/content/content_instances.rb +4 -2
  71. data/lib/user/content/content_templates.rb +2 -0
  72. data/lib/user/content/conversations.rb +2 -0
  73. data/lib/user/content/dam.rb +2 -0
  74. data/lib/user/content/forms.rb +2 -0
  75. data/lib/user/content/message_templates.rb +2 -0
  76. data/lib/user/content/messages.rb +2 -0
  77. data/lib/user/content/pages.rb +4 -2
  78. data/lib/user/content/stories.rb +3 -3
  79. data/lib/user/content/story_templates.rb +5 -3
  80. data/lib/user/content/story_versions.rb +2 -0
  81. data/lib/user/crm/companies.rb +3 -1
  82. data/lib/user/crm/contacts.rb +2 -0
  83. data/lib/user/crm/crm.rb +2 -0
  84. data/lib/user/crm/deals.rb +2 -0
  85. data/lib/user/crm/favorites.rb +2 -0
  86. data/lib/user/crm/segments.rb +2 -0
  87. data/lib/user/crm/users.rb +2 -0
  88. data/lib/user/crm/workflow_step_objects.rb +2 -0
  89. data/lib/user/crm/workflow_steps.rb +2 -0
  90. data/lib/user/crm/workflows.rb +2 -0
  91. data/lib/user/ecommerce/ecommerce.rb +4 -0
  92. data/lib/user/ecommerce/item_prices.rb +2 -0
  93. data/lib/user/ecommerce/locations.rb +4 -2
  94. data/lib/user/ecommerce/order_items_groups.rb +5 -2
  95. data/lib/user/ecommerce/order_statuses.rb +2 -0
  96. data/lib/user/ecommerce/orders.rb +4 -1
  97. data/lib/user/ecommerce/price_lists.rb +2 -0
  98. data/lib/user/ecommerce/product_templates.rb +3 -1
  99. data/lib/user/ecommerce/product_variations.rb +2 -0
  100. data/lib/user/ecommerce/products.rb +3 -1
  101. data/lib/user/ecommerce/skus.rb +2 -0
  102. data/lib/user/ecommerce/taxes.rb +2 -0
  103. data/lib/user/ecommerce/variant_options.rb +2 -0
  104. data/lib/user/ecommerce/variant_values.rb +2 -0
  105. data/lib/user/ecommerce/vouchers.rb +90 -0
  106. data/lib/user/helpers/helpers.rb +2 -0
  107. data/lib/user/helpers/object_activities.rb +2 -0
  108. data/lib/user/helpers/object_folders.rb +2 -0
  109. data/lib/user/helpers/user_folders.rb +2 -0
  110. data/lib/user/marketing/marketing.rb +2 -0
  111. data/lib/user/profile/profile.rb +2 -0
  112. data/lib/user.rb +32 -41
  113. metadata +42 -16
  114. data/lib/user/config/importers.rb +0 -184
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PublicFolders
4
+ ##
5
+ # === Get Public Folders.
6
+ # Get a collection of public folders.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
10
+ #
11
+ # ==== First Example
12
+ # options = {
13
+ # object_type: "products"
14
+ # }
15
+ # @data = @mints_pub.get_public_folders(options)
16
+ #
17
+ # ==== Second Example
18
+ # options = {
19
+ # object_type: "products",
20
+ # fields: "id",
21
+ # sort: "-id"
22
+ # }
23
+ # @data = @mints_pub.get_public_folders(options)
24
+ def get_public_folders(options = nil)
25
+ @client.raw('get', '/config/public-folders', options)
26
+ end
27
+
28
+ ##
29
+ # === Get Public Folder.
30
+ # Get a public folder info.
31
+ #
32
+ # ==== Parameters
33
+ # slug:: (String) -- It's the string identifier generated by Mints.
34
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
35
+ #
36
+ # ==== First Example
37
+ # options = {
38
+ # object_type: "products"
39
+ # }
40
+ # @data = @mints_pub.get_public_folder('yellow', options)
41
+ #
42
+ # ==== Second Example
43
+ # options = {
44
+ # object_type: "products",
45
+ # fields: 'id, title'
46
+ # }
47
+ # @data = @mints_pub.get_public_folder('yellow', options)
48
+ def get_public_folder(slug, options)
49
+ @client.raw('get', "/config/public-folders/#{slug}", options)
50
+ end
51
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tags
4
+ ##
5
+ # === Get Tags.
6
+ # Get a collection of tags.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
10
+ #
11
+ # ==== First Example
12
+ # @data = @mints_pub.get_tags
13
+ #
14
+ # ==== Second Example
15
+ # options = {
16
+ # fields: "id, tag"
17
+ # }
18
+ # @data = @mints_pub.get_tags(options)
19
+ def get_tags(options = nil)
20
+ @client.raw('get', '/config/tags', options)
21
+ end
22
+
23
+ ##
24
+ # === Get Tag.
25
+ # Get a single tag.
26
+ #
27
+ # ==== Parameters
28
+ # slug:: (String) -- It's the string identifier generated by Mints.
29
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
30
+ #
31
+ # ==== First Example
32
+ # @data = @mints_pub.get_tag("tag_slug")
33
+ #
34
+ # ==== Second Example
35
+ # options = {
36
+ # fields: "id, tag"
37
+ # }
38
+ # @data = @mints_pub.get_tag("tag-example", options)
39
+ def get_tag(slug, options = nil)
40
+ @client.raw('get', "/config/tags/#{slug}", options)
41
+ end
42
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Taxonomies
4
+ ##
5
+ # === Get Taxonomies.
6
+ # Get a collection of taxonomies.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
10
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
11
+ #
12
+ # ==== First Example
13
+ # @data = @mints_pub.get_taxonomies
14
+ #
15
+ # ==== Second Example
16
+ # options = {
17
+ # fields: 'id, title'
18
+ # }
19
+ # @data = @mints_pub.get_taxonomies(options)
20
+ #
21
+ # ==== Third Example
22
+ # options = {
23
+ # fields: 'id, title'
24
+ # }
25
+ # @data = @mints_pub.get_taxonomies(options, false)
26
+ def get_taxonomies(options = nil, use_post = true)
27
+ get_query_results('/config/taxonomies', options, use_post)
28
+ end
29
+
30
+ ##
31
+ # === Get Taxonomy.
32
+ # Get a single taxonomy.
33
+ #
34
+ # ==== Parameters
35
+ # slug:: (String) -- It's the string identifier generated by Mints.
36
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
37
+ #
38
+ # ==== First Example
39
+ # @data = @mints_pub.get_taxonomy('taxonomy_slug')
40
+ #
41
+ # ==== Second Example
42
+ # options = {
43
+ # fields: 'title'
44
+ # }
45
+ # @data = @mints_pub.get_taxonomy('taxonomy_slug', options)
46
+ def get_taxonomy(slug, options = nil)
47
+ @client.raw('get', "/config/taxonomies/#{slug}", options)
48
+ end
49
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Assets
4
+ ##
5
+ # === Get Asset Info.
6
+ # Get a description of an Asset.
7
+ #
8
+ # ==== Parameters
9
+ # slug:: (String) -- It's the string identifier of the asset.
10
+ #
11
+ # ==== Example
12
+ # @data = @mints_pub.get_asset_info("asset_slug")
13
+ def get_asset_info(slug)
14
+ @client.raw('get', "/content/asset-info/#{slug}")
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ ### V1/CONTENT ###
4
+
5
+ require_relative './assets'
6
+ require_relative './content_bundles'
7
+ require_relative './content_instance_versions'
8
+ require_relative './content_instances'
9
+ require_relative './forms'
10
+ require_relative './stories'
11
+ require_relative './story_versions'
12
+
13
+ module Content
14
+ include Assets
15
+ include ContentBundles
16
+ include ContentInstanceVersions
17
+ include ContentInstances
18
+ include Forms
19
+ include Stories
20
+ include StoryVersions
21
+
22
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContentBundles
4
+ ##
5
+ # === Get Content Pages.
6
+ # Get all content pages.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
10
+ def get_content_bundles(options = nil)
11
+ @client.raw('get', '/content/content-bundles', options)
12
+ end
13
+
14
+ ##
15
+ # === Get Content Page.
16
+ # Get a single content page.
17
+ #
18
+ # ==== Parameters
19
+ # slug:: (String) -- It's the string identifier generated by Mints.
20
+ #
21
+ # ==== Example
22
+ # @data = @mints_pub.get_content_page("test-page")
23
+ def get_content_page(slug, options = nil)
24
+ warn '[DEPRECATED] The get_content_page method is deprecated and will be removed in the future, use get_content_bundle instead'
25
+ @client.raw('get', "/content/content-pages/#{slug}", options)
26
+ end
27
+
28
+ ##
29
+ # === Get Content Bundle.
30
+ # Get a single content bundle.
31
+ #
32
+ # ==== Parameters
33
+ # slug:: (String) -- It's the string identifier generated by Mints.
34
+ #
35
+ # ==== Example
36
+ # @data = @mints_pub.get_content_bundle("test-page")
37
+ def get_content_bundle(slug, options = nil)
38
+ @client.raw('get', "/content/content-bundles/#{slug}", options)
39
+ end
40
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContentInstanceVersions
4
+ ##
5
+ # === Get Content Instance Versions.
6
+ # Get a collection of content instance versions.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
10
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
11
+ #
12
+ # ==== First Example
13
+ # @data = @mints_pub.get_content_instance_versions
14
+ #
15
+ # ==== Second Example
16
+ # options = {
17
+ # fields: 'id, title'
18
+ # }
19
+ # @data = @mints_pub.get_content_instance_versions(options)
20
+ #
21
+ # ==== Third Example
22
+ # options = {
23
+ # fields: 'id, title'
24
+ # }
25
+ # @data = @mints_pub.get_content_instance_versions(options, false)
26
+ def get_content_instance_versions(options = nil)
27
+ unless options&.[](:template) || options&.[]('template')
28
+ raise Mints::Errors::DynamicError.new(
29
+ self,
30
+ 'Error 422 | Missing required fields, see the details for more information',
31
+ 'Add the template option, example { template: slug }',
32
+ 422,
33
+ { template: ['The template option is required'] }
34
+ )
35
+ end
36
+
37
+ @client.raw('get', '/content/content-instance-versions', options)
38
+ end
39
+
40
+ ##
41
+ # === Get Content Instance Version.
42
+ # Get a single content instance version.
43
+ #
44
+ # ==== Parameters
45
+ # slug:: (String) -- It's the string identifier generated by Mints.
46
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
47
+ #
48
+ # ==== First Example
49
+ # @data = @mints_pub.get_content_instance_version('content_instance_version_slug')
50
+ #
51
+ # ==== Second Example
52
+ # @data = @mints_pub.get_content_instance_version('content_instance_version_slug', options)
53
+ def get_content_instance_version(slug, options = nil)
54
+ @client.raw('get', "/content/content-instance-versions/#{slug}", options)
55
+ end
56
+ end
@@ -0,0 +1,37 @@
1
+ module ContentInstances
2
+ ##
3
+ # === Get Content Instances.
4
+ # Get a collection of content instances. _Note:_ Options must be specified.
5
+ #
6
+ # ==== Parameters
7
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
8
+ #
9
+ # ==== First Example
10
+ # options = {
11
+ # "template": "content_instance_template_slug"
12
+ # }
13
+ # @data = @mints_pub.get_content_instances(options)
14
+ #
15
+ # ==== Second Example
16
+ # options = {
17
+ # "template": "content_instance_template_slug",
18
+ # sort: "-id"
19
+ # }
20
+ # @data = @mints_pub.get_content_instances(options)
21
+ def get_content_instances(options = nil)
22
+ @client.raw('get', '/content/content-instances', options)
23
+ end
24
+
25
+ ##
26
+ # === Get Content Instance.
27
+ # Get a single content instance.
28
+ #
29
+ # ==== Parameters
30
+ # slug:: (String) -- It's the string identifier generated by Mints.
31
+ #
32
+ # ==== Example
33
+ # @data = @mints_pub.get_content_instance("content_instance_slug")
34
+ def get_content_instance(slug)
35
+ @client.raw('get', "/content/content-instances/#{slug}")
36
+ end
37
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Forms
4
+ ##
5
+ # === Get Forms.
6
+ # Get a collection of forms.
7
+ #
8
+ # ==== Example
9
+ # @data = @mints_pub.get_forms
10
+ def get_forms(options = nil)
11
+ @client.raw('get', '/content/forms', options)
12
+ end
13
+
14
+ ##
15
+ # === Get Form.
16
+ # Get a single form.
17
+ #
18
+ # ==== Parameters
19
+ # slug:: (String) -- It's the string identifier generated by Mints.
20
+ #
21
+ # ==== Example
22
+ # @data = @mints_pub.get_form("form_slug")
23
+ def get_form(slug, options = nil)
24
+ @client.raw('get', "/content/forms/#{slug}", options)
25
+ end
26
+
27
+ ##
28
+ # === Submit Form.
29
+ # Submit a form with data.
30
+ #
31
+ # ==== Parameters
32
+ # data:: (Hash) -- Data to be submitted.
33
+ #
34
+ # ==== Example
35
+ # data = {
36
+ # 'form_slug': 'form_slug',
37
+ # 'email': 'email@example.com',
38
+ # 'given_name': 'given_name',
39
+ # 'f1': 'Field 1 answer',
40
+ # 'f2': 'Field 2 answer',
41
+ # 'f3': 'Field 3 answer'
42
+ # }
43
+ # @data = @mints_pub.submit_form(data)
44
+ def submit_form(data)
45
+ @client.raw('post', '/content/forms/submit', nil, data_transform(data))
46
+ end
47
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stories
4
+ ##
5
+ # === Get Stories.
6
+ # Get a collection of stories.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
10
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
11
+ #
12
+ # ==== First Example
13
+ # @data = @mints_pub.get_stories
14
+ #
15
+ # ==== Second Example
16
+ # options = { fields: 'id, slug' }
17
+ # @data = @mints_pub.get_stories(options)
18
+ #
19
+ # ==== Third Example
20
+ # options = {
21
+ # fields: 'id, slug'
22
+ # }
23
+ # @data = @mints_pub.get_stories(options, false)
24
+ def get_stories(options = nil, use_post = true)
25
+ get_query_results('/content/stories', options, use_post)
26
+ end
27
+
28
+ ##
29
+ # === Get Story.
30
+ # Get a single story.
31
+ #
32
+ # ==== Parameters
33
+ # slug:: (String) -- It's the string identifier generated by Mints.
34
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
35
+ #
36
+ # ==== First Example
37
+ # @data = @mints_pub.get_story("story_slug")
38
+ #
39
+ # ==== Second Example
40
+ # @data = @mints_pub.get_story("story_slug", options.to_json)
41
+ def get_story(slug, options = nil)
42
+ @client.raw('get', "/content/stories/#{slug}", options)
43
+ end
44
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module StoryVersions
4
+ ##
5
+ # === Get Story Versions.
6
+ # Get a collection of story version.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
10
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
11
+ #
12
+ # ==== First Example
13
+ # @data = @mints_pub.get_story_versions
14
+ #
15
+ # ==== Second Example
16
+ # options = {
17
+ # fields: 'id, title'
18
+ # }
19
+ # @data = @mints_pub.get_story_versions(options)
20
+ #
21
+ # ==== Third Example
22
+ # options = {
23
+ # fields: 'id, title'
24
+ # }
25
+ # @data = @mints_pub.get_story_versions(options, false)
26
+ def get_story_versions(options = nil, use_post = true)
27
+ get_query_results('/content/story-versions', options, use_post)
28
+ end
29
+
30
+ ##
31
+ # === Get Story Version.
32
+ # Get a single story version.
33
+ #
34
+ # ==== Parameters
35
+ # slug:: (String) -- It's the string identifier generated by Mints.
36
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
37
+ #
38
+ # ==== First Example
39
+ # @data = @mints_pub.get_story_version('story_slug')
40
+ #
41
+ # ==== Second Example
42
+ # @data = @mints_pub.get_story_version('story_slug', options)
43
+ def get_story_version(slug, options = nil)
44
+ @client.raw('get', "/content/story-versions/#{slug}", options)
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ ### V1/ECOMMERCE ###
4
+
5
+ require_relative './locations'
6
+ require_relative './products'
7
+ require_relative './orders'
8
+
9
+ module Ecommerce
10
+ include Locations
11
+ include Products
12
+ include Orders
13
+
14
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Locations
4
+ ##
5
+ # === Get Locations.
6
+ # Get all locations.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
10
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
11
+ #
12
+ # ==== First Example
13
+ # @data = @mints_pub.get_locations
14
+ #
15
+ # ==== Second Example
16
+ # options = { fields: "title" }
17
+ # @data = @mints_pub.get_locations(options)
18
+ #
19
+ # ==== Third Example
20
+ # options = { fields: "title" }
21
+ # @data = @mints_pub.get_locations(options, false)
22
+ def get_locations(options = nil, use_post = true)
23
+ get_query_results('/ecommerce/locations', options, use_post)
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orders
4
+ ##
5
+ # === Get My Shopping Cart.
6
+ # Get a collection of items in the shopping cart.
7
+ #
8
+ # ==== Example
9
+ # @data = @mints_ pub.get_my_shopping_cart
10
+ def get_my_shopping_cart(options = nil)
11
+ @client.raw('get', '/ecommerce/my-shopping-cart', options, nil)
12
+ end
13
+
14
+ ##
15
+ # === Add Item To Shopping Cart.
16
+ # Add an item into a shopping cart.
17
+ #
18
+ # ==== Parameters
19
+ # data:: (Hash) -- Data to be submitted.
20
+ #
21
+ # ==== Example
22
+ # data = {
23
+ # quantity: 1,
24
+ # sku_id: 1,
25
+ # price_list_id: 1
26
+ # }
27
+ # @data = @mints_ pub.add_item_to_shopping_cart(data)
28
+ def add_item_to_shopping_cart(data, options = nil)
29
+ @client.raw('post', '/ecommerce/shopping-cart', options, data_transform(data))
30
+ end
31
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Products
4
+ ##
5
+ # === Get Products.
6
+ # Get a collection of products.
7
+ #
8
+ # ==== Parameters
9
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
10
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
11
+ #
12
+ # ==== First Example
13
+ # @data = @mints_pub.get_products
14
+ #
15
+ # ==== Second Example
16
+ # options = { fields: "title" }
17
+ # @data = @mints_pub.get_products(options)
18
+ #
19
+ # ==== Third Example
20
+ # options = { fields: "title" }
21
+ # @data = @mints_pub.get_products(options, false)
22
+ def get_products(options = nil, use_post = true)
23
+ get_query_results('/ecommerce/products', options, use_post)
24
+ end
25
+
26
+ ##
27
+ # === Get Product.
28
+ # Get a single product.
29
+ #
30
+ # ==== Parameters
31
+ # slug:: (String) -- It's the string identifier generated by Mints.
32
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
33
+ #
34
+ # ==== First Example
35
+ # @data = @mints_pub.get_product("product_slug")
36
+ #
37
+ # ==== Second Example
38
+ # options = {
39
+ # fields: 'id, slug'
40
+ # }
41
+ # @data = @mints_pub.get_product("lego-set", options)
42
+ def get_product(slug, options = nil)
43
+ @client.raw('get', "/ecommerce/products/#{slug}", options)
44
+ end
45
+ end