mints 0.0.15 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/client.rb +65 -30
  3. data/lib/contact.rb +146 -17
  4. data/lib/generators/mints_assets_controller.rb +3 -0
  5. data/lib/generators/mints_files_generator.rb +2 -0
  6. data/lib/mints/controllers/admin_base_controller.rb +28 -12
  7. data/lib/mints/controllers/base_api_controller.rb +97 -7
  8. data/lib/mints/controllers/base_controller.rb +48 -7
  9. data/lib/mints_helper.rb +47 -0
  10. data/lib/pub.rb +137 -52
  11. data/lib/user/config/api_keys.rb +65 -0
  12. data/lib/user/config/appointments.rb +221 -0
  13. data/lib/user/config/attribute_groups.rb +77 -0
  14. data/lib/user/config/attributes.rb +86 -0
  15. data/lib/user/config/calendars.rb +89 -0
  16. data/lib/user/config/config.rb +65 -0
  17. data/lib/user/config/importers.rb +184 -0
  18. data/lib/user/config/public_folders.rb +108 -0
  19. data/lib/user/config/relationships.rb +138 -0
  20. data/lib/user/config/roles.rb +84 -0
  21. data/lib/user/config/seeds.rb +14 -0
  22. data/lib/user/config/system_settings.rb +53 -0
  23. data/lib/user/config/tags.rb +63 -0
  24. data/lib/user/config/taxonomies.rb +124 -0
  25. data/lib/user/config/teams.rb +70 -0
  26. data/lib/user/config/users.rb +76 -0
  27. data/lib/user/contacts/contacts.rb +21 -0
  28. data/lib/user/content/assets.rb +98 -0
  29. data/lib/user/content/content.rb +235 -0
  30. data/lib/user/content/content_instances.rb +147 -0
  31. data/lib/user/content/content_templates.rb +111 -0
  32. data/lib/user/content/conversations.rb +174 -0
  33. data/lib/user/content/dam.rb +88 -0
  34. data/lib/user/content/forms.rb +168 -0
  35. data/lib/user/content/message_templates.rb +162 -0
  36. data/lib/user/content/messages.rb +90 -0
  37. data/lib/user/content/pages.rb +81 -0
  38. data/lib/user/content/stories.rb +164 -0
  39. data/lib/user/content/story_templates.rb +95 -0
  40. data/lib/user/crm/companies.rb +111 -0
  41. data/lib/user/crm/contacts.rb +312 -0
  42. data/lib/user/crm/crm.rb +21 -0
  43. data/lib/user/crm/deals.rb +111 -0
  44. data/lib/user/crm/favorites.rb +17 -0
  45. data/lib/user/crm/segments.rb +132 -0
  46. data/lib/user/crm/users.rb +22 -0
  47. data/lib/user/crm/workflow_step_objects.rb +89 -0
  48. data/lib/user/crm/workflow_steps.rb +49 -0
  49. data/lib/user/crm/workflows.rb +70 -0
  50. data/lib/user/ecommerce/ecommerce.rb +29 -0
  51. data/lib/user/ecommerce/item_prices.rb +86 -0
  52. data/lib/user/ecommerce/locations.rb +166 -0
  53. data/lib/user/ecommerce/order_items_groups.rb +109 -0
  54. data/lib/user/ecommerce/order_statuses.rb +26 -0
  55. data/lib/user/ecommerce/orders.rb +258 -0
  56. data/lib/user/ecommerce/price_lists.rb +73 -0
  57. data/lib/user/ecommerce/product_templates.rb +104 -0
  58. data/lib/user/ecommerce/product_variations.rb +129 -0
  59. data/lib/user/ecommerce/products.rb +169 -0
  60. data/lib/user/ecommerce/skus.rb +88 -0
  61. data/lib/user/ecommerce/taxes.rb +82 -0
  62. data/lib/user/ecommerce/variant_options.rb +69 -0
  63. data/lib/user/ecommerce/variant_values.rb +72 -0
  64. data/lib/user/helpers/helpers.rb +113 -0
  65. data/lib/user/helpers/object_activities.rb +83 -0
  66. data/lib/user/helpers/object_folders.rb +82 -0
  67. data/lib/user/helpers/user_folders.rb +83 -0
  68. data/lib/user/marketing/marketing.rb +120 -0
  69. data/lib/user/profile/profile.rb +111 -0
  70. data/lib/user.rb +36 -355
  71. metadata +64 -3
