mints 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Readme.md +5 -5
- data/lib/client.rb +2 -1
- data/lib/generators/{mints_config.yml → mints_config.yml.erb} +0 -0
- data/lib/generators/mints_files_generator.rb +1 -1
- data/lib/mints/controllers/admin_base_controller.rb +3 -2
- data/lib/mints/controllers/base_controller.rb +4 -3
- data/lib/mints/controllers/contact_api_controller.rb +3 -2
- data/lib/mints/controllers/public_api_controller.rb +3 -2
- data/lib/mints/controllers/user_api_controller.rb +3 -2
- data/lib/pub.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ade2308c58baa5c1b9ec010767f715069af50a2204820c3df6d4cb31231ad9de
|
4
|
+
data.tar.gz: 9a4ad29bac5f2a290e7c248619f2994dda26bff74686ee851e5cabd6ba321d6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 345e8d6efdc4c0f114adb3a3f1a0840050d5b447a38d07acf13a0d49a1c839a8cb33d6bbec95fd52f23b490b06947c672650830d0d62f18f3892fccc1d0978d5
|
7
|
+
data.tar.gz: 6b8e8682b9c64126399f105ee562103d95ebd14b6484b3b40a59bcda2c84cff710188514ad83363e8778fa476fba149469a76a16c38a3396b2bb25e16a6a616f
|
data/Readme.md
CHANGED
@@ -30,7 +30,7 @@ con.login(email, password)
|
|
30
30
|
con.get_contacts
|
31
31
|
```
|
32
32
|
## Generate mints files
|
33
|
-
This command will generate the mints_config.yml file, API controlles and routes to have available the mints endpoints
|
33
|
+
This command will generate the mints_config.yml.erb file, API controlles and routes to have available the mints endpoints
|
34
34
|
```bash
|
35
35
|
rails generate mints_files
|
36
36
|
```
|
@@ -46,8 +46,8 @@ This heritance will make the following class variables available:
|
|
46
46
|
|
47
47
|
| Variable | Description |
|
48
48
|
| --- | :---: |
|
49
|
-
| @host | Host defined in mints_config.yml file |
|
50
|
-
| @api_key | API key defined in mints_config.yml file |
|
49
|
+
| @host | Host defined in mints_config.yml.erb file |
|
50
|
+
| @api_key | API key defined in mints_config.yml.erb file |
|
51
51
|
| @mints_pub | An already instanced public client |
|
52
52
|
| @contact_token | A token used by mints to identify the contact |
|
53
53
|
| @visit_id | An identifier of the visit registered |
|
@@ -73,8 +73,8 @@ end
|
|
73
73
|
This heritance will make the following class variables available:
|
74
74
|
| Variable | Description |
|
75
75
|
| --- | :---: |
|
76
|
-
| @host | Host defined in mints_config.yml file |
|
77
|
-
| @api_key | API key defined in mints_config.yml file |
|
76
|
+
| @host | Host defined in mints_config.yml.erb file |
|
77
|
+
| @api_key | API key defined in mints_config.yml.erb file |
|
78
78
|
| @mints_user | An already instanced user client (not usable until call the user login method) |
|
79
79
|
|
80
80
|
And the following controller methods:
|
data/lib/client.rb
CHANGED
@@ -30,7 +30,8 @@ module Mints
|
|
30
30
|
response = nil
|
31
31
|
if action === 'get'
|
32
32
|
|
33
|
-
|
33
|
+
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
34
|
+
config = YAML.load template.result(binding)
|
34
35
|
url_need_cache = false
|
35
36
|
result_from_cache = false
|
36
37
|
time = 0
|
File without changes
|
@@ -2,7 +2,7 @@ class MintsFilesGenerator < Rails::Generators::Base
|
|
2
2
|
source_root(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
include Rails::Generators::Actions
|
4
4
|
def create_mints_files
|
5
|
-
copy_file 'mints_config.yml', 'mints_config.yml'
|
5
|
+
copy_file 'mints_config.yml.erb', 'mints_config.yml.erb'
|
6
6
|
copy_file 'mints_user_controller.rb', './app/controllers/api/mints_user_controller.rb'
|
7
7
|
copy_file 'mints_contact_controller.rb', './app/controllers/api/v1/mints_contact_controller.rb'
|
8
8
|
copy_file 'mints_public_controller.rb', './app/controllers/api/v1/mints_public_controller.rb'
|
@@ -41,8 +41,9 @@ module Mints
|
|
41
41
|
# === Set Mints user client.
|
42
42
|
# Initialize the public client and set the user token
|
43
43
|
def set_mints_user_client
|
44
|
-
if File.exists?("#{Rails.root}/mints_config.yml")
|
45
|
-
|
44
|
+
if File.exists?("#{Rails.root}/mints_config.yml.erb")
|
45
|
+
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
46
|
+
config = YAML.load template.result(binding)
|
46
47
|
@host = config["mints"]["host"]
|
47
48
|
@api_key = config["mints"]["api_key"]
|
48
49
|
@debug = config["sdk"]["debug"] ? config["sdk"]["debug"] : false
|
@@ -59,15 +59,16 @@ module Mints
|
|
59
59
|
# === Set mints pub.
|
60
60
|
# Initialize the public client and set the contact token
|
61
61
|
def set_mints_pub_client
|
62
|
-
if File.exists?("#{Rails.root}/mints_config.yml")
|
63
|
-
|
62
|
+
if File.exists?("#{Rails.root}/mints_config.yml.erb")
|
63
|
+
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
64
|
+
config = YAML.load template.result(binding)
|
64
65
|
@host = config["mints"]["host"]
|
65
66
|
@api_key = config["mints"]["api_key"]
|
66
67
|
@debug = config["sdk"]["debug"] ? config["sdk"]["debug"] : false
|
67
68
|
else
|
68
69
|
raise 'MintsBadCredentialsError'
|
69
70
|
end
|
70
|
-
# Initialize mints pub client, credentials taken from mints_config.yml file
|
71
|
+
# Initialize mints pub client, credentials taken from mints_config.yml.erb file
|
71
72
|
@mints_pub = Mints::Pub.new(@host, @api_key, nil, @debug)
|
72
73
|
# Set contact token from cookie
|
73
74
|
@mints_pub.client.session_token = @contact_token
|
@@ -75,8 +75,9 @@ module Mints
|
|
75
75
|
private
|
76
76
|
|
77
77
|
def set_config_variables
|
78
|
-
if File.exists?("#{Rails.root}/mints_config.yml")
|
79
|
-
|
78
|
+
if File.exists?("#{Rails.root}/mints_config.yml.erb")
|
79
|
+
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
80
|
+
config = YAML.load template.result(binding)
|
80
81
|
@host = config["mints"]["host"]
|
81
82
|
@api_key = config["mints"]["api_key"]
|
82
83
|
@redis_server = Redis.new(host: config['redis_cache']['redis_host']) if config['redis_cache']['use_cache']
|
@@ -71,8 +71,9 @@ module Mints
|
|
71
71
|
private
|
72
72
|
|
73
73
|
def set_config_variables
|
74
|
-
if File.exists?("#{Rails.root}/mints_config.yml")
|
75
|
-
|
74
|
+
if File.exists?("#{Rails.root}/mints_config.yml.erb")
|
75
|
+
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
76
|
+
config = YAML.load template.result(binding)
|
76
77
|
@host = config["mints"]["host"]
|
77
78
|
@api_key = config["mints"]["api_key"]
|
78
79
|
@redis_server = Redis.new(host: config['redis_cache']['redis_host']) if config['redis_cache']['use_cache']
|
@@ -75,8 +75,9 @@ module Mints
|
|
75
75
|
private
|
76
76
|
|
77
77
|
def set_config_variables
|
78
|
-
if File.exists?("#{Rails.root}/mints_config.yml")
|
79
|
-
|
78
|
+
if File.exists?("#{Rails.root}/mints_config.yml.erb")
|
79
|
+
template = ERB.new File.new("#{Rails.root}/mints_config.yml.erb").read
|
80
|
+
config = YAML.load template.result(binding)
|
80
81
|
@host = config["mints"]["host"]
|
81
82
|
@api_key = config["mints"]["api_key"]
|
82
83
|
@redis_server = Redis.new(host: config['redis_cache']['redis_host'])
|
data/lib/pub.rb
CHANGED
@@ -7,7 +7,7 @@ module Mints
|
|
7
7
|
# == Usage example
|
8
8
|
# Initialize
|
9
9
|
# pub = Mints::Pub.new(mints_url, api_key)
|
10
|
-
# or if host and api_key are provided by mints_config.yml
|
10
|
+
# or if host and api_key are provided by mints_config.yml.erb
|
11
11
|
# pub = Mints::Pub.new
|
12
12
|
# Call any function
|
13
13
|
# pub.get_products
|
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.10
|
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: 2020-
|
11
|
+
date: 2020-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -120,7 +120,7 @@ files:
|
|
120
120
|
- Readme.md
|
121
121
|
- lib/client.rb
|
122
122
|
- lib/contact.rb
|
123
|
-
- lib/generators/mints_config.yml
|
123
|
+
- lib/generators/mints_config.yml.erb
|
124
124
|
- lib/generators/mints_contact_controller.rb
|
125
125
|
- lib/generators/mints_files_generator.rb
|
126
126
|
- lib/generators/mints_public_controller.rb
|