mints 0.0.10 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -0
- data/{Readme.md → README.md} +0 -0
- data/lib/client.rb +13 -8
- data/lib/contact.rb +2 -2
- data/lib/generators/mints_config.yml.erb +12 -2
- data/lib/generators/mints_contact_controller.rb +0 -0
- data/lib/generators/mints_files_generator.rb +3 -2
- data/lib/generators/mints_public_controller.rb +0 -0
- data/lib/generators/mints_user_controller.rb +0 -0
- data/lib/mints.rb +1 -0
- data/lib/mints/controllers/admin_base_controller.rb +0 -0
- data/lib/mints/controllers/base_api_controller.rb +53 -0
- data/lib/mints/controllers/base_controller.rb +0 -0
- data/lib/mints/controllers/contact_api_controller.rb +6 -1
- data/lib/mints/controllers/public_api_controller.rb +1 -1
- data/lib/mints/controllers/user_api_controller.rb +2 -2
- data/lib/pub.rb +111 -105
- data/lib/user.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18200f38cd58f4884a1e3391f28523b15dcad0db6f1a40038d3dd77bbc7b5826
|
4
|
+
data.tar.gz: 1a80da693aa4121af008dfc9d2816f5d09963e84d61f5274824593910786664e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa64a73af10be175c08a0833e6178b654ea8cda3713e49e1533fdc12fa89d3c4be51974ac41c558463d11aa5d0c50e621d774a9b77bd61e554c4dda0a7cb0019
|
7
|
+
data.tar.gz: 525ef4e71004bc3705f36eb4d1f165044da08dba2af45eff3185e4686206f746dc4d0072ce97cd811ce1489c9de17f7737354d3a437eddbd9d90ffc164e4c6d2
|
data/Gemfile
CHANGED
File without changes
|
data/{Readme.md → README.md}
RENAMED
File without changes
|
data/lib/client.rb
CHANGED
@@ -8,12 +8,14 @@ module Mints
|
|
8
8
|
attr_reader :api_key
|
9
9
|
attr_reader :scope
|
10
10
|
attr_reader :base_url
|
11
|
-
attr_accessor :session_token
|
11
|
+
attr_accessor :session_token
|
12
|
+
attr_accessor :contact_token_id
|
12
13
|
|
13
|
-
def initialize(host, api_key, scope = nil, session_token = nil, debug = false)
|
14
|
+
def initialize(host, api_key, scope = nil, session_token = nil, contact_token_id = nil, debug = false)
|
14
15
|
@host = host
|
15
16
|
@api_key = api_key
|
16
17
|
@session_token = session_token
|
18
|
+
@contact_token_id = contact_token_id
|
17
19
|
@debug = debug
|
18
20
|
self.set_scope(scope)
|
19
21
|
end
|
@@ -22,6 +24,9 @@ module Mints
|
|
22
24
|
base_url = @base_url if !base_url
|
23
25
|
uri = ""
|
24
26
|
if (options && options.class == Hash)
|
27
|
+
if (options[:jfilters] && options[:jfilters].class == Hash)
|
28
|
+
options[:jfilters] = Base64.encode64(JSON.generate(options[:jfilters]))
|
29
|
+
end
|
25
30
|
uri = Addressable::URI.new
|
26
31
|
uri.query_values = options
|
27
32
|
end
|
@@ -42,7 +47,7 @@ module Mints
|
|
42
47
|
if full_url.match url
|
43
48
|
time = group['time']
|
44
49
|
url_need_cache = true
|
45
|
-
@redis_server = Redis.new(host: config['redis_cache']['redis_host'])
|
50
|
+
@redis_server = Redis.new(host: config['redis_cache']['redis_host'], port: config['redis_cache']['redis_port'] ? config['redis_cache']['redis_port'] : 6379, db: config['redis_cache']['redis_db'] ? config['redis_cache']['redis_db'] : 1)
|
46
51
|
if @redis_server.get(full_url)
|
47
52
|
response = @redis_server.get(full_url)
|
48
53
|
result_from_cache = true
|
@@ -218,7 +223,7 @@ module Mints
|
|
218
223
|
headers = {
|
219
224
|
"ApiKey" => @api_key,
|
220
225
|
"Accept" => "application/json",
|
221
|
-
"ContactToken" => @
|
226
|
+
"ContactToken" => @contact_token_id
|
222
227
|
}
|
223
228
|
headers["Authorization"] = "Bearer #{@session_token}" if @session_token
|
224
229
|
return self.http_get(url, headers)
|
@@ -228,7 +233,7 @@ module Mints
|
|
228
233
|
headers = {
|
229
234
|
"ApiKey" => @api_key,
|
230
235
|
"Accept" => "application/json",
|
231
|
-
"ContactToken" => @
|
236
|
+
"ContactToken" => @contact_token_id
|
232
237
|
}
|
233
238
|
headers["Authorization"] = "Bearer #{@session_token}" if @session_token
|
234
239
|
return self.http_post(url, headers, data)
|
@@ -238,7 +243,7 @@ module Mints
|
|
238
243
|
headers = {
|
239
244
|
"ApiKey" => @api_key,
|
240
245
|
"Accept" => "application/json",
|
241
|
-
"ContactToken" => @
|
246
|
+
"ContactToken" => @contact_token_id
|
242
247
|
}
|
243
248
|
headers["Authorization"] = "Bearer #{@session_token}" if @session_token
|
244
249
|
return self.http_post(url, headers, data)
|
@@ -280,7 +285,7 @@ module Mints
|
|
280
285
|
"Content-Type" => "application/json",
|
281
286
|
"ApiKey" => @api_key
|
282
287
|
}
|
283
|
-
h["ContactToken"] = @
|
288
|
+
h["ContactToken"] = @contact_token_id if @contact_token_id
|
284
289
|
if headers
|
285
290
|
headers.each do |k,v|
|
286
291
|
h[k] = v
|
@@ -310,7 +315,7 @@ module Mints
|
|
310
315
|
"Content-Type" => "application/json",
|
311
316
|
"ApiKey" => @api_key
|
312
317
|
}
|
313
|
-
h["ContactToken"] = @
|
318
|
+
h["ContactToken"] = @contact_token_id if @contact_token_id
|
314
319
|
if headers
|
315
320
|
headers.each do |k,v|
|
316
321
|
h[k] = v
|
data/lib/contact.rb
CHANGED
@@ -7,8 +7,8 @@ module Mints
|
|
7
7
|
# === Initialize.
|
8
8
|
# Class constructor
|
9
9
|
#
|
10
|
-
def initialize(host, api_key, session_token = nil, debug = false)
|
11
|
-
@client = Mints::Client.new(host, api_key, "contact", session_token, debug)
|
10
|
+
def initialize(host, api_key, session_token = nil, contact_token_id = nil, debug = false)
|
11
|
+
@client = Mints::Client.new(host, api_key, "contact", session_token, contact_token_id, debug)
|
12
12
|
end
|
13
13
|
|
14
14
|
##
|
@@ -2,12 +2,22 @@
|
|
2
2
|
mints:
|
3
3
|
host: http://your_host_goes_here.com
|
4
4
|
api_key: your_mints_api_key_goes_here
|
5
|
+
mints_slug: slug_id #save id and token in redis
|
6
|
+
user_email: mints_user_email
|
7
|
+
user_password: mints_user_password
|
5
8
|
redis_cache:
|
6
9
|
use_cache: boolean_value_to_enable_and_disable_cache
|
7
|
-
redis_host:
|
10
|
+
redis_host: your_redis_server_host
|
11
|
+
redis_port: your_redis_server_port
|
12
|
+
redis_db: your_redis_database
|
8
13
|
groups:
|
9
14
|
- urls:
|
10
15
|
- group_of_urls
|
11
16
|
time: time_that_will_be_applied_to_urls_in_seconds
|
12
17
|
sdk:
|
13
|
-
debug: false
|
18
|
+
debug: false
|
19
|
+
cookies_iframe:
|
20
|
+
activated: boolean_value_to_enable_and_disable_cookies_iframe
|
21
|
+
expire_time: expire_time_of_cookies_iframe_in_hours
|
22
|
+
hosts:
|
23
|
+
- array_of_host_to_send_cookies
|
File without changes
|
@@ -9,9 +9,10 @@ class MintsFilesGenerator < Rails::Generators::Base
|
|
9
9
|
route <<-eos
|
10
10
|
# Mints auto-generated routes (proxy to send request to mints.cloud)
|
11
11
|
namespace :api, defaults: { format: :json } do
|
12
|
-
match '/user/v1/*path' => 'mints_user#index', via: [:get, :post, :put, :patch, :delete]
|
12
|
+
match '/user/v1/*path' => 'mints_user#index', via: [:get, :post, :put, :patch, :delete]
|
13
|
+
match '/contact/v1/*path' => 'mints_contact#index', via: [:get, :post, :put, :patch, :delete]
|
13
14
|
namespace :v1 do
|
14
|
-
match '/contacts/*path' => 'mints_contact#index', via: [:get, :post, :put, :patch, :delete]
|
15
|
+
match '/contacts/*path' => 'mints_contact#index', via: [:get, :post, :put, :patch, :delete]
|
15
16
|
match '/*path' => 'mints_public#index', via: [:get, :post, :put, :patch, :delete]
|
16
17
|
end
|
17
18
|
end
|
File without changes
|
File without changes
|
data/lib/mints.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative "./pub.rb"
|
|
2
2
|
require_relative "./contact.rb"
|
3
3
|
require_relative "./user.rb"
|
4
4
|
require_relative "./mints/controllers/base_controller.rb"
|
5
|
+
require_relative "./mints/controllers/base_api_controller.rb"
|
5
6
|
require_relative "./mints/controllers/admin_base_controller.rb"
|
6
7
|
require_relative "./mints/controllers/public_api_controller.rb"
|
7
8
|
require_relative "./mints/controllers/contact_api_controller.rb"
|
File without changes
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Mints
|
2
|
+
class BaseApiController < ActionController::Base
|
3
|
+
before_action :set_mints_pub_client
|
4
|
+
|
5
|
+
##
|
6
|
+
# === Mints Contact Login.
|
7
|
+
# Starts a contact session in mints.cloud and set a session cookie
|
8
|
+
def mints_contact_login(email, password)
|
9
|
+
# Login in mints
|
10
|
+
response = @mints_contact.login(email, password)
|
11
|
+
# Get session token from response
|
12
|
+
session_token = response['session_token']
|
13
|
+
id_token = response['contact']['id_token']
|
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
|
17
|
+
@contact_token = id_token
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# === Mints Contact Logout.
|
22
|
+
# Destroy session from mints.cloud and delete local session cookie
|
23
|
+
def mints_contact_logout
|
24
|
+
# Logout from mints
|
25
|
+
@mints_contact.logout
|
26
|
+
# Delete local cookie
|
27
|
+
cookies.delete(:mints_contact_session_token)
|
28
|
+
cookies.delete(:mints_contact_id)
|
29
|
+
@contact_token = nil
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
##
|
35
|
+
# === Set mints pub.
|
36
|
+
# Initialize the public client and set the contact token
|
37
|
+
def set_mints_pub_client
|
38
|
+
if File.exists?("#{Rails.root}/mints_config.yml.erb")
|
39
|
+
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
40
|
+
config = YAML.load template.result(binding)
|
41
|
+
@host = config["mints"]["host"]
|
42
|
+
@api_key = config["mints"]["api_key"]
|
43
|
+
@debug = config["sdk"]["debug"] ? config["sdk"]["debug"] : false
|
44
|
+
else
|
45
|
+
raise 'MintsBadCredentialsError'
|
46
|
+
end
|
47
|
+
# Initialize mints pub client, credentials taken from mints_config.yml.erb file
|
48
|
+
@mints_pub = Mints::Pub.new(@host, @api_key, nil, @debug)
|
49
|
+
# Set contact token from cookie
|
50
|
+
@mints_pub.client.session_token = @contact_token
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
File without changes
|
@@ -14,6 +14,11 @@ module Mints
|
|
14
14
|
'Content-Type'=> 'application/json',
|
15
15
|
'Accept'=> 'application/json'
|
16
16
|
}
|
17
|
+
# Set contact token id as header
|
18
|
+
if cookies[:mints_contact_id]
|
19
|
+
headers['ContactToken'] = cookies[:mints_contact_id]
|
20
|
+
end
|
21
|
+
# Set contact session token as header
|
17
22
|
if cookies[:mints_contact_session_token]
|
18
23
|
session_token = cookies[:mints_contact_session_token]
|
19
24
|
headers["Authorization"] = "Bearer #{session_token}"
|
@@ -80,7 +85,7 @@ module Mints
|
|
80
85
|
config = YAML.load template.result(binding)
|
81
86
|
@host = config["mints"]["host"]
|
82
87
|
@api_key = config["mints"]["api_key"]
|
83
|
-
@redis_server = Redis.new(host: config['redis_cache']['redis_host']) if config['redis_cache']['use_cache']
|
88
|
+
@redis_server = Redis.new(host: config['redis_cache']['redis_host'], port: config['redis_cache']['redis_port'] ? config['redis_cache']['redis_port'] : 6379, db: config['redis_cache']['redis_db'] ? config['redis_cache']['redis_db'] : 1) if config['redis_cache']['use_cache']
|
84
89
|
@redis_config = config['redis_cache']
|
85
90
|
@use_cache = config['redis_cache']['use_cache']
|
86
91
|
end
|
@@ -76,7 +76,7 @@ module Mints
|
|
76
76
|
config = YAML.load template.result(binding)
|
77
77
|
@host = config["mints"]["host"]
|
78
78
|
@api_key = config["mints"]["api_key"]
|
79
|
-
@redis_server = Redis.new(host: config['redis_cache']['redis_host']) if config['redis_cache']['use_cache']
|
79
|
+
@redis_server = Redis.new(host: config['redis_cache']['redis_host'], port: config['redis_cache']['redis_port'] ? config['redis_cache']['redis_port'] : 6379, db: config['redis_cache']['redis_db'] ? config['redis_cache']['redis_db'] : 1) if config['redis_cache']['use_cache']
|
80
80
|
@redis_config = config['redis_cache']
|
81
81
|
@use_cache = config['redis_cache']['use_cache']
|
82
82
|
end
|
@@ -14,7 +14,7 @@ module Mints
|
|
14
14
|
'Content-Type'=> 'application/json',
|
15
15
|
'Accept'=> 'application/json'
|
16
16
|
}
|
17
|
-
if cookies[:
|
17
|
+
if cookies[:mints_user_session_token]
|
18
18
|
session_token = cookies[:mints_user_session_token]
|
19
19
|
headers["Authorization"] = "Bearer #{session_token}"
|
20
20
|
end
|
@@ -80,7 +80,7 @@ module Mints
|
|
80
80
|
config = YAML.load template.result(binding)
|
81
81
|
@host = config["mints"]["host"]
|
82
82
|
@api_key = config["mints"]["api_key"]
|
83
|
-
@redis_server = Redis.new(host: config['redis_cache']['redis_host'])
|
83
|
+
@redis_server = Redis.new(host: config['redis_cache']['redis_host'], port: config['redis_cache']['redis_port'] ? config['redis_cache']['redis_port'] : 6379, db: config['redis_cache']['redis_db'] ? config['redis_cache']['redis_db'] : 1) if config['redis_cache']['use_cache']
|
84
84
|
@redis_config = config['redis_cache']
|
85
85
|
@use_cache = config['redis_cache']['use_cache'] if config['redis_cache']['use_cache']
|
86
86
|
end
|
data/lib/pub.rb
CHANGED
@@ -5,6 +5,10 @@ module Mints
|
|
5
5
|
# == Public context API
|
6
6
|
# Pub class contains functions that needs only an API key as authentication
|
7
7
|
# == Usage example
|
8
|
+
# === For Mints::BaseController inheritance:
|
9
|
+
# If the controller is inheriting from Mints::BaseController, Only use the class variable *mints_pub* _Example:_
|
10
|
+
# @mints_pub.get_stories
|
11
|
+
# === For standalone usage:
|
8
12
|
# Initialize
|
9
13
|
# pub = Mints::Pub.new(mints_url, api_key)
|
10
14
|
# or if host and api_key are provided by mints_config.yml.erb
|
@@ -12,23 +16,58 @@ module Mints
|
|
12
16
|
# Call any function
|
13
17
|
# pub.get_products
|
14
18
|
# == Single resource options
|
15
|
-
# * +include+ - [
|
16
|
-
#
|
17
|
-
# * +
|
18
|
-
#
|
19
|
+
# * +include+ - [_String_] Specify additional information to be included in the results from the objects relations. _Example:_
|
20
|
+
# { "include": "events" }
|
21
|
+
# * +attributes+ - [_Boolean_] If present, attributes will be returned for each record in the results. _Example:_
|
22
|
+
# { "attributes": true }
|
23
|
+
# * +categories+ - [_Boolean_] If present, categories will be returned for each record in the results. _Example:_
|
24
|
+
# { "categories": true }
|
25
|
+
# * +tags+ - [_Boolean_] If present, tags will be returned for each record in the results. _Example:_
|
26
|
+
# { "tags": true }
|
27
|
+
# * +fields+ - [_String_] Specify the fields that you want to be returned. If empty, all fields are returned. The object index can also be used to specify specific fields from relations. _Example:_
|
28
|
+
# { "fields": "id, title, slug" }
|
29
|
+
# { "fields[products]": "id, title, slug" }
|
30
|
+
#
|
19
31
|
# == Resource collections options
|
20
|
-
# * +search+ - [
|
21
|
-
#
|
22
|
-
# * +
|
23
|
-
#
|
24
|
-
# * +
|
25
|
-
#
|
26
|
-
# * +
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
+
# * +search+ - [_String_] If present, it will search for records matching the search string. _Example:_
|
33
|
+
# { "search": "searchstring" }
|
34
|
+
# * +scopes+ - [_String_] If present, it will apply the specified Model's scopes. _Example:_
|
35
|
+
# { "scopes": "approved, recent" }
|
36
|
+
# * +filters+ - [_String_] This is a powerful parameter that allows the data to be filtered by any of its fields. Currently only exact matches are supported. _Example:_
|
37
|
+
# { "filters[title]": "titleToFilter" }
|
38
|
+
# * +jfilters+ - [_String_] A complex filter configuration, as used in segments, in JSON format, base64 encoded and URLencoded. _Example:_
|
39
|
+
# jfilter = {
|
40
|
+
# "type":"group",
|
41
|
+
# "items":[
|
42
|
+
# {
|
43
|
+
# "type":"attribute",
|
44
|
+
# "operator":"==",
|
45
|
+
# "slug":"title",
|
46
|
+
# "value":"Action movies"
|
47
|
+
# }
|
48
|
+
# ],
|
49
|
+
# "operator":"or"
|
50
|
+
# }
|
51
|
+
# options = { "jfilters": jfilter }
|
52
|
+
# * +catfilters+ - [_String_] filter by categories. _Example:_
|
53
|
+
# { "catfilters": "categoryName" }
|
54
|
+
# * +fields+ - [_String_] Specify the fields that you want to be returned. If empty, all fields are returned. The object index can also be used to specify specific fields from relations. _Example:_
|
55
|
+
# { "fields": "id, title, slug" }
|
56
|
+
# { "fields[products]": "id, title, slug" }
|
57
|
+
# * +sort+ - [_String_] The name of the field to perform the sort. Prefix the value with a minus sign - for ascending order. _Example:_
|
58
|
+
# { "sort": "title" }
|
59
|
+
# { "sort": "-title" }
|
60
|
+
# * +include+ - [_String_] Specify additional information to be included in the results from the objects relations. _Example:_
|
61
|
+
# { "include": "events" }
|
62
|
+
# * +attributes+ - [_Boolean_] If present, attributes will be returned for each record in the results. _Example:_
|
63
|
+
# { "attributes": true }
|
64
|
+
# * +categories+ - [_Boolean_] If present, categories will be returned for each record in the results. _Example:_
|
65
|
+
# { "categories": true }
|
66
|
+
# * +taxonomies+ - [_Boolean_] If present, taxonomies will be returned for each record in the results. _Example:_
|
67
|
+
# { "taxonomies": true }
|
68
|
+
# * +tags+ - [_Boolean_] If present, tags will be returned for each record in the results. _Example:_
|
69
|
+
# { "tags": true }
|
70
|
+
|
32
71
|
class Pub
|
33
72
|
attr_reader :client
|
34
73
|
|
@@ -42,8 +81,8 @@ module Mints
|
|
42
81
|
# * +contact_token+ - [String] Cookie 'mints_contact_id' value (mints_contact_token)
|
43
82
|
# ==== Return
|
44
83
|
# Returns a Client object
|
45
|
-
def initialize(host, api_key,
|
46
|
-
@client = Mints::Client.new(host, api_key,
|
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)
|
47
86
|
end
|
48
87
|
|
49
88
|
##
|
@@ -77,58 +116,15 @@ module Mints
|
|
77
116
|
end
|
78
117
|
|
79
118
|
##
|
80
|
-
# === Get
|
81
|
-
# Get a
|
82
|
-
#
|
83
|
-
# ==== Parameters
|
84
|
-
# * +slug+ - [String] It's the slug
|
85
|
-
# * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
|
86
|
-
def get_content_page(slug, options = nil)
|
87
|
-
return @client.raw("get", "/content/content-pages/#{slug}", options)
|
88
|
-
end
|
89
|
-
|
90
|
-
##
|
91
|
-
# === Get Content Templates.
|
92
|
-
# Get a collection of content templates
|
93
|
-
#
|
94
|
-
# ==== Parameters
|
95
|
-
# * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
|
96
|
-
def get_content_templates(options = nil)
|
97
|
-
return @client.raw("get", "/content/content-templates", options)
|
98
|
-
end
|
99
|
-
|
100
|
-
##
|
101
|
-
# === Get Content Template.
|
102
|
-
# Get a single content template.
|
103
|
-
#
|
104
|
-
# ==== Parameters
|
105
|
-
# * +slug+ - [String] It's the string identifier generated by Mints
|
106
|
-
# * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
|
107
|
-
def get_content_template(slug, options = nil)
|
108
|
-
return @client.raw("get", "/content/content-templates/#{slug}", options)
|
109
|
-
end
|
110
|
-
|
111
|
-
##
|
112
|
-
# === Get Content Instances.
|
113
|
-
# Get a collection of content instances
|
119
|
+
# === Get Asset Info.
|
120
|
+
# Get a description of an Asset
|
114
121
|
#
|
115
122
|
# ==== Parameters
|
116
|
-
# * +
|
117
|
-
def
|
118
|
-
return @client.raw("get", "/content/
|
123
|
+
# * +slug+ - [String] It's the string identifier of the asset.
|
124
|
+
def get_asset_info(slug)
|
125
|
+
return @client.raw("get", "/content/asset-info/#{slug}")
|
119
126
|
end
|
120
|
-
|
121
|
-
##
|
122
|
-
# === Get Content Instance.
|
123
|
-
# Get a single content instance.
|
124
|
-
#
|
125
|
-
# ==== Parameters
|
126
|
-
# * +slug+ - [String] It's the string identifier generated by Mints
|
127
|
-
# * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
|
128
|
-
def get_content_instance(slug, options = nil)
|
129
|
-
return @client.raw("get", "/content/content-instances/#{slug}", options)
|
130
|
-
end
|
131
|
-
|
127
|
+
|
132
128
|
##
|
133
129
|
# === Get Stories.
|
134
130
|
# Get a collection of stories
|
@@ -178,72 +174,82 @@ module Mints
|
|
178
174
|
# ==== Parameters
|
179
175
|
# * +data+ - [Hash] Data to be submited
|
180
176
|
def submit_form(data)
|
181
|
-
return @client.raw("post", "/forms/
|
182
|
-
end
|
177
|
+
return @client.raw("post", "/content/forms/submit", nil, data)
|
178
|
+
end
|
183
179
|
|
184
180
|
##
|
185
|
-
# === Get
|
186
|
-
# Get a collection of
|
181
|
+
# === Get Content Instances.
|
182
|
+
# Get a collection of content instances
|
187
183
|
#
|
188
184
|
# ==== Parameters
|
189
185
|
# * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
|
190
|
-
def
|
191
|
-
return @client.raw("get", "/
|
186
|
+
def get_content_instances(options = nil)
|
187
|
+
return @client.raw("get", "/content/content-instances", options)
|
192
188
|
end
|
193
189
|
|
194
190
|
##
|
195
|
-
# === Get
|
196
|
-
# Get a single
|
191
|
+
# === Get Content Instance.
|
192
|
+
# Get a single content instance.
|
197
193
|
#
|
198
194
|
# ==== Parameters
|
199
195
|
# * +slug+ - [String] It's the string identifier generated by Mints
|
200
196
|
# * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
|
201
|
-
def
|
202
|
-
return @client.raw("get", "/
|
197
|
+
def get_content_instance(slug, options = nil)
|
198
|
+
return @client.raw("get", "/content/content-instances/#{slug}", options)
|
203
199
|
end
|
204
200
|
|
205
201
|
##
|
206
|
-
# === Get
|
207
|
-
# Get
|
202
|
+
# === Get Content Pages.
|
203
|
+
# Get all content pages.
|
208
204
|
#
|
209
205
|
# ==== Parameters
|
210
206
|
# * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
|
211
|
-
def
|
212
|
-
return @client.raw("get", "/
|
207
|
+
def get_content_pages(options = nil)
|
208
|
+
return @client.raw("get", "/content/content-pages", options)
|
213
209
|
end
|
214
210
|
|
215
211
|
##
|
216
|
-
# === Get
|
217
|
-
# Get a
|
212
|
+
# === Get Content Page.
|
213
|
+
# Get a single content page
|
218
214
|
#
|
219
215
|
# ==== Parameters
|
220
|
-
# * +slug+ - [String] It's the
|
216
|
+
# * +slug+ - [String] It's the slug
|
221
217
|
# * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
|
222
|
-
def
|
223
|
-
return @client.raw("get", "/
|
218
|
+
def get_content_page(slug, options = nil)
|
219
|
+
return @client.raw("get", "/content/content-pages/#{slug}", options)
|
220
|
+
end
|
221
|
+
|
222
|
+
##
|
223
|
+
# === Get Locations.
|
224
|
+
# Get all locations.
|
225
|
+
#
|
226
|
+
# ==== Parameters
|
227
|
+
# * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
|
228
|
+
def get_locations(options = nil)
|
229
|
+
return @client.raw("get", "/ecommerce/locations", options)
|
224
230
|
end
|
225
231
|
|
226
232
|
##
|
227
|
-
# === Get
|
228
|
-
# Get a collection of
|
233
|
+
# === Get Products.
|
234
|
+
# Get a collection of products.
|
229
235
|
#
|
230
236
|
# ==== Parameters
|
231
237
|
# * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
|
232
|
-
def
|
233
|
-
return @client.raw("get", "/ecommerce/
|
238
|
+
def get_products(options = nil)
|
239
|
+
return @client.raw("get", "/ecommerce/products", options)
|
234
240
|
end
|
235
241
|
|
236
242
|
##
|
237
|
-
# === Get
|
238
|
-
# Get a single
|
243
|
+
# === Get Product.
|
244
|
+
# Get a single product.
|
239
245
|
#
|
240
246
|
# ==== Parameters
|
241
247
|
# * +slug+ - [String] It's the string identifier generated by Mints
|
242
248
|
# * +options+ - [Hash] List of {Single Resource Options}[#class-Mints::Pub-label-Single+resource+options] shown above can be used as parameter
|
243
|
-
def
|
244
|
-
return @client.raw("get", "/ecommerce/
|
249
|
+
def get_product(slug, options = nil)
|
250
|
+
return @client.raw("get", "/ecommerce/products/#{slug}", options)
|
245
251
|
end
|
246
|
-
|
252
|
+
|
247
253
|
##
|
248
254
|
# === Get categories.
|
249
255
|
# Get a collection of categories.
|
@@ -286,16 +292,6 @@ module Mints
|
|
286
292
|
return @client.raw("get", "/config/tags/#{slug}", options)
|
287
293
|
end
|
288
294
|
|
289
|
-
##
|
290
|
-
# === Get Attributes.
|
291
|
-
# Get a collection of attributes.
|
292
|
-
#
|
293
|
-
# ==== Parameters
|
294
|
-
# * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
|
295
|
-
def get_attributes(options = nil)
|
296
|
-
return @client.raw("get", "/config/attributes", options)
|
297
|
-
end
|
298
|
-
|
299
295
|
##
|
300
296
|
# === Get Taxonomies.
|
301
297
|
# Get a collection of taxonomies.
|
@@ -316,5 +312,15 @@ module Mints
|
|
316
312
|
def get_taxonomy(slug, options = nil)
|
317
313
|
return @client.raw("get", "/config/taxonomies/#{slug}", options)
|
318
314
|
end
|
315
|
+
|
316
|
+
##
|
317
|
+
# === Get Attributes.
|
318
|
+
# Get a collection of attributes.
|
319
|
+
#
|
320
|
+
# ==== Parameters
|
321
|
+
# * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter
|
322
|
+
def get_attributes(options = nil)
|
323
|
+
return @client.raw("get", "/config/attributes", options)
|
324
|
+
end
|
319
325
|
end
|
320
326
|
end
|
data/lib/user.rb
CHANGED
@@ -29,7 +29,7 @@ module Mints
|
|
29
29
|
class User
|
30
30
|
attr_reader :client
|
31
31
|
def initialize(host, api_key, session_token = nil, debug = false)
|
32
|
-
@client = Mints::Client.new(host, api_key, 'user', session_token, debug)
|
32
|
+
@client = Mints::Client.new(host, api_key, 'user', session_token, nil, debug)
|
33
33
|
end
|
34
34
|
|
35
35
|
def login(email, password)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruben Gomez Garcia, Omar Mora, Luis Payan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -117,7 +117,7 @@ extensions: []
|
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
119
|
- Gemfile
|
120
|
-
-
|
120
|
+
- README.md
|
121
121
|
- lib/client.rb
|
122
122
|
- lib/contact.rb
|
123
123
|
- lib/generators/mints_config.yml.erb
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/generators/mints_user_controller.rb
|
128
128
|
- lib/mints.rb
|
129
129
|
- lib/mints/controllers/admin_base_controller.rb
|
130
|
+
- lib/mints/controllers/base_api_controller.rb
|
130
131
|
- lib/mints/controllers/base_controller.rb
|
131
132
|
- lib/mints/controllers/contact_api_controller.rb
|
132
133
|
- lib/mints/controllers/public_api_controller.rb
|