forest_liana 1.1.8 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/serializers/forest_liana/serializer_factory.rb +2 -0
- data/lib/forest_liana/engine.rb +30 -2
- data/lib/forest_liana/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f26aa0d4c0250fa9dbe7eb20a6c5cd87c79329
|
4
|
+
data.tar.gz: 672d02712c05b12e000733f677e0a79a60249d87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b6eb38d3996af65e6fd1bbebde68e9c50d216bc5a04a65da2bdbca1e6d55c9ca8bb4fc63e0147ee9b7dce162957e27ab676507bce66070ce9ea896f6baf74fc
|
7
|
+
data.tar.gz: 392c4ad2d0889c622bb0c6378008f2c754e51f16f6659b6c7fbf3b6981f9f8c9c23f649f49b389becf2831625bf2e246ee86e26e8da3e09d06fcd3c39e2632cf
|
@@ -22,6 +22,8 @@ module ForestLiana
|
|
22
22
|
"ForestLiana::StripeInvoiceSerializer"
|
23
23
|
elsif active_record_class == ForestLiana::Stat
|
24
24
|
"ForestLiana::StatSerializer"
|
25
|
+
elsif active_record_class == ForestLiana::Collection
|
26
|
+
"ForestLiana::ApimapSerializer"
|
25
27
|
else
|
26
28
|
class_name = active_record_class.table_name.classify
|
27
29
|
module_name = class_name.deconstantize
|
data/lib/forest_liana/engine.rb
CHANGED
@@ -2,10 +2,12 @@ require 'rack/cors'
|
|
2
2
|
require 'stripe'
|
3
3
|
require 'jsonapi-serializers'
|
4
4
|
require 'groupdate'
|
5
|
+
require 'http'
|
5
6
|
|
6
7
|
module ForestLiana
|
7
8
|
class Engine < ::Rails::Engine
|
8
9
|
isolate_namespace ForestLiana
|
10
|
+
logger = Logger.new(STDOUT)
|
9
11
|
|
10
12
|
config.middleware.insert_before 0, 'Rack::Cors' do
|
11
13
|
allow do
|
@@ -14,8 +16,8 @@ module ForestLiana
|
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
config.after_initialize do
|
20
|
+
unless Rails.env.test?
|
19
21
|
SchemaUtils.tables_names.map do |table_name|
|
20
22
|
model = SchemaUtils.find_model_from_table_name(table_name)
|
21
23
|
SerializerFactory.new.serializer_for(model) if \
|
@@ -30,6 +32,32 @@ module ForestLiana
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
35
|
+
|
36
|
+
if ForestLiana.jwt_signing_key
|
37
|
+
forest_url = ENV['FOREST_URL'] ||
|
38
|
+
'https://forestadmin-server.herokuapp.com';
|
39
|
+
|
40
|
+
apimaps = []
|
41
|
+
SchemaUtils.tables_names.map do |table_name|
|
42
|
+
model = SchemaUtils.find_model_from_table_name(table_name)
|
43
|
+
apimaps << SchemaAdapter.new(model).perform if model.try(:table_exists?)
|
44
|
+
end
|
45
|
+
|
46
|
+
liana_version = Gem::Specification.find_by_name('forest_liana')
|
47
|
+
.version.to_s
|
48
|
+
json = JSONAPI::Serializer.serialize(apimaps, {
|
49
|
+
is_collection: true,
|
50
|
+
meta: { liana: 'forest-rails', liana_version: liana_version }
|
51
|
+
})
|
52
|
+
response = HTTP
|
53
|
+
.headers(forest_secret_key: ForestLiana.jwt_signing_key)
|
54
|
+
.post("#{forest_url}/forest/apimaps", json: json)
|
55
|
+
|
56
|
+
if response.status_code != 204
|
57
|
+
logger.warn "Forest cannot find your project secret key. Please, " \
|
58
|
+
"run `rails g forest_liana:install`."
|
59
|
+
end
|
60
|
+
end
|
33
61
|
end
|
34
62
|
end
|
35
63
|
end
|
data/lib/forest_liana/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_liana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Munda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: http
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: Forest Rails Liana
|
112
126
|
email:
|
113
127
|
- sandro@munda.me
|