@@ -1,6 +1,6 @@
1
1
  module Mints
2
2
  class BaseApiController < ActionController::Base
3
- before_action :set_mints_pub_client
3
+ before_action :set_mints_clients
4
4
 
5
5
  ##
6
6
  # === Mints Contact Login.
@@ -10,11 +10,31 @@ module Mints
10
10
  response = @mints_contact.login(email, password)
11
11
  # Get session token from response
12
12
  session_token = response['session_token']
13
- id_token = response['contact']['id_token']
13
+ id_token = response['contact']['contact_token'] ? response['contact']['contact_token'] : response['contact']['id_token']
14
14
  # Set a permanent cookie with the session token
15
- cookies.permanent[:mints_contact_session_token] = session_token
16
- cookies.permanent[:mints_contact_id] = id_token
15
+ cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
16
+ cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
17
17
  @contact_token = id_token
18
+ end
19
+
20
+ ##
21
+ # === Mints contact Login.
22
+ # Starts a contact session in mints.cloud and set a session cookie
23
+ def mints_contact_magic_link_login(hash)
24
+ # Login in mints
25
+ response = @mints_contact.magic_link_login(hash)
26
+ if response['data']
27
+ # Get session token from response
28
+ session_token = response['data']['session_token']
29
+ id_token = response['data']['contact']['contact_token'] ? response['data']['contact']['contact_token'] : response['data']['contact']['id_token']
30
+ # Set a permanent cookie with the session token
31
+ cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
32
+ cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
33
+ @contact_token = id_token
34
+ redirect_to response['data']['redirect_url'] ? response['data']['redirect_url'] : '/'
35
+ else
36
+ redirect_to '/'
37
+ end
18
38
  end
19
39
 
20
40
  ##
@@ -28,26 +48,96 @@ module Mints
28
48
  cookies.delete(:mints_contact_id)
29
49
  @contact_token = nil
30
50
  end
51
+
52
+ ##
53
+ # === Mints user Login.
54
+ # Starts a user session in mints.cloud and set a session cookie
55
+ def mints_user_login(email, password)
56
+ # Login in mints
57
+ response = @mints_user.login(email, password)
58
+ # Get session token from response
59
+ session_token = response['api_token']
60
+ # Set a permanent cookie with the session token
61
+ cookies[:mints_user_session_token] = { value: session_token, secure: true, httponly: true, expires: 1.day }
62
+ end
63
+
64
+ ##
65
+ # === Mints user Login.
66
+ # Starts a user session in mints.cloud and set a session cookie
67
+ def mints_user_magic_link_login(hash)
68
+ # Login in mints
69
+ response = @mints_user.magic_link_login(hash)
70
+ if response['data']
71
+ # Set a cookie with the session token
72
+ cookies[:mints_user_session_token] = { value: response['data']['api_token'], secure: true, httponly: true, expires: 1.day }
73
+ redirect_to response['data']['redirect_url'] ? response['data']['redirect_url'] : '/'
74
+ else
75
+ redirect_to '/'
76
+ end
77
+ end
78
+
79
+ ##
80
+ # === Mints user Logout.
81
+ # Destroy session from mints.cloud and delete local session cookie
82
+ def mints_user_logout
83
+ # Logout from mints
84
+ # @mints_user.logout
85
+ # Delete local cookie
86
+ cookies.delete(:mints_user_session_token)
87
+ end
31
88
 
32
89
  private
33
90
 
34
91
  ##
