forest_liana 1.1.19 → 1.1.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4979fab7ab55ec7b11e81b79b0684e9e89f86bfe
4
- data.tar.gz: ddb3f9b8c52eec22e1020e0f50a1c58070085bd6
3
+ metadata.gz: 9ddcfda22c4ff09d0c572f50c1f9b915aaf2c594
4
+ data.tar.gz: 6e446ba8d2b87adbeaf577b444d9aa3bb962fdd7
5
5
  SHA512:
6
- metadata.gz: b84b6f850a0f3d5c95e73c022bcadf511abaa3f4232d519c67c71874e878c6f5e6648b5a48c632946e0416322d2d20b17d617d865d8bd7532ce69d66ba53279d
7
- data.tar.gz: 2f012f0fed3c22701fd53d22c131585abae3aca7a0fabcebb40bb77b982e412a6c6f8c57b74f15ea8ccf178e9897e060f776940967871516274eeec5324eded1
6
+ metadata.gz: de6db21eb97e3be4c111d451df11fc8e16a70047bb7caa127206a6498128ced2310e4d4926d5a9a2556de2daab19c25f064ede67b8cd89299cef5877198feeb4
7
+ data.tar.gz: 821e98ce6b1e834d42e86b38e39132b764b5a956919628e257ba92308a50e160921d99a5f5553d9176a2cacaead96133f66ade8b76edd185d9abbc3387a60f7a
@@ -0,0 +1,12 @@
1
+ module ForestLiana
2
+ class SmartCollection
3
+ def self.register(name, opts)
4
+ smartCollection = ForestLiana::Collection.new({
5
+ name: name,
6
+ fields: opts[:fields]
7
+ })
8
+
9
+ ForestLiana.apimap << smartCollection
10
+ end
11
+ end
12
+ end
data/lib/forest_liana.rb CHANGED
@@ -3,4 +3,6 @@ require "forest_liana/engine"
3
3
  module ForestLiana
4
4
  mattr_accessor :jwt_signing_key
5
5
  mattr_accessor :integrations
6
+ mattr_accessor :apimap
7
+ self.apimap = []
6
8
  end
@@ -9,6 +9,10 @@ module ForestLiana
9
9
  isolate_namespace ForestLiana
10
10
  logger = Logger.new(STDOUT)
11
11
 
12
+ initializer 'forest_liana.require_all' do |app|
13
+ Dir["#{app.root}/app/models/forest/*.rb"].each {|file| require file }
14
+ end
15
+
12
16
  config.middleware.insert_before 0, 'Rack::Cors' do
13
17
  allow do
14
18
  origins 'http://localhost:4200', 'https://www.forestadmin.com',
@@ -37,22 +41,20 @@ module ForestLiana
37
41
  forest_url = ENV['FOREST_URL'] ||
38
42
  'https://forestadmin-server.herokuapp.com';
39
43
 
40
- apimaps = []
41
44
  SchemaUtils.tables_names.map do |table_name|
42
45
  model = SchemaUtils.find_model_from_table_name(table_name)
43
46
  if model.try(:table_exists?)
44
- apimaps << SchemaAdapter.new(model).perform
47
+ ForestLiana.apimap << SchemaAdapter.new(model).perform
45
48
  end
46
49
  end
47
50
 
48
51
  liana_version = Gem::Specification.find_by_name('forest_liana')
49
52
  .version.to_s
50
- json = JSONAPI::Serializer.serialize(apimaps, {
53
+ json = JSONAPI::Serializer.serialize(ForestLiana.apimap, {
51
54
  is_collection: true,
52
55
  meta: { liana: 'forest-rails', liana_version: liana_version }
53
56
  })
54
57
 
55
-
56
58
  uri = URI.parse("#{forest_url}/forest/apimaps")
57
59
  http = Net::HTTP.new(uri.host, uri.port)
58
60
  http.use_ssl = true if forest_url.start_with?('https')
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "1.1.19"
2
+ VERSION = "1.1.20"
3
3
  end
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.19
4
+ version: 1.1.20
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-12-18 00:00:00.000000000 Z
11
+ date: 2015-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -147,6 +147,7 @@ files:
147
147
  - app/services/forest_liana/schema_adapter.rb
148
148
  - app/services/forest_liana/schema_utils.rb
149
149
  - app/services/forest_liana/search_query_builder.rb
150
+ - app/services/forest_liana/smart_collection.rb
150
151
  - app/services/forest_liana/stripe_cards_getter.rb
151
152
  - app/services/forest_liana/stripe_invoices_getter.rb
152
153
  - app/services/forest_liana/stripe_payment_refunder.rb