mints 0.0.34 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/client.rb +52 -23
- data/lib/contact.rb +8 -1
- data/lib/errors.rb +10 -1
- data/lib/mints/controllers/concerns/mints_clients.rb +5 -9
- data/lib/mints/controllers/concerns/read_config_file.rb +8 -8
- data/lib/pub.rb +8 -1
- data/lib/user/config/config.rb +5 -1
- data/lib/user/config/export_configuration.rb +68 -0
- data/lib/user/config/exports.rb +66 -0
- data/lib/user/config/public_folders.rb +1 -1
- data/lib/user/content/adaptive_object_templates.rb +96 -0
- data/lib/user/content/adaptive_objects.rb +110 -0
- data/lib/user/content/content.rb +4 -0
- data/lib/user/crm/deals.rb +2 -2
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c100af9660b055054f9a68e24127dfe5c7aa16f533cd6a00573dc603dc1a86ff
|
4
|
+
data.tar.gz: a21194b539f6142e7a4984c83025eabc252806345d43aa2d7263777af354d28f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2d83e9f780a1aeddb8e38ee2dd2f970c3350b6c8f15bae3cc539469d37557e79cee1e5756aa1333e395352e94c027b111d1654cbe8e5e6adb153636f74ba9a0
|
7
|
+
data.tar.gz: 2ebb1bd5f81fa5a8adac700afd1fb775aceff149b3309cdb4d1ddd31d366c20ec2d905b1c861681ff3a0a995bcbb02c2544f972df5e21daa0e22f5cfb76e47bf
|
data/lib/client.rb
CHANGED
@@ -10,12 +10,8 @@ module Mints
|
|
10
10
|
class Client
|
11
11
|
extend ActiveSupport::Concern
|
12
12
|
|
13
|
-
attr_reader :host
|
14
|
-
|
15
|
-
attr_reader :scope
|
16
|
-
attr_reader :base_url
|
17
|
-
attr_accessor :session_token
|
18
|
-
attr_accessor :contact_token_id
|
13
|
+
attr_reader :host, :mode, :api_key, :scope, :base_url
|
14
|
+
attr_accessor :session_token, :contact_token_id
|
19
15
|
|
20
16
|
def initialize(
|
21
17
|
host,
|
@@ -52,6 +48,24 @@ module Mints
|
|
52
48
|
base_url = @base_url unless base_url
|
53
49
|
uri = ''
|
54
50
|
|
51
|
+
# get the first method called in this instance, example: get_deal(1)
|
52
|
+
method_called = caller[0][/`.*'/][1..-2]
|
53
|
+
|
54
|
+
# this can't be "!url.last.to_i" because we have methods like .me
|
55
|
+
if is_singular?(method_called) && %w[// nil].include?(url)
|
56
|
+
error_class = Errors::DynamicError.new(
|
57
|
+
self,
|
58
|
+
'Unprocessed entity',
|
59
|
+
"Id must be a valid integer number, given URL: #{url}",
|
60
|
+
'undefined_id',
|
61
|
+
nil
|
62
|
+
)
|
63
|
+
|
64
|
+
raise error_class if @debug
|
65
|
+
|
66
|
+
raise error_class.error
|
67
|
+
end
|
68
|
+
|
55
69
|
if options&.class == Hash
|
56
70
|
need_encoding = %w[jfilters afilters rfilters]
|
57
71
|
found_options_with_encoding = options.keys.select { |key| need_encoding.include?(key.to_s.downcase) and options[key]&.class == Hash }
|
@@ -82,13 +96,12 @@ module Mints
|
|
82
96
|
url_need_cache = true
|
83
97
|
@redis_server = Redis.new(
|
84
98
|
host: config['redis_cache']['redis_host'],
|
85
|
-
port: config
|
86
|
-
db: config
|
99
|
+
port: config.dig('redis_cache', 'redis_port') || 6379,
|
100
|
+
db: config.dig('redis_cache', 'redis_db') || 1
|
87
101
|
)
|
88
|
-
|
102
|
+
response = @redis_server.get(full_url)
|
89
103
|
|
90
|
-
if
|
91
|
-
response = redis_response
|
104
|
+
if response
|
92
105
|
result_from_cache = true
|
93
106
|
|
94
107
|
if only_tracking
|
@@ -126,20 +139,20 @@ module Mints
|
|
126
139
|
verify_response_status(response, config['sdk']['ignore_http_errors'])
|
127
140
|
|
128
141
|
begin
|
129
|
-
if
|
130
|
-
if
|
131
|
-
|
132
|
-
|
133
|
-
|
142
|
+
if @debug
|
143
|
+
response_from = if result_from_cache
|
144
|
+
'REDIS'
|
145
|
+
else
|
146
|
+
'CALI'
|
147
|
+
end
|
148
|
+
|
149
|
+
puts "Method: #{action} \nURL: #{url} \nOptions: #{options&.to_json} \nOnly tracking: #{only_tracking} \nResponse from: #{response_from}"
|
150
|
+
puts "Data: #{data.to_json}" if data
|
151
|
+
end
|
134
152
|
|
153
|
+
if result_from_cache
|
135
154
|
return JSON.parse(response)
|
136
155
|
else
|
137
|
-
|
138
|
-
if @debug
|
139
|
-
puts "Method: #{action} \nURL: #{url} \nOptions: #{options&.to_json} \nOnly tracking: #{only_tracking} \nResponse from: CALI"
|
140
|
-
puts "Data: #{data.to_json}" if data
|
141
|
-
end
|
142
|
-
|
143
156
|
return JSON.parse(response&.body)
|
144
157
|
end
|
145
158
|
rescue
|
@@ -155,7 +168,19 @@ module Mints
|
|
155
168
|
name_len = name_splitted.size
|
156
169
|
# the action always be the first element
|
157
170
|
action = name_splitted.first
|
158
|
-
|
171
|
+
valid_actions = %w[
|
172
|
+
get
|
173
|
+
create
|
174
|
+
post
|
175
|
+
update
|
176
|
+
put
|
177
|
+
delete
|
178
|
+
destroy
|
179
|
+
verify_response_status
|
180
|
+
]
|
181
|
+
|
182
|
+
raise 'NoActionError' unless valid_actions.include?(action)
|
183
|
+
|
159
184
|
# the object always be the last element
|
160
185
|
object = separator == '__' ? name_splitted.last.gsub('_', '-') : name_splitted.last
|
161
186
|
# get intermediate url elements
|
@@ -388,5 +413,9 @@ module Mints
|
|
388
413
|
rescue StandardError
|
389
414
|
nil
|
390
415
|
end
|
416
|
+
|
417
|
+
def is_singular?(str)
|
418
|
+
str.pluralize != str && str.singularize == str
|
419
|
+
end
|
391
420
|
end
|
392
421
|
end
|
data/lib/contact.rb
CHANGED
@@ -30,7 +30,14 @@ module Mints
|
|
30
30
|
#
|
31
31
|
# ==== Return
|
32
32
|
# Returns a Contact object
|
33
|
-
def initialize(
|
33
|
+
def initialize(
|
34
|
+
host,
|
35
|
+
api_key,
|
36
|
+
session_token = nil,
|
37
|
+
contact_token_id = nil,
|
38
|
+
debug = false,
|
39
|
+
timeouts = {}
|
40
|
+
)
|
34
41
|
@contact_v1_url = '/api/contact/v1'
|
35
42
|
@client = Mints::Client.new(
|
36
43
|
host,
|
data/lib/errors.rb
CHANGED
@@ -12,6 +12,7 @@ module Mints
|
|
12
12
|
'404' => 'ResourceNotFoundException',
|
13
13
|
'422' => 'ValidationException',
|
14
14
|
'405' => 'MethodNotAllowedException',
|
15
|
+
'undefined_id' => 'UndefinedIdException',
|
15
16
|
'default' => 'InternalServerException',
|
16
17
|
}
|
17
18
|
|
@@ -79,6 +80,8 @@ module Mints
|
|
79
80
|
|
80
81
|
class MethodNotAllowedException < ServiceError; end
|
81
82
|
|
83
|
+
class UndefinedIdException < ServiceError; end
|
84
|
+
|
82
85
|
class ValidationException < ServiceError
|
83
86
|
|
84
87
|
def to_h
|
@@ -87,7 +90,13 @@ module Mints
|
|
87
90
|
|
88
91
|
def errors_hash
|
89
92
|
{
|
90
|
-
errors: response.
|
93
|
+
errors: if response.is_a? Hash
|
94
|
+
response.keys.reduce([]) do |carry, error_key|
|
95
|
+
carry + (response[error_key].is_a?(Array) ? response[error_key] : [response[error_key]] )
|
96
|
+
end
|
97
|
+
else
|
98
|
+
response
|
99
|
+
end
|
91
100
|
}
|
92
101
|
end
|
93
102
|
|
@@ -51,8 +51,7 @@ module MintsClients
|
|
51
51
|
@api_key,
|
52
52
|
contact_token_id,
|
53
53
|
visit_id,
|
54
|
-
@debug
|
55
|
-
mints_sdk_timeouts_config
|
54
|
+
@debug
|
56
55
|
)
|
57
56
|
end
|
58
57
|
|
@@ -68,8 +67,7 @@ module MintsClients
|
|
68
67
|
@api_key,
|
69
68
|
contact_session_token,
|
70
69
|
contact_token_id,
|
71
|
-
@debug
|
72
|
-
mints_sdk_timeouts_config
|
70
|
+
@debug
|
73
71
|
)
|
74
72
|
end
|
75
73
|
|
@@ -83,8 +81,7 @@ module MintsClients
|
|
83
81
|
@host,
|
84
82
|
@api_key,
|
85
83
|
user_session_token,
|
86
|
-
@debug
|
87
|
-
mints_sdk_timeouts_config
|
84
|
+
@debug
|
88
85
|
)
|
89
86
|
end
|
90
87
|
|
@@ -97,8 +94,7 @@ module MintsClients
|
|
97
94
|
@host,
|
98
95
|
@api_key,
|
99
96
|
@api_key,
|
100
|
-
@debug
|
101
|
-
mints_sdk_timeouts_config
|
97
|
+
@debug
|
102
98
|
)
|
103
99
|
end
|
104
|
-
end
|
100
|
+
end
|
@@ -12,17 +12,17 @@ module ReadConfigFile
|
|
12
12
|
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
13
13
|
config = YAML.safe_load template.result(binding)
|
14
14
|
|
15
|
-
@host = config
|
16
|
-
@api_key = config
|
17
|
-
@debug = !!config
|
18
|
-
@redis_config = config
|
19
|
-
@use_cache = config
|
15
|
+
@host = config.dig('mints', 'host')
|
16
|
+
@api_key = config.dig('mints', 'api_key')
|
17
|
+
@debug = !!config.dig('mints', 'debug')
|
18
|
+
@redis_config = config.dig('mints', 'redis_cache')
|
19
|
+
@use_cache = config.dig('mints', 'redis_cache', 'use_cache')
|
20
20
|
|
21
21
|
if @use_cache
|
22
22
|
@redis_server = Redis.new(
|
23
|
-
host: config
|
24
|
-
port: config
|
25
|
-
db: config
|
23
|
+
host: config.dig('mints', 'redis_cache', 'redis_host'),
|
24
|
+
port: config.dig('mints', 'redis_cache', 'redis_port') || 6379,
|
25
|
+
db: config.dig('mints', 'redis_cache', 'redis_db') || 1
|
26
26
|
)
|
27
27
|
end
|
28
28
|
end
|
data/lib/pub.rb
CHANGED
@@ -81,7 +81,14 @@ module Mints
|
|
81
81
|
#
|
82
82
|
# ==== Return
|
83
83
|
# Returns a Client object.
|
84
|
-
def initialize(
|
84
|
+
def initialize(
|
85
|
+
host,
|
86
|
+
api_key,
|
87
|
+
contact_token_id = nil,
|
88
|
+
visit_id = nil,
|
89
|
+
debug = false,
|
90
|
+
timeouts = {}
|
91
|
+
)
|
85
92
|
@client = Mints::Client.new(
|
86
93
|
host,
|
87
94
|
api_key,
|
data/lib/user/config/config.rb
CHANGED
@@ -5,6 +5,8 @@ require_relative './appointments'
|
|
5
5
|
require_relative './attribute_groups'
|
6
6
|
require_relative './attributes'
|
7
7
|
require_relative './calendars'
|
8
|
+
require_relative './exports'
|
9
|
+
require_relative './export_configuration'
|
8
10
|
require_relative './public_folders'
|
9
11
|
require_relative './relationships'
|
10
12
|
require_relative './roles'
|
@@ -21,7 +23,9 @@ module Config
|
|
21
23
|
include AttributeGroups
|
22
24
|
include Attributes
|
23
25
|
include Calendars
|
24
|
-
include
|
26
|
+
include Exports
|
27
|
+
include ExportConfiguration
|
28
|
+
include PublicFolders
|
25
29
|
include Relationships
|
26
30
|
include Roles
|
27
31
|
include Seeds
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ExportConfiguration
|
4
|
+
# === Get export_configurations.
|
5
|
+
# Get a collection of export_configurations.
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
9
|
+
#
|
10
|
+
# ==== First Example
|
11
|
+
# @data = @mints_user.get_export_configurations
|
12
|
+
#
|
13
|
+
# ==== Second Example
|
14
|
+
# options = { sort: 'id' }
|
15
|
+
# @data = @mints_user.get_export_configurations(options)
|
16
|
+
def get_export_configurations(options = nil)
|
17
|
+
@client.raw('get', '/config/export-configurations', options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# === Get export.
|
21
|
+
# Get an export configuration info.
|
22
|
+
#
|
23
|
+
# ==== Parameters
|
24
|
+
# id:: (Integer) -- Export configuration id.
|
25
|
+
#
|
26
|
+
# ==== Example
|
27
|
+
# @data = @mints_user.get_export(10)
|
28
|
+
def get_export_configuration(id)
|
29
|
+
@client.raw('get', "/config/export-configurations/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# === Create export.
|
33
|
+
# Create an export with data.
|
34
|
+
#
|
35
|
+
# ==== Parameters
|
36
|
+
# data:: (Hash) -- Data to be submitted.
|
37
|
+
#
|
38
|
+
# ==== Example
|
39
|
+
# data = {
|
40
|
+
# title: 'New configuration',
|
41
|
+
# slug: 'new-configuration',
|
42
|
+
# object_model: 'Contact',
|
43
|
+
# config_json: {}
|
44
|
+
# }
|
45
|
+
# @data = @mints_user.create_export(data)
|
46
|
+
def create_export_configuration(data)
|
47
|
+
@client.raw('post', '/config/export-configurations', nil, data_transform(data))
|
48
|
+
end
|
49
|
+
|
50
|
+
# === Update export configuration.
|
51
|
+
# Update an export configuration info.
|
52
|
+
#
|
53
|
+
# ==== Parameters
|
54
|
+
# id:: (Integer) -- Export configuration id.
|
55
|
+
# data:: (Hash) -- Data to be submitted.
|
56
|
+
#
|
57
|
+
# ==== Example
|
58
|
+
# data = {
|
59
|
+
# title: 'New configuration',
|
60
|
+
# slug: 'new-configuration',
|
61
|
+
# object_model: 'Contact',
|
62
|
+
# config_json: {}
|
63
|
+
# }
|
64
|
+
# @data = @mints_user.update_export(36, data)
|
65
|
+
def update_export_configuration(id, data)
|
66
|
+
@client.raw('put', "/config/export-configurations/#{id}", nil, data_transform(data))
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Exports
|
4
|
+
# === Get exports.
|
5
|
+
# Get a collection of exports.
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
9
|
+
#
|
10
|
+
# ==== First Example
|
11
|
+
# @data = @mints_user.get_exports
|
12
|
+
#
|
13
|
+
# ==== Second Example
|
14
|
+
# options = { sort: 'id' }
|
15
|
+
# @data = @mints_user.get_exports(options)
|
16
|
+
def get_exports(options = nil)
|
17
|
+
@client.raw('get', '/config/exports', options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# === Get export.
|
21
|
+
# Get an export info.
|
22
|
+
#
|
23
|
+
# ==== Parameters
|
24
|
+
# id:: (Integer) -- Export id.
|
25
|
+
#
|
26
|
+
# ==== Example
|
27
|
+
# @data = @mints_user.get_export(10)
|
28
|
+
def get_export(id)
|
29
|
+
@client.raw('get', "/config/exports/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# === Create export.
|
33
|
+
# Create an export with data.
|
34
|
+
#
|
35
|
+
# ==== Parameters
|
36
|
+
# data:: (Hash) -- Data to be submitted.
|
37
|
+
#
|
38
|
+
# ==== Example
|
39
|
+
# data = {
|
40
|
+
# title: 'New export',
|
41
|
+
# slug: 'new-export',
|
42
|
+
# object_type: 'contacts'
|
43
|
+
# }
|
44
|
+
# @data = @mints_user.create_export(data)
|
45
|
+
def create_export(data)
|
46
|
+
@client.raw('post', '/config/exports', nil, data_transform(data))
|
47
|
+
end
|
48
|
+
|
49
|
+
# === Update export.
|
50
|
+
# Update an export info.
|
51
|
+
#
|
52
|
+
# ==== Parameters
|
53
|
+
# id:: (Integer) -- Export id.
|
54
|
+
# data:: (Hash) -- Data to be submitted.
|
55
|
+
#
|
56
|
+
# ==== Example
|
57
|
+
# data = {
|
58
|
+
# title: 'New export',
|
59
|
+
# slug: 'new-export',
|
60
|
+
# object_type: 'contacts'
|
61
|
+
# }
|
62
|
+
# @data = @mints_user.update_export(36, data)
|
63
|
+
def update_export(id, data)
|
64
|
+
@client.raw('put', "/config/exports/#{id}", nil, data_transform(data))
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AdaptiveObjectTemplates
|
4
|
+
# === Get adaptive_object_templates.
|
5
|
+
# Get a collection of adaptive_object_templates.
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# options:: (Hash) -- List of Resource Collection 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
|
+
# ==== First Example
|
12
|
+
# @data = @mints_user.get_adaptive_object_templates
|
13
|
+
#
|
14
|
+
# ==== Second Example
|
15
|
+
# options = {
|
16
|
+
# fields: 'id, slug'
|
17
|
+
# }
|
18
|
+
# @data = @mints_user.get_adaptive_object_templates(options)
|
19
|
+
#
|
20
|
+
# ==== Third Example
|
21
|
+
# options = {
|
22
|
+
# fields: 'id, slug'
|
23
|
+
# }
|
24
|
+
# @data = @mints_user.get_adaptive_object_templates(options, true)
|
25
|
+
def get_adaptive_object_templates(options = nil, use_post = true)
|
26
|
+
get_query_results('/content/adaptive-object-templates', options, use_post)
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Get adaptive_object_template.
|
30
|
+
# Get an adaptive_object_template info.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# id:: (Integer) -- Adaptive object id.
|
34
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
35
|
+
#
|
36
|
+
# ==== First Example
|
37
|
+
# @data = @mints_user.get_adaptive_object_template(1)
|
38
|
+
#
|
39
|
+
# ==== Second Example
|
40
|
+
# options = {
|
41
|
+
# fields: 'id, slug'
|
42
|
+
# }
|
43
|
+
# @data = @mints_user.get_adaptive_object_template(1, options)
|
44
|
+
def get_adaptive_object_template(id, options = nil)
|
45
|
+
@client.raw('get', "/content/adaptive-object-templates/#{id}", options)
|
46
|
+
end
|
47
|
+
|
48
|
+
# === Create adaptive_object_template.
|
49
|
+
# Create an adaptive_object_template with data.
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# data:: (Hash) -- Data to be submitted.
|
53
|
+
#
|
54
|
+
# ==== Example
|
55
|
+
# data = {
|
56
|
+
# user_id: 1,
|
57
|
+
# slug: "new-adaptive_object_template",
|
58
|
+
# adaptive_object_template_template_id: 1
|
59
|
+
# }
|
60
|
+
#
|
61
|
+
# options = { fields: 'id,slug' }
|
62
|
+
#
|
63
|
+
# @data = @mints_user.create_adaptive_object_template(data, options)
|
64
|
+
def create_adaptive_object_template(data, options = nil)
|
65
|
+
@client.raw('post', '/content/adaptive-object-templates', options, data_transform(data))
|
66
|
+
end
|
67
|
+
|
68
|
+
# === Update adaptive_object_template.
|
69
|
+
# Update an adaptive_object_template info.
|
70
|
+
#
|
71
|
+
# ==== Parameters
|
72
|
+
# id:: (Integer) -- Adaptive object id.
|
73
|
+
# data:: (Hash) -- Data to be submitted.
|
74
|
+
#
|
75
|
+
# ==== Example
|
76
|
+
# data = {
|
77
|
+
# user_id: 1,
|
78
|
+
# slug: 'new-adaptive_object_template'
|
79
|
+
# }
|
80
|
+
# @data = @mints_user.update_adaptive_object_template(5, data)
|
81
|
+
def update_adaptive_object_template(id, data, options = nil)
|
82
|
+
@client.raw('put', "/content/adaptive-object-templates/#{id}", options, data_transform(data))
|
83
|
+
end
|
84
|
+
|
85
|
+
# === Delete adaptive_object_template.
|
86
|
+
# Delete an adaptive_object_template.
|
87
|
+
#
|
88
|
+
# ==== Parameters
|
89
|
+
# id:: (Integer) -- Adaptive object id.
|
90
|
+
#
|
91
|
+
# ==== Example
|
92
|
+
# @data = @mints_user.delete_adaptive_object_template(6)
|
93
|
+
def delete_adaptive_object_template(id)
|
94
|
+
@client.raw('delete', "/content/adaptive-object-templates/#{id}")
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AdaptiveObjects
|
4
|
+
# === Duplicate adaptive_object.
|
5
|
+
# Duplicate an adaptive_object.
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# id:: (Integer) -- Adaptive object id.
|
9
|
+
# data:: (Hash) -- Data to be submitted.
|
10
|
+
#
|
11
|
+
# ==== Example
|
12
|
+
# data = { options: [] }
|
13
|
+
# @data = @mints_user.duplicate_adaptive_object(1, data.to_json)
|
14
|
+
def duplicate_adaptive_object(id, data)
|
15
|
+
@client.raw('post', "/content/adaptive-objects/#{id}/duplicate", nil, data)
|
16
|
+
end
|
17
|
+
|
18
|
+
# === Get adaptive_object.
|
19
|
+
# Get a collection of adaptive_object.
|
20
|
+
#
|
21
|
+
# ==== Parameters
|
22
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
23
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
24
|
+
#
|
25
|
+
# ==== First Example
|
26
|
+
# @data = @mints_user.get_adaptive_object
|
27
|
+
#
|
28
|
+
# ==== Second Example
|
29
|
+
# options = {
|
30
|
+
# fields: 'id, slug'
|
31
|
+
# }
|
32
|
+
# @data = @mints_user.get_adaptive_object(options)
|
33
|
+
#
|
34
|
+
# ==== Third Example
|
35
|
+
# options = {
|
36
|
+
# fields: 'id, slug'
|
37
|
+
# }
|
38
|
+
# @data = @mints_user.get_adaptive_object(options, true)
|
39
|
+
def get_adaptive_objects(options = nil, use_post = true)
|
40
|
+
get_query_results('/content/adaptive-objects', options, use_post)
|
41
|
+
end
|
42
|
+
|
43
|
+
# === Get adaptive_object.
|
44
|
+
# Get an adaptive_object info.
|
45
|
+
#
|
46
|
+
# ==== Parameters
|
47
|
+
# id:: (Integer) -- Adaptive object id.
|
48
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
49
|
+
#
|
50
|
+
# ==== First Example
|
51
|
+
# @data = @mints_user.get_adaptive_object(1)
|
52
|
+
#
|
53
|
+
# ==== Second Example
|
54
|
+
# options = {
|
55
|
+
# fields: 'id, slug'
|
56
|
+
# }
|
57
|
+
# @data = @mints_user.get_adaptive_object(1, options)
|
58
|
+
def get_adaptive_object(id, options = nil)
|
59
|
+
@client.raw('get', "/content/adaptive-objects/#{id}", options)
|
60
|
+
end
|
61
|
+
|
62
|
+
# === Create adaptive_object.
|
63
|
+
# Create an adaptive_object with data.
|
64
|
+
#
|
65
|
+
# ==== Parameters
|
66
|
+
# data:: (Hash) -- Data to be submitted.
|
67
|
+
#
|
68
|
+
# ==== Example
|
69
|
+
# data = {
|
70
|
+
# user_id: 1,
|
71
|
+
# slug: "new-adaptive_object",
|
72
|
+
# adaptive_object_template_id: 1
|
73
|
+
# }
|
74
|
+
#
|
75
|
+
# options = { fields: 'id,slug' }
|
76
|
+
#
|
77
|
+
# @data = @mints_user.create_adaptive_object(data, options)
|
78
|
+
def create_adaptive_object(data, options = nil)
|
79
|
+
@client.raw('post', '/content/adaptive-objects', options, data_transform(data))
|
80
|
+
end
|
81
|
+
|
82
|
+
# === Update adaptive_object.
|
83
|
+
# Update an adaptive_object info.
|
84
|
+
#
|
85
|
+
# ==== Parameters
|
86
|
+
# id:: (Integer) -- Adaptive object id.
|
87
|
+
# data:: (Hash) -- Data to be submitted.
|
88
|
+
#
|
89
|
+
# ==== Example
|
90
|
+
# data = {
|
91
|
+
# user_id: 1,
|
92
|
+
# slug: 'new-adaptive_object'
|
93
|
+
# }
|
94
|
+
# @data = @mints_user.update_adaptive_object(5, data)
|
95
|
+
def update_adaptive_object(id, data, options = nil)
|
96
|
+
@client.raw('put', "/content/adaptive-objects/#{id}", options, data_transform(data))
|
97
|
+
end
|
98
|
+
|
99
|
+
# === Delete adaptive_object.
|
100
|
+
# Delete an adaptive_object.
|
101
|
+
#
|
102
|
+
# ==== Parameters
|
103
|
+
# id:: (Integer) -- Adaptive object id.
|
104
|
+
#
|
105
|
+
# ==== Example
|
106
|
+
# @data = @mints_user.delete_adaptive_object(6)
|
107
|
+
def delete_adaptive_object(id)
|
108
|
+
@client.raw('delete', "/content/adaptive-objects/#{id}")
|
109
|
+
end
|
110
|
+
end
|
data/lib/user/content/content.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative './assets'
|
4
|
+
require_relative './adaptive_objects'
|
5
|
+
require_relative './adaptive_object_templates'
|
4
6
|
require_relative './content_instances'
|
5
7
|
require_relative './content_templates'
|
6
8
|
require_relative './conversations'
|
@@ -16,6 +18,8 @@ require_relative './story_templates'
|
|
16
18
|
|
17
19
|
module Content
|
18
20
|
include Assets
|
21
|
+
include AdaptiveObjects
|
22
|
+
include AdaptiveObjectTemplates
|
19
23
|
include ContentInstances
|
20
24
|
include ContentTemplates
|
21
25
|
include Conversations
|
data/lib/user/crm/deals.rb
CHANGED
@@ -92,7 +92,7 @@ module Deals
|
|
92
92
|
# }
|
93
93
|
# @data = @mints_user.create_deal(data.to_json)
|
94
94
|
def create_deal(data, options = nil)
|
95
|
-
@client.raw('post', '/crm/deals', options, data)
|
95
|
+
@client.raw('post', '/crm/deals', options, data_transform(data))
|
96
96
|
end
|
97
97
|
|
98
98
|
# === Update deal.
|
@@ -108,6 +108,6 @@ module Deals
|
|
108
108
|
# }
|
109
109
|
# @data = @mints_user.update_deal(102, data.to_json)
|
110
110
|
def update_deal(id, data, options = nil)
|
111
|
-
@client.raw('put', "/crm/deals/#{id}", options, data)
|
111
|
+
@client.raw('put', "/crm/deals/#{id}", options, data_transform(data))
|
112
112
|
end
|
113
113
|
end
|
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.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo, Fabian Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -185,6 +185,8 @@ files:
|
|
185
185
|
- lib/user/config/attributes.rb
|
186
186
|
- lib/user/config/calendars.rb
|
187
187
|
- lib/user/config/config.rb
|
188
|
+
- lib/user/config/export_configuration.rb
|
189
|
+
- lib/user/config/exports.rb
|
188
190
|
- lib/user/config/public_folders.rb
|
189
191
|
- lib/user/config/relationships.rb
|
190
192
|
- lib/user/config/roles.rb
|
@@ -195,6 +197,8 @@ files:
|
|
195
197
|
- lib/user/config/teams.rb
|
196
198
|
- lib/user/config/users.rb
|
197
199
|
- lib/user/contacts/contacts.rb
|
200
|
+
- lib/user/content/adaptive_object_templates.rb
|
201
|
+
- lib/user/content/adaptive_objects.rb
|
198
202
|
- lib/user/content/assets.rb
|
199
203
|
- lib/user/content/content.rb
|
200
204
|
- lib/user/content/content_instances.rb
|