35
- # === Set mints pub.
36
- # Initialize the public client and set the contact token
37
- def set_mints_pub_client
92
+ # === Set mints clients (pub, user and contact)
93
+ # Initialize all clients from mitns
94
+ def set_mints_clients
38
95
  if File.exists?("#{Rails.root}/mints_config.yml.erb")
39
96
  template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
40
97
  config = YAML.load template.result(binding)
41
98
  @host = config["mints"]["host"]
42
99
  @api_key = config["mints"]["api_key"]
43
100
  @debug = config["sdk"]["debug"] ? config["sdk"]["debug"] : false
101
+
102
+ #public client
103
+ set_mints_pub_client
104
+ #contact client
105
+ set_mints_contact_client
106
+ #user client
107
+ set_mints_user_client
44
108
  else
45
109
  raise 'MintsBadCredentialsError'
46
110
  end
111
+ end
112
+
113
+ ##
114
+ # === Set mints pub.
115
+ # Initialize the public client and set the contact token
116
+ def set_mints_pub_client
117
+
47
118
  # Initialize mints pub client, credentials taken from mints_config.yml.erb file
48
119
  @mints_pub = Mints::Pub.new(@host, @api_key, nil, @debug)
49
120
  # Set contact token from cookie
50
121
  @mints_pub.client.session_token = @contact_token
51
122
  end
123
+
124
+ ##
125
+ # === Set mints contact client.
126
+ # Initialize the public client and set the contact token
127
+ def set_mints_contact_client
128
+ # Initialize mints clontact client
129
+ session_token = cookies[:mints_contact_session_token] ? cookies[:mints_contact_session_token] : nil
130
+ contact_token_id = cookies[:mints_contact_id] ? cookies[:mints_contact_id] : nil
131
+ @mints_contact = Mints::Contact.new(@host, @api_key, session_token, contact_token_id, @debug)
132
+ end
133
+
134
+ ##
135
+ # === Set Mints user client.
136
+ # Initialize the public client and set the user token
137
+ def set_mints_user_client
138
+ # Initialize mints user client
139
+ session_token = cookies[:mints_user_session_token] ? cookies[:mints_user_session_token] : nil
140
+ @mints_user = Mints::User.new(@host, @api_key, session_token, @debug)
141
+ end
52
142
  end
53
143
  end
@@ -24,13 +24,28 @@ module Mints
24
24
  response = @mints_contact.login(email, password)
25
25
  # Get session token from response
26
26
  session_token = response['session_token']
27
- id_token = response['contact']['id_token']
27
+ id_token = response['contact']['contact_token'] ? response['contact']['contact_token'] : response['contact']['id_token']
28
28
  # Set a permanent cookie with the session token
29
- cookies.permanent[:mints_contact_session_token] = session_token
30
- cookies.permanent[:mints_contact_id] = id_token
29
+ cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
30
+ cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
31
31
  @contact_token = id_token
32
32
  end
33
33
 
34
+ ##
35
+ # === Mints Contact Magic Link Login.
36
+ # Starts a contact session in mints.cloud and set a session cookie
37
+ def mints_contact_magic_link_login(token)
38
+ # Login in mints
39
+ response = @mints_contact.login(email, password)
40
+ # Get session token from response
41
+ session_token = response['session_token']
42
+ id_token = response['contact']['contact_token'] ? response['contact']['contact_token'] : response['contact']['id_token']
43
+ # Set a permanent cookie with the session token
44
+ cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
45
+ cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
46
+ @contact_token = id_token
47
+ end
48
+
34
49
  ##
35
50
  # === Mints Contact Logout.
36
51
  # Destroy session from mints.cloud and delete local session cookie
@@ -49,10 +64,25 @@ module Mints
49
64
  # === Register visit.
50
65
  # Call register visit method from the public client and set/renew the cookie mints_contact_id
51
66
  def register_visit
