mints 0.0.22 → 0.0.24
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 +48 -42
- data/lib/pub.rb +12 -12
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 825f5aa3ced7f329fc47b7f6276e271e620b400b68cc257fcfac4185df953543
|
4
|
+
data.tar.gz: 9136839108a6d5d1ee3e8271ecfbe81f6550dd70c4e4e040249082b42ee3b7c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a05c9402ab40f78be94ec937db4b2cc1d91237f43ef10a3dd64aa338ec19ff95d9bd0a9fad7bbfcf939a7dfba09246c1627cdbce94462dc2afc0f418581bc3a
|
7
|
+
data.tar.gz: a3b352f0ac1b8c9ca527e370e02deba90417d510dda2c127616e319937277dc3102666eabcbd9b4d0c3763fbb3af16249076a50c044ddea9ecaab077f463985f
|
data/lib/client.rb
CHANGED
@@ -61,14 +61,7 @@ module Mints
|
|
61
61
|
if only_tracking
|
62
62
|
headers = {"Only-Tracking" => "true"}
|
63
63
|
#when is already in redis notify to California to register the object usage
|
64
|
-
cali_response = self.send("#{@scope}_#{action}", "#{full_url}", headers, compatibility_options)
|
65
|
-
if @debug
|
66
|
-
puts "CALI TRACKING RESPONSE: #{cali_response}"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
if @debug
|
71
|
-
puts "REDIS RESPONSE: #{redis_response}"
|
64
|
+
#cali_response = self.send("#{@scope}_#{action}", "#{full_url}", headers, compatibility_options)
|
72
65
|
end
|
73
66
|
else
|
74
67
|
response = self.send("#{@scope}_#{action}", "#{full_url}", nil, compatibility_options)
|
@@ -95,13 +88,26 @@ module Mints
|
|
95
88
|
action = 'delete'
|
96
89
|
response = self.send("#{@scope}_#{action}", "#{full_url}", data, compatibility_options)
|
97
90
|
end
|
91
|
+
|
98
92
|
begin
|
99
93
|
if result_from_cache
|
94
|
+
if @debug
|
95
|
+
puts "Method: #{action} \nURL: #{url} \nOptions: #{options.to_json} \nOnly tracking: #{only_tracking} \nResponse from: REDIS"
|
96
|
+
if (data)
|
97
|
+
puts "Data: #{data.to_json}"
|
98
|
+
end
|
99
|
+
end
|
100
100
|
return JSON.parse(response)
|
101
101
|
else
|
102
102
|
if (response.response.code == "404")
|
103
103
|
raise 'NotFoundError'
|
104
104
|
end
|
105
|
+
if @debug
|
106
|
+
puts "Method: #{action} \nURL: #{url} \nOptions: #{options.to_json} \nOnly tracking: #{only_tracking} \nResponse from: CALI"
|
107
|
+
if (data)
|
108
|
+
puts "Data: #{data.to_json}"
|
109
|
+
end
|
110
|
+
end
|
105
111
|
return JSON.parse(response.body)
|
106
112
|
end
|
107
113
|
rescue
|
@@ -207,55 +213,55 @@ module Mints
|
|
207
213
|
##### HTTTP CLIENTS ######
|
208
214
|
# Simple HTTP GET
|
209
215
|
def http_get(url, headers = nil)
|
210
|
-
if @debug
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
end
|
216
|
+
# if @debug
|
217
|
+
# puts "Url:"
|
218
|
+
# puts url
|
219
|
+
# puts "Headers:"
|
220
|
+
# puts headers
|
221
|
+
# puts "Method: get"
|
222
|
+
# end
|
217
223
|
return headers ? HTTParty.get(url, :headers => headers) : HTTParty.get(url)
|
218
224
|
end
|
219
225
|
|
220
226
|
# Simple HTTP POST
|
221
227
|
def http_post(url, headers = nil, data = nil)
|
222
|
-
if @debug
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
end
|
228
|
+
# if @debug
|
229
|
+
# puts "Url:"
|
230
|
+
# puts url
|
231
|
+
# puts "Headers:"
|
232
|
+
# puts headers
|
233
|
+
# puts "Data:"
|
234
|
+
# puts data
|
235
|
+
# puts "Method: post"
|
236
|
+
# end
|
231
237
|
return headers ? HTTParty.post(url, :headers=> headers, :body => data) : HTTParty.post(url, :body => data)
|
232
238
|
end
|
233
239
|
|
234
240
|
# Simple HTTP PUT
|
235
241
|
def http_put(url, headers = nil, data = nil)
|
236
|
-
if @debug
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
end
|
242
|
+
# if @debug
|
243
|
+
# puts "Url:"
|
244
|
+
# puts url
|
245
|
+
# puts "Headers:"
|
246
|
+
# puts headers
|
247
|
+
# puts "Data:"
|
248
|
+
# puts data
|
249
|
+
# puts "Method: put"
|
250
|
+
# end
|
245
251
|
return headers ? HTTParty.put(url, :headers=> headers, :body => data) : HTTParty.put(url, :body => data)
|
246
252
|
end
|
247
253
|
|
248
254
|
# Simple HTTP DELETE
|
249
255
|
def http_delete(url, headers = nil, data = nil)
|
250
|
-
if @debug
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
end
|
256
|
+
# if @debug
|
257
|
+
# puts "Url:"
|
258
|
+
# puts url
|
259
|
+
# puts "Headers:"
|
260
|
+
# puts headers
|
261
|
+
# puts "Data:"
|
262
|
+
# puts data
|
263
|
+
# puts "Method: delete"
|
264
|
+
# end
|
259
265
|
return headers ? HTTParty.delete(url, :headers=> headers, :body => data) : HTTParty.delete(url, :body => data)
|
260
266
|
end
|
261
267
|
|
data/lib/pub.rb
CHANGED
@@ -30,7 +30,7 @@ module Mints
|
|
30
30
|
# { "fields": "id, title, slug" }
|
31
31
|
# { "fields[products]": "id, title, slug" }
|
32
32
|
#
|
33
|
-
# == Resource collections options
|
33
|
+
# == Resource collections options
|
34
34
|
# * +search+ - [_String_] If present, it will search for records matching the search string. _Example:_
|
35
35
|
# { "search": "searchstring" }
|
36
36
|
# * +scopes+ - [_String_] If present, it will apply the specified Model's scopes. _Example:_
|
@@ -49,7 +49,7 @@ module Mints
|
|
49
49
|
# }
|
50
50
|
# ],
|
51
51
|
# "operator":"or"
|
52
|
-
# }
|
52
|
+
# }
|
53
53
|
# options = { "jfilters": jfilter }
|
54
54
|
# * +catfilters+ - [_String_] filter by categories. _Example:_
|
55
55
|
# { "catfilters": "categoryName" }
|
@@ -86,7 +86,7 @@ module Mints
|
|
86
86
|
def initialize(host, api_key, contact_token_id = nil, visit_id = nil, debug = false)
|
87
87
|
@client = Mints::Client.new(host, api_key, 'public', nil, contact_token_id, visit_id, debug)
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
##
|
91
91
|
# === Register Visit.
|
92
92
|
# Register a ghost/contact visit in Mints.Cloud.
|
@@ -206,7 +206,7 @@ module Mints
|
|
206
206
|
# ==== Example
|
207
207
|
# @data = @mints_pub.get_form("form_slug")
|
208
208
|
def get_form(slug)
|
209
|
-
return @client.raw("get", "/content/forms/#{slug}", nil, nil, nil, nil,
|
209
|
+
return @client.raw("get", "/content/forms/#{slug}", nil, nil, nil, nil, false)
|
210
210
|
end
|
211
211
|
|
212
212
|
##
|
@@ -228,11 +228,11 @@ module Mints
|
|
228
228
|
# @data = @mints_pub.submit_form(data)
|
229
229
|
def submit_form(data)
|
230
230
|
return @client.raw("post", "/content/forms/submit", nil, data_transform(data))
|
231
|
-
end
|
231
|
+
end
|
232
232
|
|
233
233
|
##
|
234
234
|
# === Get Content Instances.
|
235
|
-
# Get a collection of content instances. _Note:_ Options must be specified.
|
235
|
+
# Get a collection of content instances. _Note:_ Options must be specified.
|
236
236
|
#
|
237
237
|
# ==== Parameters
|
238
238
|
# options:: (Hash) -- List of {Resource collection Options}[#class-Mints::Pub-label-Resource+collections+options+] shown above can be used as parameter.
|
@@ -249,7 +249,7 @@ module Mints
|
|
249
249
|
# "sort": "-id"
|
250
250
|
# }
|
251
251
|
# @data = @mints_pub.get_content_instances(options)
|
252
|
-
def get_content_instances(options)
|
252
|
+
def get_content_instances(options)
|
253
253
|
return @client.raw("get", "/content/content-instances", options)
|
254
254
|
end
|
255
255
|
|
@@ -287,7 +287,7 @@ module Mints
|
|
287
287
|
# ==== Example
|
288
288
|
# @data = @mints_pub.get_content_page("test-page")
|
289
289
|
def get_content_page(slug)
|
290
|
-
return @client.raw("get", "/content/content-pages/#{slug}", nil, nil, nil, nil,
|
290
|
+
return @client.raw("get", "/content/content-pages/#{slug}", nil, nil, nil, nil, false)
|
291
291
|
end
|
292
292
|
|
293
293
|
### V1/ECOMMERCE ###
|
@@ -313,7 +313,7 @@ module Mints
|
|
313
313
|
def get_locations(options = nil, use_post = true)
|
314
314
|
return get_query_results("/ecommerce/locations", options, use_post)
|
315
315
|
end
|
316
|
-
|
316
|
+
|
317
317
|
##
|
318
318
|
# === Get Products.
|
319
319
|
# Get a collection of products.
|
@@ -444,7 +444,7 @@ module Mints
|
|
444
444
|
def get_tag(slug, options = nil)
|
445
445
|
return @client.raw("get", "/config/tags/#{slug}", options)
|
446
446
|
end
|
447
|
-
|
447
|
+
|
448
448
|
##
|
449
449
|
# === Get Taxonomies.
|
450
450
|
# Get a collection of taxonomies.
|
@@ -458,13 +458,13 @@ module Mints
|
|
458
458
|
#
|
459
459
|
# ==== Second Example
|
460
460
|
# options = {
|
461
|
-
# "fields": "id, title"
|
461
|
+
# "fields": "id, title"
|
462
462
|
# }
|
463
463
|
# @data = @mints_pub.get_taxonomies(options)
|
464
464
|
#
|
465
465
|
# ==== Third Example
|
466
466
|
# options = {
|
467
|
-
# "fields": "id, title"
|
467
|
+
# "fields": "id, title"
|
468
468
|
# }
|
469
469
|
# @data = @mints_pub.get_taxonomies(options, false)
|
470
470
|
def get_taxonomies(options = nil, use_post = true)
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -28,80 +28,80 @@ dependencies:
|
|
28
28
|
name: httparty
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.18.0
|
34
|
-
- - "
|
34
|
+
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: 0.18.0
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "
|
41
|
+
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 0.18.0
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 0.18.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: redis
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 4.2.2
|
54
|
-
- - "
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 4.2.2
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 4.2.2
|
64
|
-
- - "
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 4.2.2
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: addressable
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - "
|
71
|
+
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: 2.7.0
|
74
|
-
- - "
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 2.7.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: 2.7.0
|
84
|
-
- - "
|
84
|
+
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: 2.7.0
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: rails-reverse-proxy
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
|
-
- - "
|
91
|
+
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: 0.9.1
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.9.1
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 0.9.1
|
104
|
-
- - "
|
104
|
+
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: 0.9.1
|
107
107
|
description:
|
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
210
|
- !ruby/object:Gem::Version
|
211
211
|
version: '0'
|
212
212
|
requirements: []
|
213
|
-
rubygems_version: 3.
|
213
|
+
rubygems_version: 3.1.6
|
214
214
|
signing_key:
|
215
215
|
specification_version: 4
|
216
216
|
summary: MINTS gem allows to connect your Rails App to MINTS.CLOUD
|