mints 0.0.29 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +290 -32
- data/lib/contact/config/appointments.rb +1 -1
- data/lib/contact/config/config.rb +2 -2
- data/lib/contact/content/content.rb +2 -2
- data/lib/contact/content/conversations.rb +2 -2
- data/lib/contact/ecommerce/ecommerce.rb +6 -4
- data/lib/contact/ecommerce/order_items.rb +1 -1
- data/lib/contact/ecommerce/order_items_groups.rb +1 -1
- data/lib/contact/ecommerce/orders.rb +1 -2
- data/lib/contact/ecommerce/vouchers.rb +18 -0
- data/lib/contact.rb +9 -3
- data/lib/errors.rb +1 -1
- data/lib/mints/controllers/concerns/mints_clients.rb +3 -1
- data/lib/mints/helpers/contact_auth_helper.rb +2 -2
- data/lib/mints/helpers/proxy_controllers_methods.rb +1 -1
- data/lib/pub/config/attributes.rb +13 -0
- data/lib/pub/config/config.rb +15 -0
- data/lib/pub/config/public_folders.rb +51 -0
- data/lib/pub/config/tags.rb +42 -0
- data/lib/pub/config/taxonomies.rb +49 -0
- data/lib/pub/content/assets.rb +16 -0
- data/lib/pub/content/content.rb +22 -0
- data/lib/pub/content/content_bundles.rb +40 -0
- data/lib/pub/content/content_instance_versions.rb +56 -0
- data/lib/pub/content/content_instances.rb +37 -0
- data/lib/pub/content/forms.rb +47 -0
- data/lib/pub/content/stories.rb +44 -0
- data/lib/pub/content/story_versions.rb +46 -0
- data/lib/pub/ecommerce/ecommerce.rb +14 -0
- data/lib/pub/ecommerce/locations.rb +25 -0
- data/lib/pub/ecommerce/orders.rb +31 -0
- data/lib/pub/ecommerce/products.rb +45 -0
- data/lib/pub.rb +6 -427
- data/lib/user/config/config.rb +1 -1
- data/lib/user/config/public_folders.rb +1 -1
- data/lib/user/config/users.rb +4 -4
- data/lib/user/content/content.rb +0 -55
- data/lib/user/content/forms.rb +4 -4
- data/lib/user/content/messages.rb +4 -4
- data/lib/user/content/stories.rb +8 -5
- data/lib/user/content/story_templates.rb +2 -2
- data/lib/user/crm/contacts.rb +0 -13
- data/lib/user/crm/workflow_steps.rb +4 -4
- data/lib/user/crm/workflows.rb +4 -4
- data/lib/user/ecommerce/ecommerce.rb +2 -0
- data/lib/user/ecommerce/locations.rb +2 -2
- data/lib/user/ecommerce/order_items_groups.rb +2 -2
- data/lib/user/ecommerce/skus.rb +2 -2
- data/lib/user/ecommerce/vouchers.rb +90 -0
- metadata +21 -2
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PublicTags
|
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 PublicTaxonomies
|
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 PublicAssets
|
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 PublicContent
|
14
|
+
include PublicAssets
|
15
|
+
include PublicContentBundles
|
16
|
+
include PublicContentInstanceVersions
|
17
|
+
include PublicContentInstances
|
18
|
+
include PublicForms
|
19
|
+
include PublicStories
|
20
|
+
include PublicStoryVersions
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PublicContentBundles
|
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 PublicContentInstanceVersions
|
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 PublicContentInstances
|
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 PublicForms
|
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 PublicStories
|
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 PublicStoryVersions
|
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 PublicEcommerce
|
10
|
+
include PublicLocations
|
11
|
+
include PublicProducts
|
12
|
+
include PublicOrders
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PublicLocations
|
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 PublicOrders
|
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 PublicProducts
|
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
|