67
+ if @debug
68
+ puts "REQUEST IN REGISTER VISIT: #{request}"
69
+ puts "BODY REQUEST: #{request.body}"
70
+ puts "AUTH REQUEST: #{request.authorization}"
71
+ puts "LENGTH REQUEST: #{request.content_length}"
72
+ puts "FORM DATA REQUEST: #{request.form_data?}"
73
+ puts "FULLPATH REQUEST: #{request.fullpath}"
74
+ puts "HEADERS REQUEST: #{request.headers}"
75
+ puts "IP REQUEST: #{request.ip}"
76
+ puts "REQUEST IP ADRESS: #{request['ip_address']}"
77
+ puts "REQUEST REMOTE IP: #{request['remote_ip']}"
78
+ end
52
79
  response = @mints_pub.register_visit(request)
53
- @contact_token = response['user_token']
80
+ if @debug
81
+ puts "RESPONSE IN REGISTER VISIT: #{response}"
82
+ end
83
+ @contact_token = response['contact_token'] ? response['contact_token'] : response['user_token']
54
84
  @visit_id = response['visit_id']
55
- cookies.permanent[:mints_contact_id] = @contact_token
85
+ cookies.permanent[:mints_contact_id] = { value: @contact_token, secure: true, httponly: true }
56
86
  end
57
87
 
58
88
  ##
@@ -69,7 +99,7 @@ module Mints
69
99
  raise 'MintsBadCredentialsError'
70
100
  end
71
101
  # Initialize mints pub client, credentials taken from mints_config.yml.erb file
72
- @mints_pub = Mints::Pub.new(@host, @api_key, nil, @debug)
102
+ @mints_pub = Mints::Pub.new(@host, @api_key, @contact_token, @debug)
73
103
  # Set contact token from cookie
74
104
  @mints_pub.client.session_token = @contact_token
75
105
  end
@@ -85,8 +115,19 @@ module Mints
85
115
  # === Set mints contact client.
86
116
  # Initialize the public client and set the contact token
87
117
  def set_mints_contact_client
118
+ if File.exists?("#{Rails.root}/mints_config.yml.erb")
119
+ template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
120
+ config = YAML.load template.result(binding)
121
+ @host = config["mints"]["host"]
122
+ @api_key = config["mints"]["api_key"]
123
+ @debug = config["sdk"]["debug"] ? config["sdk"]["debug"] : false
124
+ else
125
+ raise 'MintsBadCredentialsError'
126
+ end
88
127
  # Initialize mints clontact client
89
- @mints_contact = Mints::Contact.new(@host, @api_key, nil, @debug)
128
+ session_token = cookies[:mints_contact_session_token] ? cookies[:mints_contact_session_token] : nil
129
+ contact_token_id = cookies[:mints_contact_id] ? cookies[:mints_contact_id] : nil
130
+ @mints_contact = Mints::Contact.new(@host, @api_key, session_token, contact_token_id, @debug)
90
131
  end
91
132
  end
92
133
  end
@@ -0,0 +1,47 @@
1
+
2
+ module MintsHelper
3
+ # === Get query results.
4
+ # Method used to give the options to make a 'post' or 'get' request.
5
+ #
6
+ # ==== Parameters
7
+ # url:: (String) -- Url to make the request.
8
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter.
9
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
10
+ #
11
+ def get_query_results(url, options = nil, use_post = true)
12
+ if use_post
13
+ return @client.raw("post", "#{url}/query", options)
14
+ else
15
+ return @client.raw("get", url, options)
16
+ end
17
+ end
18
+
19
+ # === Data transform.
20
+ # Transform a 'data' variable to a standardized 'data' variable.
21
+ #
22
+ # ==== Parameters
23
+ # data:: (Hash) -- Data to be submited.
24
+ #
25
+ def data_transform(data)
26
+ data = correct_json(data)
27
+ unless data[:data]
28
+ data = {data: data}
29
+ end
30
+ return data.to_json
31
+ end
32
+
33
+ # === Correct json.
34
+ # Receives a json data and convert it to a symbolized object.
35
+ #
36
+ # ==== Parameters
37
+ # data:: (Hash) -- Data to be submited.
38
+ #
39
+ def correct_json(data)
40
+ if data.is_a? String
41
+ data = JSON.parse(data)
42
+ end
43
+ data = data.symbolize_keys
44
+ return data
45
+ end
46
+
47
+ end
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,30 +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
85
+ # Returns a Client object.
84
86
  def initialize(host, api_key, contact_token_id = nil, debug = false)
85
87
  @client = Mints::Client.new(host, api_key, 'public', nil, contact_token_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.
99
+ #
100
+ # ==== Example
101
+ # request = {
102
+ # "remote_ip" => "http://1.1.1.1/",
103
+ # "user_agent" => "User Agent",
104
+ # "fullpath" => "https://fullpath/example"
105
+ # }
106
+ # @mints_pub.register_visit(request, request["remote_ip"], request["user_agent"], request["fullpath"])
97
107
  def register_visit(request, ip = nil, user_agent = nil, url = nil)
98
108
  data = {
99
109
  ip_address: ip || request.remote_ip,
@@ -106,31 +116,40 @@ module Mints
106
116
 
107
117
  ##
108
118
  # === Register Visit timer.
109
- # Register a page visit time
119
+ # Register a page visit time.
110
120
  #
111
121
  # ==== Parameters
112
- # * +visit+ - [String] It's the visitor IP
113
- # * +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.
124
+ #
125
+ # ==== Example
126
+ # @mints_pub.register_visit_timer("60da2325d29acc7e55684472", 4)
114
127
  def register_visit_timer(visit, time)
115
128
  return @client.raw("get", "/register-visit-timer?visit=#{visit}&time=#{time}")
116
129
  end
117
130
 
118
131
  ##
119
132
  # === Get Asset Info.
120
- # Get a description of an Asset
133
+ # Get a description of an Asset.
121
134
  #
122
135
  # ==== Parameters
123
- # * +slug+ - [String] It's the string identifier of the asset.
136
+ # slug:: (String) -- It's the string identifier of the asset.
137
+ #
138
+ # ==== Example
139
+ # @mints_pub.get_asset_info("asset_slug")
124
140
  def get_asset_info(slug)
125
141
  return @client.raw("get", "/content/asset-info/#{slug}")
126
142
  end
127
143
 
128
144
  ##
129
145
  # === Get Stories.
130
- # Get a collection of stories
146
+ # Get a collection of stories.
131
147
  #
132
148
  # ==== Parameters
133
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
149
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
150
+ #
151
+ # ==== Example
152
+ # @mints_pub.get_stories
134
153
  def get_stories(options = nil)
135
154
  return @client.raw("get", "/content/stories", options)
136
155
  end
@@ -140,18 +159,24 @@ module Mints
140
159
  # Get a single story.
141
160
  #
142
161
  # ==== Parameters
143
- # * +slug+ - [String] It's the string identifier generated by Mints
144
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
162
+ # slug:: (String) -- It's the string identifier generated by Mints.
163
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
164
+ #
165
+ # ==== Example
166
+ # @mints_pub.get_story("story_slug")
145
167
  def get_story(slug, options = nil)
146
168
  return @client.raw("get", "/content/stories/#{slug}", options)
147
169
  end
148
170
 
149
171
  ##
150
172
  # === Get Forms.
151
- # Get a collection of forms
173
+ # Get a collection of forms.
152
174
  #
153
175
  # ==== Parameters
154
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
176
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
177
+ #
178
+ # ==== Example
179
+ # @mints_pub.get_forms
155
180
  def get_forms(options = nil)
156
181
  return @client.raw("get", "/content/forms", options)
157
182
  end
@@ -161,28 +186,42 @@ module Mints
161
186
  # Get a single form.
162
187
  #
163
188
  # ==== 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
189
+ # slug:: (String) -- It's the string identifier generated by Mints.
190
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
191
+ #
192
+ # ==== Example
193
+ # @mints_pub.get_form("form_slug")
166
194
  def get_form(slug, options = nil)
167
195
  return @client.raw("get", "/content/forms/#{slug}", options)
168
196
  end
169
197
 
170
198
  ##
171
199
  # === Submit Form.
172
- # Submit a form.
200
+ # Submit a form with data.
173
201
  #
174
202
  # ==== Parameters
175
- # * +data+ - [Hash] Data to be submited
203
+ # data:: (Hash) -- Data to be submited.
204
+ #
205
+ # ==== Example
206
+ # data = {
207
+ # 'form_slug': 'form_slug',
208
+ # 'email': 'email@example.com',
209
+ # 'given_name': 'given_name',
210
+ # 'f1': 'Field 1 answer',
211
+ # 'f2': 'Field 2 answer',
212
+ # 'f3': 'Field 3 answer'
213
+ # }
214
+ # @data = @mints_pub.submit_form(data)
176
215
  def submit_form(data)
177
- return @client.raw("post", "/content/forms/submit", nil, data)
216
+ return @client.raw("post", "/content/forms/submit", nil, data_transform(data))
178
217
  end
179
218
 
180
219
  ##
181
220
  # === Get Content Instances.
182
- # Get a collection of content instances
221
+ # Get a collection of content instances. _Note:_ Options must be specified.
183
222
  #
184
223
  # ==== Parameters
185
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
224
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
186
225
  def get_content_instances(options = nil)
187
226
  return @client.raw("get", "/content/content-instances", options)
188
227
  end
@@ -192,8 +231,11 @@ module Mints
192
231
  # Get a single content instance.
193
232
  #
194
233
  # ==== Parameters
195
- # * +slug+ - [String] It's the string identifier generated by Mints
196
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
234
+ # slug:: (String) -- It's the string identifier generated by Mints.
235
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
236
+ #
237
+ # ==== Example
238
+ # @mints_pub.get_content_instance("content_instance_slug")
197
239
  def get_content_instance(slug, options = nil)
198
240
  return @client.raw("get", "/content/content-instances/#{slug}", options)
199
241
  end
@@ -203,18 +245,21 @@ module Mints
203
245
  # Get all content pages.
204
246
  #
205
247
  # ==== Parameters
206
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
248
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
207
249
  def get_content_pages(options = nil)
208
250
  return @client.raw("get", "/content/content-pages", options)
209
251
  end
210
252
 
211
253
  ##
212
254
  # === Get Content Page.
213
- # Get a single content page
255
+ # Get a single content page.
214
256
  #
215
257
  # ==== Parameters
216
- # * +slug+ - [String] It's the slug
217
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
258
+ # slug:: (String) -- It's the string identifier generated by Mints.
259
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
260
+ #
261
+ # ==== Example
262
+ # @mints_pub.get_content_page("test-page")
218
263
  def get_content_page(slug, options = nil)
219
264
  return @client.raw("get", "/content/content-pages/#{slug}", options)
220
265
  end
@@ -224,7 +269,10 @@ module Mints
224
269
  # Get all locations.
225
270
  #
226
271
  # ==== Parameters
227
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
272
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
273
+ #
274
+ # ==== Example
275
+ # @mints_pub.get_locations
228
276
  def get_locations(options = nil)
229
277
  return @client.raw("get", "/ecommerce/locations", options)
230
278
  end
@@ -234,7 +282,10 @@ module Mints
234
282
  # Get a collection of products.
235
283
  #
236
284
  # ==== Parameters
237
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
285
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
286
+ #
287
+ # ==== Example
288
+ # @mints_pub.get_products
238
289
  def get_products(options = nil)
239
290
  return @client.raw("get", "/ecommerce/products", options)
240
291
  end
@@ -244,8 +295,11 @@ module Mints
244
295
  # Get a single product.
245
296
  #
246
297
  # ==== Parameters
247
- # * +slug+ - [String] It's the string identifier generated by Mints
248
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
298
+ # slug:: (String) -- It's the string identifier generated by Mints.
299
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
300
+ #
301
+ # ==== Example
302
+ # @mints_pub.get_product("product_slug")
249
303
  def get_product(slug, options = nil)
250
304
  return @client.raw("get", "/ecommerce/products/#{slug}", options)
251
305
  end
@@ -255,18 +309,30 @@ module Mints
255
309
  # Get a collection of categories.
256
310
  #
257
311
  # ==== Parameters
258
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
312
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
313
+ #
314
+ # ==== Example
315
+ # options = {
316
+ # "object_type": "stories"
317
+ # }
318
+ # @mints_pub.get_categories(options)
259
319
  def get_categories(options = nil)
260
320
  return @client.raw("get", "/config/categories", options)
261
321
  end
262
322
 
263
323
  ##
264
324
  # === Get Category.
265
- # Get a single category
325
+ # Get a single category.
266
326
  #
267
327
  # ==== Parameters
268
- # * +slug+ - [String] It's the string identifier generated by Mints
269
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
328
+ # slug:: (String) -- It's the string identifier generated by Mints.
329
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
330
+ #
331
+ # ==== Example
332
+ # options = {
333
+ # "object_type": "locations"
334
+ # }
335
+ # @mints_pub.get_category("asset_slug", options)
270
336
  def get_category(slug, options = nil)
271
337
  return @client.raw("get", "/config/categories/#{slug}", options)
272
338
  end
@@ -276,18 +342,24 @@ module Mints
276
342
  # Get a collection of tags.
277
343
  #
278
344
  # ==== Parameters
279
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
345
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
346
+ #
347
+ # ==== Example
348
+ # @mints_pub.get_tags
280
349
  def get_tags(options = nil)
281
350
  return @client.raw("get", "/config/tags", options)
282
351
  end
283
352
 
284
353
  ##
285
354
  # === Get Tag.
286
- # Get a single tag
355
+ # Get a single tag.
287
356
  #
288
357
  # ==== Parameters
289
- # * +slug+ - [String] It's the string identifier generated by Mints
290
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
358
+ # slug:: (String) -- It's the string identifier generated by Mints.
359
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
360
+ #
361
+ # ==== Example
362
+ # @mints_pub.get_tag("tag_slug")
291
363
  def get_tag(slug, options = nil)
292
364
  return @client.raw("get", "/config/tags/#{slug}", options)
293
365
  end
@@ -297,18 +369,24 @@ module Mints
297
369
  # Get a collection of taxonomies.
298
370
  #
299
371
  # ==== Parameters
300
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
372
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
373
+ #
374
+ # ==== Example
375
+ # @mints_pub.get_taxonomies
301
376
  def get_taxonomies(options = nil)
302
377
  return @client.raw("get", "/config/taxonomies", options)
303
378
  end
304
379
 
305
380
  ##
306
381
  # === Get Taxonomy.
307
- # Get a single taxonomy
382
+ # Get a single taxonomy.
308
383
  #
309
384
  # ==== Parameters
310
- # * +slug+ - [String] It's the string identifier generated by Mints
311
- # * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
385
+ # slug:: (String) -- It's the string identifier generated by Mints.
386
+ # options:: (Hash) -- List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter.
387
+ #
388
+ # ==== Example
389
+ # @mints_pub.get_taxonomy("taxonomy_slug")
312
390
  def get_taxonomy(slug, options = nil)
313
391
  return @client.raw("get", "/config/taxonomies/#{slug}", options)
314
392
  end
@@ -318,9 +396,16 @@ module Mints
318
396
  # Get a collection of attributes.
319
397
  #
320
398
  # ==== Parameters
321
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
399
+ # options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
400
+ #
401
+ # ==== Example
402
+ # @mints_pub.get_attributes
322
403
  def get_attributes(options = nil)
323
404
  return @client.raw("get", "/config/attributes", options)
324
405
  end
406
+
407
+ private
408
+
409
+ include MintsHelper
325
410
  end
326
411
  end